当前位置: 首页>>代码示例>>Java>>正文


Java AS400类代码示例

本文整理汇总了Java中com.ibm.as400.access.AS400的典型用法代码示例。如果您正苦于以下问题:Java AS400类的具体用法?Java AS400怎么用?Java AS400使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AS400类属于com.ibm.as400.access包,在下文中一共展示了AS400类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.ibm.as400.access.AS400; //导入依赖的package包/类
/**
 * Test routine for fetching a spooled file list
 *
 * @param args systemName userId password userFilter
 * @see #setUserFilter(java.lang.String)
 */
public static void main(String args[]) {
    String systemName = args[0];
    String userId = args[1];
    String password = args[2];
    String userFilter = args[3];
    try {
        AS400 as400 = AS400Factory.newAS400(systemName, userId, password);
        SpooledFileLister lister = new SpooledFileLister(as400);
        lister.setUserFilter(userFilter);
        Enumeration e = lister.getSynchronously();
        while (e.hasMoreElements()) {
            SpooledFile spf = SpooledFile.class.cast(e.nextElement());
            System.out.println(spf.getName() + " " + spf.getNumber() + " " + spf.getJobName() + " " + spf.getJobUser() + " " + spf.getJobNumber() + " " + spf.getCreateDate() + " " + spf.getCreateTime());
        }
    } catch (AS400SecurityException | ErrorCompletingRequestException | IOException | InterruptedException | PropertyVetoException | RequestNotSupportedException ex) {
        LOG.log(Level.SEVERE, "Exception fetching list of spooled files", ex);
    }
}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:25,代码来源:SpooledFileLister.java

示例2: main

import com.ibm.as400.access.AS400; //导入依赖的package包/类
/**
 * A test of fetching the transformed spooled file and transforming it.
 *
 * @param args sysName userId password spoolFileName spoolNumber jobName
 * jobUser jobNumber
 */
public static void main(String[] args) {
    String sysName = args[0];
    String userId = args[1];
    String password = args[2];
    String spoolFileName = args[3];
    int spoolNumber = Integer.parseInt(args[4]);
    String jobName = args[5];
    String jobUser = args[6];
    String jobNumber = args[7];

    try {
        AS400 as400 = AS400Factory.newAS400(sysName, userId, password);
        TransformedSpooledFileFetcher fetcher = new TransformedSpooledFileFetcher(as400, spoolFileName, spoolNumber, jobName, jobUser, jobNumber);
        System.out.print(fetcher.fetchSpooledFile());
        System.out.flush();
    } catch (AS400SecurityException | PropertyVetoException | ErrorCompletingRequestException | IOException | InterruptedException | RequestNotSupportedException ex) {
        LOG.log(Level.SEVERE, "Exception fetching spooled file", ex);
    }

}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:27,代码来源:TransformedSpooledFileFetcher.java

示例3: exceptionOccurred

import com.ibm.as400.access.AS400; //导入依赖的package包/类
@Override
public void exceptionOccurred(SignonEvent event)
        throws AS400SecurityException {
    boolean reThrowing = true;
    AS400 as400 = AS400.class
            .cast(event.getSource());
    AS400SecurityException aS400SecurityException = event.getException();
    int asexRc = aS400SecurityException.getReturnCode();
    /* Debug */ Logger.getLogger(SignonHandler.class
            .getName()).log(Level.INFO, "AS400SecurityException retcode is {0}", asexRc);
    switch (asexRc) {
        case AS400SecurityException.PASSWORD_ERROR:
        case AS400SecurityException.PASSWORD_INCORRECT:
            try {
                if (pollForPassword(as400)) {
                    reThrowing = false;
                }
            } catch (IOException ex) {
                Logger.getLogger(SignonHandler.class.getName()).log(Level.SEVERE, null, ex);
            }
            break;
    }
    if (reThrowing) {
        throw aS400SecurityException;
    }
}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:27,代码来源:SignonHandler.java

示例4: pollForPassword

import com.ibm.as400.access.AS400; //导入依赖的package包/类
/**
 * Polls user for a password and if gotten resets password field of as400
 *
 * @param as400 the system we are trying to get a valid password for
 * @return true if got a password from user
 * @throws IOException
 */
protected boolean pollForPassword(AS400 as400) throws IOException {
    boolean result = false;
    String passwordPrompt = "Please enter a valid password for " + as400.getSystemName() + " (will not echo):";
    char[] password;
    if (System.console() != null) {
        password = System.console().readPassword(passwordPrompt);
    } else {
        if (Ublu.ubluSingleton.isGoubluing()) {
            System.out.println(passwordPrompt);
        } else {
            System.out.print(passwordPrompt);
        }
        password = new BufferedReader(new InputStreamReader(System.in)).readLine().trim().toCharArray();
    }
    String pString = new String(password).trim();
    if (!pString.isEmpty()) {
        as400.setPassword(pString);
        result = true;
    }
    return result;
}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:29,代码来源:SignonHandler.java

示例5: pollForUserId

