Package com.ibm.as400.access

Examples of com.ibm.as400.access.Record


    mIsTestSystem = TEST_SYSTEM.equals(systemName);

    if (!mIsTestSystem)
    {
      mSystem = new AS400(systemName, user, password);

      try
      {
        mSystem.setGuiAvailable(false);
      }
View Full Code Here


    {
      return XMLHelper.parseXML(getTestData(function), null, null);
    }

    // Conect to the iSeries
    AS400 as400 = as400Connection.getSystem();

    // Character converter
    try
    {
      mConverter = new CharConverter(as400.getCcsid());
    }
    catch (UnsupportedEncodingException e)
    {
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_AS400, "0", e);
    }

    // Determine how to operate
    String callType = config.getValue("AS400Program", function, "CallType");

    if (!CALLTYPE_SINGLE.equals(callType)
        && !CALLTYPE_MULTI.equals(callType))
    {
      List params = new Vector();
      params.add(callType);
      throw new XException(Constants.LOCATION_EXTERN,
          Constants.LAYER_TECHNICAL,
          Constants.PACKAGE_TECHNICAL_AS400, "39", params);
    } // if (!CALLTYPE_SINGLE.equals(callType) &&
      // !CALLTYPE_MULTI.equals(callType))

    if (CALLTYPE_SINGLE.equals(callType))
    { // Only one calling step, only one record wil be returned as result
      // Read the name of the programm from the configuration
      String programName = config.getValue("AS400Program", function,
          "Program");

      // Structure for input an (still empty) output parameters
      ProgramParameter[] parameters = getParametersFromDocument(
          (Document) callData, callType, function, 1, 1);

      // the program call itself
      callAS400Program(as400, programName, parameters, timeout);

      // Get the output values.
      List outputList = makeOutputFields(as400, parameters, 1);
      // Place output values in specified XML structure.
      response = getResponseDocument(function, outputList);
    } // then (CALLTYPE_SINGLE.equals(callType))
    else if (CALLTYPE_MULTI.equals(callType))
    { // Call multiple times to get entire list of output data
      // First call will determine amount of returned records.
      // Next phase is to call (another program) to get each time one
      // record.

      // Read the name of the output count determining program from the
      // configuration
      String programNameAmount = config.getValue("AS400Program",
          function, "ProgramAmount");

      // Read the e
      String programNameData = config.getValue("AS400Program", function,
          "ProgramData");

      /*
       * First call of the AS400 program to get the amount of rows to be
       * retrieved.
       */
      // Structure for input an (still empty) output parameters
      ProgramParameter[] parameters = getParametersFromDocument(
          (Document) callData, callType, function, 1, 1);

      // The first program call itself
      callAS400Program(as400, programNameAmount, parameters, timeout);

      // Number of result records to retrieve in next calling phase
      int recordAmount = getParameterAsInt(as400, parameters, 1);

      /*
       * Subsequent calls of the AS400 program to get all rows.
       */
      // for the result records
      List outputVector = new Vector();
      // Loop over all result records - count already known
      for (int row = 0; row < recordAmount; row++)
      {
        // Structure for input an (still empty) output parameters
        parameters = getParametersFromDocument((Document) callData,
            callType, function, 2 + row, 1);

        // The program call itself
        callAS400Program(as400, programNameData, parameters, timeout);

        // Retrieve result record and add it to list
        outputVector.addAll(makeOutputFields(as400, parameters, 1));
      } // for (int row=0; row<recordAmount; row++)
      response = getResponseDocument(function, outputVector);
    } // if (CALLTYPE_MULTI.equals(callType))

    // Done with the server
    as400.disconnectService(AS400.COMMAND);

    return response;
  } // execute(String function, Object callData)
