Hi there AppWorks fans,
Welcome to a new installment of AppWorks tips.
This week, we dive into Java documentation which relates to the AppWorks platform SDK. SDK? Yes, just a bunch of libraries that makes your life easy when doing fancy stuff on the platform. It’s well documented, but still unclear from my experience…I hope this post will change my mind how this SDK is usable when we play with it.
Let’s start with the questions what this SDK is not from what I experienced? Well, this SDK is not your entry point to build your own client tool to communicate with the AppWorks platform and triggering services, BPMs, or entity related stuff. Hmmmm…So what can we do with it? Well, we will cover the answer on that question in this post with nice samples for your own usage.
Let get right into it…
Where to start? Well, what is an SDK without documentation!? For Java, we use JavaDoc and for our beloved platform, we can find the ‘AppWorksPlatform-22.4-JavaDocs’ here. It’s a ZIP file for you to download and after extraction, you can open the index.html
from your favorite browser with a view like this:
Make yourself familiar with the documentation and click around on your own interests…Take your time; don’t rush; no hurry; no pressure; think; think again;
You will see ‘deprecated’ functions passing by; for explained reasons. This JavaDoc is available since the earliest version of the platform, but still usable for some interesting parts.
…
Are you ready for the next level? Let’s start opening your favorite IDE…In my case IntelliJ, but you can use whatever you like; If you can create maven dependency type of Java projects, you should be fine in this post!
Wait, do one step back and just start creating a project with Maven, and open it with IntelliJ! Make sure you have Maven available on your local machine; Together with the Java SDK…Dûh! Start with this set of commands from a new PowerShell prompt and call Maven archetype to generate a fancy Maven project:
1 | mvn -version |
FYI: The Java version matters! You want to match with the Java version supported for the current running AppWorks platform. This prevents version conflict on Java classes after deployment! Like this
UnsupportedClassVersionError: Unsupported major.minor version 51.0
or thisclass file has wrong version 55.0, should be 52.0
…Find some background info here on those version numbers.
The above “Interactive” CLI created for us a so-called pom.xml
with a first Java project structure. Now open the pom.xml
file with IntelliJ with a first view like this:
Hit that play-button to see a first valid test! 😅 Now what? Well, how about grabbing a copy of our beloved platform dependencies! Start your AWP VM and make sure to make a copy of the following folder structure (in the root of the AppWorks installation location) with those two JAR-files locally on your machine:
1 | - certificates |
Note: The
lib
directory contains.so
files (Shared Object in Unix!), but in Windows we have the equivalent with.dll
files (Dynamic Link Library). You don’t have these if you only have Unix installation files, but you can extract them from the Windows installation files of the platform. See here too!
The next step is making the classes available in our Maven project as dependencies in the pom.xml
file! We have some options to choose from:
- The “I-do-not-understand-maven-option”; This option is adding the dependencies directly to the classpath of the project as external library. You can make this configuration in the ‘Project Structure’ under the File menu item of IntelliJ. The big disadvantage is that this is not saved with the project in a commit, so other developers can benefit from it. One thing in life I learned is using a dependency management system for any Java related project.
- The “not-recommended-but-quick-way”; Pointing the dependencies directly to the system filepath. We use this option for this post for quick initialization of our blog post. You will see examples below.
- The “common-regular-recommended-way”; Install the dependent libraries to your local repository with a command like this: After this installation, you can use the new dependency in your
1
mvn install:install-file -Dfile=C:\CORDYS_22_4\components\eibxml\eibxml.jar -DgroupId=com.opentext -DartifactId=eibxml -Dversion=22.4 -Dpackaging=jar`
pom.xml
file directly. - The “pro-way-if-available”; This is the use of an artifact manager (like Nexus or Artifactory) where you can use the
mvn deploy
command to upload deliveries to a central repository to consume from. Read this article for more background information.
We go for option 2 because I’m the only developer for this project and want to make progression as fast as possible. For multiple developers, I would have gone for option 3! At the customer, I would always recommend option 4.
So, option 2; Open the pom.xml
and modify the dependencies-XML part:
1 | <dependencies> |
I upgraded the JUnit 4 dependency to JUnit 5 dependency and included another interesting dependency AssertJ…Why? Well, here’s why (see the difference in readability):
1 | package nl.bos; |
How nice! 🤓 Right, but why the specific eibxml.jar
? Well, did you open it with JD-GUI already?
Do you see those interesting classes? In the com.eibus.xml.nom
and com.eibus.xml.xpath
package? So, we can start programming now…right? Yes, we can…
FYI: The
basicutil.jar
is an extra library dependent to theeibxml.jar
!
Our first lines of (test driven!) development
Let’s start creating a new test readXMLData
which we read with the Document
object of the eibxml
dependency. Just like this:
1 | private String xmlInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + |
Since Java 15, there is a better way for writing down the ‘xmlInput’ variable; It’s called “Text block literals”, but we’re on version 11 currently with our platform. If you have upgraded to the supported Java 17 with AWP 22.4, you can try it out! Nice stuff…
Hit the play button for that test and make your conclusion on a message java.lang.UnsatisfiedLinkError: no xmlForJava in java.library.path
! Where did we see this before? Have a look here…
To fix this for our Maven project, I make an update in the pom.xml
for one of the available plugins:
1 | <plugin> |
A rerun will give a new familiar error: java.lang.UnsatisfiedLinkError: C:\CORDYS_22_4\lib\xmlForJava.dll: Can't find dependent libraries
. We can fix this with a path variable on our local system: set PATH=%PATH%;C:\CORDYS_22_4\lib
After an IntelliJ restart (to pick up the PATH
) and another rerun, I see a green checkmark:
Playground is open with for TDD
1 |
|
We now use the
System.out.println()
to show the details in the console, but I normally recommend using a logger object for this; like these examples:
CordysLogger.getCordysLogger(AppTest.class);
; This is part of themanagementlib
dependency!Log.createLogger(AppTest.class);
; This is part of thebasicutil
dependency!
What else?
What about reading platform specific properties, converting information, and calling utility methods:
1 |
|
To make it all run smoothly (also for the
classInformation
anddataConversion
tests), I needed to update mypom.xml
with extended dependencies:
1 | <dependency> |
Interesting! But what about real AWP calls!?!? Well, I tried out these classes for you, but dramatically failed calling them from my local laptop where my AWP is running in a VM. That’s why I annotated the tests with @Disabled
(in the download below!); I leave them in for my own future reference as they do provide interesting insights to share.
com.cordys.cap.utility.DeploymentUtility
com.eibus.applicationconnector.sql.DBConnectionPool
com.cordys.cpc.bsf.event.IInitializeListener
com.cordys.cpc.bsf.soap.SOAPRequestObject
You can download the full test class here as well as my pom.xml
where you also see the extra dependencies passing by for the last 4 objects in the disabled tests.
With that said…It’s time to continue our lives, but not before I present you a proper overview of the packages documented in the SDK…
Packages overview
package | description |
---|---|
com.cordys.bre.engine |
Part of business rule documents with decision tables in BPMs; Replaced with the entity modeling ‘Rule’ BB. |
com.cordys.bre.repository |
The API for managing rule documents |
com.cordys.cap.utility |
API for deploying CAP packages and getting package info! Check the samples in this post… |
com.cordys.cpc.bsf.busobject |
The data inside a busobject equals an XML/NOM document; Contains CustomBusObject, QueryObject, DML, and DDL |
com.cordys.cpc.bsf.classinfo |
Getting your info on class definitions and related fields |
com.cordys.cpc.bsf.connector |
Internal usage of the WsAppserver service container |
com.cordys.cpc.bsf.event.* |
Package for event listeners; like onCreate, onDelete, onChange; Does it ring a bell? |
com.cordys.cpc.bsf.query.* |
Map BusObject-data to XML, required by XQY |
com.cordys.cpc.bsf.soap |
API class to call soap methods |
com.cordys.cpc.bsf.types |
‘UnsignedByte’; “Represents an unsigned integer number in the range {1, 255} inclusive” |
com.cordys.cpc.bsf.util |
Datatype converters, ObjectHelper, and TupleHandling in <tuple><old> format |
com.cordys.cpc.coboc |
Deprecated! CoBOC ‘smells’ like the old way of the new entity modeling principles. |
com.cordys.cpc.coboc.modeler |
Deprecated! |
com.cordys.cpc.coboc.repository |
Deprecated! |
com.cordys.cpc.coboc.scheduler |
Looks like this represents the schedule documents created for a solution; managed by the schedule manager. |
com.cordys.cpc.notification.runtime |
Deprecated! |
com.cordys.datagovernance.registry.idgenerators |
Generate registry identifiers for MDM models; I never use it (I guess!?) |
com.cordys.documentstore |
Partly covered in this post |
com.cordys.documentstore.otcs |
Specific ‘Category’ classes for OpenText Content Server |
com.cordys.documentstore.search |
Interfaces for the documentstore search responses |
com.cordys.logger |
Quoted: “Allows the users to add logger context for the current thread.”; I never use it (I guess!?) |
com.cordys.mdm.* |
MDM is part of the ‘old’ Cordys implementation for the platform; It’s overruled with new techniques. |
com.cordys.notification.* |
A package for task assignment (inbox). The ReST layer of the platform has a new implementation. |
com.cordys.task.cap.util |
I don’t know; I don’t want to know; I never use it (I guess!?) |
com.cordys.xml.dom |
Convert org.w3c.dom nodes to com.eibus.xml.nom nodes…See samples in this post. |
com.eibus.applicationconnector.sql |
API to access XQY layer to query XML data |
com.eibus.applicationconnector.uddi |
Partly covered in this post |
com.eibus.connector.nom |
Package to connect to Cordys ESB and listening for XML Soap messages |
com.eibus.contentmanagement |
Entrance for managing ISV packages; I never use it (I guess!?) |
com.eibus.directory.soap |
LDAP Directory Connection (CARS), operations and LDAPEntry object attributes. |
com.eibus.management.* |
Interfaces for managing AWP (incl. counters); Like alerts, JMX, problems, and settings. |
com.eibus.security.* |
‘Authenticator’, ‘Identity’ (an organization user), and ‘Credentials’ classes |
com.eibus.soap.* |
Building a custom Application Connector with body, method definitions and processor |
com.eibus.transport |
Handle incoming messages from the Cordys ESB |
com.eibus.util |
Utilities for you to use; Like CommandLine parser, Cordys Constants, (Blocking) Queue, Random int, ENUM sorter |
com.eibus.util.cache |
Quoted: “This class acts as generic superclass for thread safe caches of for example SOAP call results.” |
com.eibus.util.logger |
Instantiate CordysLogger for logging |
com.eibus.util.system |
See the sample readProperties in this post for examples |
com.eibus.xforms |
Creating dynamic xforms; I never use it (I guess!?) |
com.eibus.xml.nom |
Working with XML nodes as Java integers as shown in this post examples |
com.eibus.xml.xpath |
Using xPath expressions for finding XML nodes |
com.opentext.applicationconnector.httpconnector |
The interface classes for the next implementation package |
com.opentext.applicationconnector.httpconnector.impl |
Partly covered in this post |
NOTE: I placed the exception
packages out of scope for this post as they only implement custom exception handling for that related package.
Abbreviations:
- BRE = Business Rule Engine
- BSF = Bus Service Framework
- CoBOC = Collaborative Business Object Cache
- CPC = Cordys Platform Component
- DDL = Data Definition Language
- DML = Data Manipulation Language
- DOM = Document Object Model
- ESB = Enterprise Service Bus
- ISV = Independent Software Vendor
- MDM = Master Data Management
- NOM = Native Object Model
- SQL = Structured Query Language
- UDDI = Universal Description, Discovery, and Integration
- XQY = XML QuerY
I give it a well “DONE” for this post where we definitely got a deeper dive then expected on the AWP SDK. Let’s recap the question on what the SDK is not? It’s indeed not a tool to build a client around it…I guess!? (I saw something interesting passing by during my journey for next week!). The SDK for sure has interesting utility classes to use for future AppWorks development, but I also see the platform contains more classes beyond the description of this SDK!…Have a search for implements
in the advanced developer guide for interesting topics! 🤠 Have a great TDD-weekend; I CU in the next post, next week!
Don’t forget to subscribe to get updates on the activities happening on this site. Have you noticed the quiz where you find out if you are also “The AppWorks guy”?