import com.ibm.as400.access.AS400; //导入依赖的package包/类
/**
 * Polls user for a userid and if gotten resets userid field of as400
 *
 * @param as400 the system we are trying to get a valid userid for
 * @return true if got a userid from user
 * @throws IOException
 * @throws PropertyVetoException
 */
protected boolean pollForUserId(AS400 as400) throws IOException, PropertyVetoException {
    boolean result = false;
    String useridPrompt = "Please enter a valid userid for " + as400.getSystemName() + ": ";
    if (Ublu.ubluSingleton.isGoubluing()) {
        System.out.println(useridPrompt);
    } else {
        System.out.print(useridPrompt);
    }
    byte[] userid = new byte[16]; // longer than real userid swallows lf
    int numRead = System.in.read(userid);
    if (numRead > 0) {
        String uidString = new String(userid).trim();
        as400.setUserId(uidString);
        result = true;
    }
    return result;
}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:26,代码来源:SignonHandler.java

示例6: getDriverName

import com.ibm.as400.access.AS400; //导入依赖的package包/类
/**
 * Translate type into string name of driver class
 *
 * @return Driver name so we can instance it.
 */
public String getDriverName() {
    String driverName = "";
    switch (getDbType()) {
        case AS400:
            driverName = "com.ibm.as400.access.AS400JDBCDriver";
            break;
        case PGSQL:
            driverName = "org.postgresql.Driver";
            break;
        case MSSQL:
            driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
    }
    // /* Debug */ getLogger().log(Level.INFO, "Driver name is " + getDriverName);
    return driverName;
}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:21,代码来源:Db.java

示例7: getDriverType

import com.ibm.as400.access.AS400; //导入依赖的package包/类
/**
 * Translate the driver type for composing the connection url
 *
 * @return the driver string for the connection url
 */
public String getDriverType() {
    String type = "";
    switch (getDbType()) {
        case AS400:
            type = "as400";
            break;
        case PGSQL:
            type = "postgresql";
            break;
        case MSSQL:
            type = "sqlserver";
            break;
    }
    return type;
}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:21,代码来源:Db.java

示例8: main

import com.ibm.as400.access.AS400; //导入依赖的package包/类
/**
 *
 * @param args
 */
public static void main(String[] args) {
    String sysName = args[0];
    String userId = args[1];
    String password = args[2];
    String spoolFileName = args[3];
    int spoolNumber = Integer.parseInt(args[4]);
    String jobName = args[5];
    String jobUser = args[6];
    String jobNumber = args[7];

    try {
        AS400 as400 = AS400Factory.newAS400(sysName, userId, password);
        SpooledFilePageFetcher fetcher = new SpooledFilePageFetcher(as400, spoolFileName, spoolNumber, jobName, jobUser, jobNumber);
        System.out.print(fetcher.readAllPages());
        System.out.flush();
    } catch (AS400SecurityException | PropertyVetoException | ErrorCompletingRequestException | IOException | InterruptedException | RequestNotSupportedException ex) {
        LOG.log(Level.SEVERE, "Exception fetching spooled file", ex);
    }

}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:25,代码来源:SpooledFilePageFetcher.java

示例9: main

import com.ibm.as400.access.AS400; //导入依赖的package包/类
/**
 *
 * @param args
 */
public static void main(String[] args) {
    String sysName = args[0];
    String userId = args[1];
    String password = args[2];
    String spoolFileName = args[3];
    int spoolNumber = Integer.parseInt(args[4]);
    String jobName = args[5];
    String jobUser = args[6];
    String jobNumber = args[7];

    try {
        AS400 as400 = AS400Factory.newAS400(sysName, userId, password);
        SpooledFileFetcher fetcher = new SpooledFileFetcher(as400, spoolFileName, spoolNumber, jobName, jobUser, jobNumber);
        System.out.print(fetcher.fetchSpooledFile());
        System.out.flush();
    } catch (AS400SecurityException | PropertyVetoException | ErrorCompletingRequestException | IOException | InterruptedException | RequestNotSupportedException ex) {
        LOG.log(Level.SEVERE, "Exception fetching spooled file", ex);
    }

}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:25,代码来源:SpooledFileFetcher.java

示例10: newAS400

import com.ibm.as400.access.AS400; //导入依赖的package包/类
/**
 * Create a new AS400 object with the correct security type and signon
 * handler using our extenders to have the password at our disposal for use
 * with JTOpenLite classes.
 *
 * @param signon_security_type is this none or ssl?
 * @param signon_handler_type handler type for failed signons
 * @param systemName systemName
 * @param userId userId
 * @param password password
 * @return the new AS400 object
 */
protected static AS400 newAS400(SIGNON_SECURITY_TYPE signon_security_type, SIGNON_HANDLER_TYPE signon_handler_type, String systemName, String userId, String password) {
    AS400 as400
            = signon_security_type == SIGNON_SECURITY_TYPE.NONE
                    ? new AS400(systemName, userId, password)
                    : new SecureAS400(systemName, userId, password);
    switch (signon_handler_type) {
        case CUSTOM:
            as400.setSignonHandler(new SignonHandler());
            break;
        case NULL:
            as400.setSignonHandler(new NullSignonHandler());
            break;
        case BUILTIN:
            break;
    }
    return as400;
}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:30,代码来源:AS400Factory.java

示例11: getSpooledFileListerFromArgs

import com.ibm.as400.access.AS400; //导入依赖的package包/类
private SpooledFileLister getSpooledFileListerFromArgs(ArgArray argArray) throws PropertyVetoException, AS400SecurityException {
    SpooledFileLister splflister = null;
    AS400 a = getAs400();
    if (a == null) {
        try {
            setAs400(as400FromArgs(argArray));
        } catch (PropertyVetoException ex) {
            getLogger().log(Level.SEVERE, "Could not instance AS400 system from provided arguments in " + getNameAndDescription(), ex);
        }
    }
    if (a != null) {
        String spoolowner = argArray.nextMaybeQuotationTuplePopStringTrim();
        splflister = new SpooledFileLister(a);
        splflister.setUserFilter(spoolowner);
    }
    return splflister;
}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:18,代码来源:CmdSpoolFList.java

示例12: getSpooledFileFromArgs

import com.ibm.as400.access.AS400; //导入依赖的package包/类
private SpooledFile getSpooledFileFromArgs(ArgArray argArray) {
    SpooledFile splf = null;
    AS400 a = getAs400();
    if (a == null) {
        try {
            setAs400(as400FromArgs(argArray));
        } catch (PropertyVetoException ex) {
            getLogger().log(Level.SEVERE, "Could not instance AS400 system from provided arguments in " + getNameAndDescription(), ex);
        }
    }
    if (a != null) {
        String name = argArray.nextMaybeQuotationTuplePopStringTrim();
        int number = argArray.nextIntMaybeQuotationTuplePopString();
        String jobName = argArray.nextMaybeQuotationTuplePopStringTrim();
        String jobUser = argArray.nextMaybeQuotationTuplePopStringTrim();
        String jobNumber = argArray.nextMaybeQuotationTuplePopStringTrim();
        splf = new SpooledFile(a, name, number, jobName, jobUser, jobNumber);
    }
    return splf;
}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:21,代码来源:CmdSpoolF.java

示例13: getTextToWrite

import com.ibm.as400.access.AS400; //导入依赖的package包/类
private String getTextToWrite(AS400 as400, String writeableString) throws FileNotFoundException, IOException {
    String text = null;
    DataSink dsrc = getDataSrc();
    switch (dsrc.getType()) {
        case STD:
            text = writeableString;
            break;
        case FILE:
            File f = new File(dsrc.getName());
            FileReader fr = new FileReader(f);
            int length = new Long(f.length()).intValue();
            char[] in = new char[length];
            fr.read(in);
            text = new String(in);
            break;
        case TUPLE:
            text = getTuple(dsrc.getName()).getValue().toString();
            break;
    }
    return text;
}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:22,代码来源:CmdIFS.java

示例14: getSpooledFileOpenListFromArgs

import com.ibm.as400.access.AS400; //导入依赖的package包/类
private SpooledFileOpenList getSpooledFileOpenListFromArgs(ArgArray argArray) {
    SpooledFileOpenList splfol = null;
    AS400 a = getAs400();
    if (a == null) {
        try {
            setAs400(as400FromArgs(argArray));
        } catch (PropertyVetoException ex) {
            getLogger().log(Level.SEVERE, "Could not instance AS400 system from provided arguments in " + getNameAndDescription(), ex);
            setCommandResult(COMMANDRESULT.FAILURE);
        }
    }
    if (a != null) {
        splfol = new SpooledFileOpenList(a);
    }
    return splfol;
}
 
开发者ID:jwoehr,项目名称:ublu,代码行数:17,代码来源:CmdSpoolFOpenList.java

示例15: testConnectTimeout

import com.ibm.as400.access.AS400; //导入依赖的package包/类
@Test
public void testConnectTimeout() throws Exception
{
   As400OriginDataSource ds = new As400OriginDataSource();
   ds.setProperty(As400DataSource.USERNAME, "username");
   ds.setProperty(As400DataSource.PASSWORD, "password");
   ds.setProperty(As400DataSource.HOSTNAME, "10.254.254.254");

   AS400 conn = null;

   ds.setProperty(As400DataSource.CONNECT_TIMEOUT, "1"); // set to one second
   long start = System.nanoTime();
   try {
      conn = ds.getConnection();
      fail("Data Source getConnection should not have had sufficient time to connect");
   } catch(DataSourceException de) {
      long end = System.nanoTime();
      assertEquals("connection.timedout", de.getMessage());
      assertTrue(SECONDS.convert((end - start), NANOSECONDS) < 2);
   } finally {
      if(conn != null) conn.resetAllServices();
   }
}
 
开发者ID:cfloersch,项目名称:xdbcp,代码行数:24,代码来源:As400OriginDataSourceTest.java


注:本文中的com.ibm.as400.access.AS400类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。