Agentry – How to use a local .ini file for parameters
A long time ago I created this post regarding the same topic:
The following is a hack, allowing you to add parameters directly to your local (development) instance of an Agentry application without registering the parameters in the SAP backend.
It is NOT supported by SAP, and it is meant only for local testing of new functionality, and should NEVER be used for a production instance of Agentry.
So please use it at your own risk.
I hope that SAP at some point will support this officially for development instances of Agentry.
The code I am providing will only work for Inventory Manager, but it should be easy to extend to Work Manager also. I have been using this for the last 6 weeks to add and modify 15+ classes for Inventory Manager 4.2, and it has been working flawlessly (sections verified [BAPI_CLASS], [BAPI_WRAPPER], [STEPHANDLER] and [SAPOBJECT]).
Regarding attached files:
I have had some problems uploading the jar and ini files mentioned. At the end of this article I will show how to recreate them.
Do you remember the days, where source=ini was supported in the JavaBE.ini file ?
This was a nice feature when you need to perform enhancements in your local development environment, even if you were using source=SAP in your production instances. Since SMP 3.0 this is no longer officially supported by Agentry, which I think is fine for Production instances. But for the development phase, where you may have several developers performing changes in the same environment, you may need to register classes which are not yet deployed to your Agentry environments.
In the following I will demonstrate a technique to allow you to add new parameters (like references to Java classes) or overwrite existing parameters to a local Agentry application instance, without having to register them in the Configuration Portal in SAP.
This is very useful in the setup we are using, where we have the following components:
- We have a master development and production instance of our application on our development SMP 3.0 server. These are 100% setup by standard, and we only use parameters configured in the Configuration Portal in the SAP Backend.
- The developer(s) has SMP installed locally on their laptops, and installs a development instance of the Agentry application. Here the development is performed.
- Changes are merged to the server periodically (in my case once a week).
By using the following technique, I can add new or extend existing Java Classes, and register them in my local Agentry application, without doing changes in the Configuration Portal in the SAP backend, which would also affect my Master development and production instances on the development SMP server.
Steps to invoke technique:
- Copy the attached jar file ‘ZConfigurableServer.jar’ to the Java folder of your Agentry application development instance (source code is supplied in attachment ‘ZConfigurableServer.zip’.
- Add the file ‘CustomDevServer.ini’ to the root folder of your application. In here you add your parameter assignments in sections as you know from the JavaBE.ini file.
- Add your new Java classes to a new or existing jar file (if necessary adjust the class path to include a new jar file).
- Perform the below changes to the Application settings in SMP 3.0.
- Change the Class Path to include a reference to the ZConfigurableServer.jar
- Overwrite the Agentry Server class to the one included in the ZConfigurableServer.jar file.
- Restart the Agentry Application.
Now the custom Server class will load everything as normal (from Config Portal in SAP), but will afterwards read the ‘CustomDevServer.ini’ file and overwrite or add any parameters from this file to the user and server configuration manager of the Agentry server.
Let me stress that I am by no means deep into all the details of the standard Agentry Server runtime. The classes CustomDevUser and CustomDevServer (of the ‘ZConfigurableServer.jar’ archive) has been developed through a trial-and-error approach until it was finally working.
I hope someone (other than me) finds it useful.
This is contained in the attached CustomDevServer.ini.txt.zip file. Just rename the .txt file.
– Download the files CustomDevUser.java.txt.zip and CustomDevServer.java.txt.zip.
– Rename the .txt files to .java
– In Eclipse create a new Java Project.
– Set up the Build path for the libraries ‘Agentry-v5.jar’ and ‘ini4j.jar’.
– Setup the Build path for the ‘SAP-Common’ and ‘SAPIM-java’ projects (sourcecode must be downloaded).
– Create package com.syclo.customer.configserver.invmgr.
– Import the two Java files.
– Export the project as a jar file with name ZConfigurableServer.jar