An interactive shell for working with Component Interfaces

Description

Component Interfaces are a programmatic way of accessing PeopleSoft components. Aside from being used for integration with other systems (and within PeopleSoft itself), Component Interfaces are a great way to test a PeopleSoft system.

The Component Interface Shell is an interactive command shell that allows you to work with PeopleSoft Component Interfaces. This is similar in nature to the Component Interface tester that is  built into Application Designer. What makes the Component Interface Shell valuable is that each interactive session can be saved off and used as the basis for automated scripts and tests. Another handy feature for the Component Interface Shell is that you can connect to multiple PeopleSoft systems at once and copy data between them via Component Interfaces (see related ticket:20).

Here is an example interactive session. See the usage notes for more details, including how to save your interactive sessions into scripts that can be run multiple times.

>>> from ci_wrap import ComponentInterfaceSession
>>> sess = ComponentInterfaceSession('localhost:9000', 'VP1')
Interactive mode detected
Connected to localhost:9000 as VP1 >>> ci = sess.getCompIntfc('USER_PROFILE')
Setting CI to interactive mode
Connected to localhost:9000 as VP1 >>> ci.UserID = 'VP1'
Connected to localhost:9000 as VP1 >>> ci.get()
1
Connected to localhost:9000 as VP1 >>> ci.LanguageCode
'ENG'
Connected to localhost:9000 as VP1 >>> ci.Roles
USER_PROFILE_RolesCollection (9 rows)
Connected to localhost:9000 as VP1 >>> for role in ci.Roles:
...     print role.RoleName
...
CRM Dashboard Administrator
EOLT_ADMIN
EOPP_USER
PAPP_USER
PeopleSoft Administrator
PeopleSoft User
ProcessSchedulerAdmin
UPG_ALLPAGES
UPG_APPSRVR
Connected to localhost:9000 as VP1 >>>

How Does It Work?

The Component Interface shell is written in  Python and uses  Jython (Python running on the Java Virtual Machine) in order to use the PeopleTools Java bindings for Component Interfaces. Python's dynamic nature is used to automatically inspect the Component Interface meta-data and create the appropriate bindings.

For example, in the transcript above, our python ci object automatically understood the underlying methods and attributes of the USER_PROFILE component interface that it is wrapping. Unlike the delivered PeopleSoft Java integration, we did not need to do anything special to make this happen (like  generating Java bindings from inside App Designer and then compiling them); the Component Interface Shell handled it automatically for us. You can introspect what properties and methods are available by using python's dir function.

Connected to localhost:9000 as VP1 >>> dir(ci) 
['AccountLocked', 'AllowSwitchUser', 'AlternateUserID', 'Cancel', 'Create', 'CurrencyCode',  
'EffectiveDateFrom', 'EffectiveDateTo', 'EmailAddresses', 'EmailUser', 'Encrypted',  
'ExpertEntry', 'FailedLogins', 'Get', 'GetPropertyByName', 'GetPropertyInfoByName', 'IDTypes',  
'LanguageCode', 'Market', 'MultiLanguageEnabled', 'NavigatorHomePermissionList', 'Opertype',  
'PrimaryPermissionList', 'ProcessProfilePermissionList', 'ReassignUserID', 'ReassignWork',  
'ResetPassword', 'ResetPassword_AlphaNum', 'Roles', 'RowSecurityPermissionList', 'Save',  
'SetPassword', 'SetPropertyByName', 'SetUserDescription', 'SupervisingUserID', 'SymbolicID',  
'UserDescription', 'UserID', 'UserIDAlias', 'WorklistEntriesCount', 'WorklistUser',  
'__class__', '__delattr__', '__dict__', '__doc__', '__getattr__', '__getattribute__',  
'__hash__', '__init__', '__members__', '__methods__', '__module__', '__new__', '__reduce__',  
'__repr__', '__setattr__', '__str__', '_check_session_messages', '_set_properties', 'cancel',  
'compIntfcName', 'componentName', 'createKeyInfoCollection', 'description', 'dump',  
'editHistoryItems', 'findKeyInfoCollection', 'get', 'getDummyRows', 'getHistoryItems',  
'getKeyInfoCollection', 'interactiveMode', 'invokeMethod', 'name', 'propertyInfoCollection',  
'save', 'session', 'stopOnFirstError', 'wrapped'] 

Installation

The Component Interface Shell needs Jython and the PeopleSoft Java Component Interface library, psjoa.jar, installed in order to work. The latest release of Jython that is available is 2.5.1 (soon to be 2.5.2), but the shell currently uses the previous Jython release, 2.2.1. This is primarily because Jython 2.5.x requires Java 5, but we want this to be compatible with older PeopleTools versions as well.

  1. Java. Your PeopleSoft environment should already have Java installed, so you should be able to use that.
  2.  Install Jython 2.2.1. The simplest thing to do is select the standalone option in the installer. In the environment that was used to generate the transcript above after running the installer we had a c:\jython2.2.1 directory with just a jython.jar file in it.
  3. Component Interface Shell. This is currently just one file, ci_wrap.py.

To run the interactive shell you would enter a command similar to the following from whatever directory that you put the ci_wrap.py file in. This is shown on Windows, but works fine on Unix/Linux as well. You'll want to have your PS_HOME variable set so that the psjoa.jar file (the PeopleSoft Java Object Adapter) can be located.

C:\cishell>java -jar c:\jython2.2.1\jython.jar

This will then leave you at the Component Interface Shell prompt

Jython 2.2.1 on java1.6.0_13
Type "copyright", "credits" or "license" for more information.
>>> 

You can then run the commands as shown in the session transcript above to get a feel for how it works. Start with importing the library and establishing a session (you may see a message about the pstools.properties file not being found, but you can safely ignore this). Note that in the example above we did not supply the password, so it just defaulted to the user ID. In the example below a password is explicitly provided. Once you are connected to the PeopleSoft application server, the command prompt will change to you the appserver and your current user id.

>>> from ci_wrap import ComponentInterfaceSession
>>> sess = ComponentInterfaceSession('localhost:9000', 'VP1', 'PasswordGoesHere')
Interactive mode detected
Connected to localhost:9000 as VP1 >>>

Bugs/Feature Requests

Existing bugs and feature requests for ComponentInterfaceShell are here.

If you have any issues, create a new ticket (requires registration).

Source

You can browse through the source code here. Good starting points are

Registered users can check out ComponentInterfaceShell from  here using Subversion.

Recent Changes

[100] by chris.heller on 2010/08/23 23:16:37

Add native support for connecting to different peopletools versions for multiple ComponentInterfaceShell sessions. This closes ticket:31. This also relaxes the previous need to have the psjoa.jar file specified on bootclasspath.

[99] by chris.heller on 2010/08/23 21:14:23

Fix typo in changeset:98

[98] by chris.heller on 2010/08/23 21:13:16

Work on ticket:31. Add example of connecting to multiple different PeopleSoft systems on different PeopleTools versions.

[97] by chris.heller on 2010/08/22 23:54:08

Add example showing ComponentInterfaceShell commands saved off in a separate script. This example gives merit raises through the CI_JOB_DATA component interface