View Full Code Here

  public ByteArrayConverterAS400(String system) throws XException
  {
    String as400name = Configuration.getInstance().getValue(
        Constants.CHAPTER_SYSTEM, system, "AS400");
    AS400 as400 = AS400Connection.getInstance(as400name).getSystem();
    String encoding = AS400FileBase.getEncoding(as400, system);

    try
    {
      conv = new CharConverter(encoding);
View Full Code Here

    protected Jt400DataQueueEndpoint(String endpointUri, Jt400Component component) throws CamelException {
        super(endpointUri, component);
        try {
            URI uri = new URI(endpointUri);
            String[] credentials = uri.getUserInfo().split(":");
            system = new AS400(uri.getHost(), credentials[0], credentials[1]);
            objectPath = uri.getPath();
        } catch (URISyntaxException e) {
            throw new CamelException("Unable to parse URI for " + endpointUri, e);
        }
    }
View Full Code Here

        return (Jt400PgmEndpoint) super.getEndpoint();
    }

    public void process(Exchange exchange) throws Exception {

        AS400 iSeries = getISeriesEndpoint().getiSeries();

        String commandStr = getISeriesEndpoint().getProgramToExecute();
        ProgramParameter[] parameterList = getParameterList(exchange);

        ProgramCall pgmCall = new ProgramCall(iSeries);
        pgmCall.setProgram(commandStr);
        pgmCall.setParameterList(parameterList);

        if (LOG.isDebugEnabled()) {
            LOG.trace("Starting to call PGM '{}' in host '{}' authentication with the user '{}'",
                    new Object[]{commandStr, iSeries.getSystemName(), iSeries.getUserId()});
        }

        boolean result = pgmCall.run();

        if (LOG.isTraceEnabled()) {
            LOG.trace("Executed PGM '{}' in host '{}'. Success? {}", new Object[]{commandStr, iSeries.getSystemName(), result});
        }

        if (result) {
            handlePGMOutput(exchange, pgmCall, parameterList);
        } else {
View Full Code Here

        return (Jt400PgmEndpoint) super.getEndpoint();
    }

    public void process(Exchange exchange) throws Exception {

        AS400 iSeries = getISeriesEndpoint().getiSeries();

        String commandStr = getISeriesEndpoint().getProgramToExecute();
        ProgramParameter[] parameterList = getParameterList(exchange);

        ProgramCall pgmCall = new ProgramCall(iSeries);
        pgmCall.setProgram(commandStr);
        pgmCall.setParameterList(parameterList);

        if (LOG.isDebugEnabled()) {
            LOG.trace("Starting to call PGM '" + commandStr + "' in host '" + iSeries.getSystemName()
                    + "' authentication with the user '" + iSeries.getUserId() + "'");
        }

        boolean result = pgmCall.run();

        if (LOG.isTraceEnabled()) {
            LOG.trace("Executed PGM '" + commandStr + "' in host '" + iSeries.getSystemName() + "'. Success? " + result);
        }

        if (result) {
            handlePGMOutput(exchange, pgmCall, parameterList);
        } else {
View Full Code Here

    protected Jt400PgmEndpoint(String endpointUri, Jt400Component component) throws CamelException {
        super(endpointUri, component);
        try {
            URI uri = new URI(endpointUri);
            String[] credentials = uri.getUserInfo().split(":");
            iSeries = new AS400(uri.getHost(), credentials[0], credentials[1]);
            programToExecute = uri.getPath();
        } catch (URISyntaxException e) {
            throw new CamelException("Unable to parse URI for " + endpointUri, e);
        }
    }
View Full Code Here

    protected Jt400DataQueueEndpoint(String endpointUri, Jt400Component component) throws CamelException {
        super(endpointUri, component);
        try {
            URI uri = new URI(endpointUri);
            String[] credentials = uri.getUserInfo().split(":");
            system = new AS400(uri.getHost(), credentials[0], credentials[1]);
            objectPath = uri.getPath();
        } catch (URISyntaxException e) {
            throw new CamelException("Unable to parse URI for " + endpointUri, e);
        }
    }
View Full Code Here

     *             obtained by {@link #getSystem()}.
     */
    @Deprecated
    protected BaseDataQueue getDataQueue() {
        if (dataQueue == null) {
            AS400 system = new AS400(baseEndpoint.getSystemName(), baseEndpoint.getUserID(), baseEndpoint.getPassword());
            String objectPath = baseEndpoint.getObjectPath();
            dataQueue = keyed ? new KeyedDataQueue(system, objectPath) : new DataQueue(system, objectPath);
        }
        return dataQueue;
    }
View Full Code Here

     * done.
     *
     * @return an {@code AS400} object that connects to this endpoint
     */
    public AS400 getConnection() {
        AS400 system = null;
        try {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Getting an AS400 object for '{}' from {}.", systemName + '/' + userID, connectionPool);
            }
            system = connectionPool.getConnection(systemName, userID, password);
            if (ccsid != DEFAULT_SYSTEM_CCSID) {
                system.setCcsid(ccsid);
            }
            try {
                system.setGuiAvailable(guiAvailable);
            } catch (PropertyVetoException e) {
                LOG.warn("Failed to disable AS/400 prompting in the environment running Camel. This exception will be ignored.", e);
            }
            return system; // Not null here.
        } catch (ConnectionPoolException e) {
View Full Code Here

TOP

Related Classes of com.ibm.as400.access.Record

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.