All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jtopenlite.com.ibm.jtopenlite.command.Program Maven / Gradle / Ivy

There is a newer version: 20.0.8
Show newest version
///////////////////////////////////////////////////////////////////////////////
//
// JTOpenLite
//
// Filename:  Program.java
//
// The source code contained herein is licensed under the IBM Public License
// Version 1.0, which has been approved by the Open Source Initiative.
// Copyright (C) 2011-2012 International Business Machines Corporation and
// others.  All rights reserved.
//
///////////////////////////////////////////////////////////////////////////////

package com.ibm.jtopenlite.command;


/**
 * Used by classes that wish to implement a program call, this essentially represents a System i program (PGM).
 * The {@link CommandConnection#call(Program) CommandConnection.call()} method will internally call the methods
 * on this interface when it needs information about the Program being called.
 * 

* The current order of operations (subject to change) that CommandConnection uses when call(Program) is invoked is as follows: *

    *
  1. CommandConnection.call(program)
  2. *
  3. --> program.newCall()
  4. *
  5. --> program.getNumberOfParameters()
  6. *
  7. --> begin loop
  8. *
  9. ------> program.getParameterInputLength()
  10. *
  11. --> end loop
  12. *
  13. --> program.getProgramName()
  14. *
  15. --> program.getProgramLibrary()
  16. *
  17. --> begin loop
  18. *
  19. ------> program.getParameterInputLength()
  20. *
  21. ------> program.getParameterOutputLength()
  22. *
  23. ------> program.getParameterType()
  24. *
  25. ------> program.getParameterInputData()
  26. *
  27. --> end loop
  28. *
  29. --> program.getNumberOfParameters()
  30. *
  31. --> begin loop
  32. *
  33. ------> program.getParameterOutputLength()
  34. *
  35. ------> program.getTempDataBuffer()
  36. *
  37. ------> program.setParameterOutputData()
  38. *
  39. --> end loop
  40. *
* @see CommandConnection#call(Program) **/ public interface Program { /** * Invoked before any other methods on this interface by CommandConnection whenever this Program is called. **/ public void newCall(); /** * Returns the number of parameters for this program. **/ public int getNumberOfParameters(); /** * Returns the input length of the parameter at the specified index. **/ public int getParameterInputLength(int parmIndex); /** * Returns the output length of the parameter at the specified index. **/ public int getParameterOutputLength(int parmIndex); /** * Returns the type of parameter at the specified index. * @see Parameter **/ public int getParameterType(int parmIndex); /** * Returns the input data of the parameter at the specified index. **/ public byte[] getParameterInputData(int parmIndex); /** * The implementor can create their own temp byte array for the output parameter size and reuse it each time a call is performed, * or for more than one parameter on the same call. * The implementor can choose to ignore this, and simply return null. The command connection checks to see if the * buffer returned by this method is not null and large enough to accommodate the output parameter size. **/ public byte[] getTempDataBuffer(); /** * Sets the output data for the parameter at the specified index. **/ public void setParameterOutputData(int parmIndex, byte[] tempData, int maxLength); /** * Returns the name of the program object. **/ public String getProgramName(); /** * Returns the library of the program object. **/ public String getProgramLibrary(); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy