Java SDK - Overview
Java SDK for Zoho catalyst paves the way for creating microservices, interactive web and mobile applications with Java programming elements and associating them with catalyst components. The SDK offers the necessary structures to access the Catalyst APIs comfortably. It acts as a wrapper for the REST APIs and helps you use Catalyst services effectively.
To initialize Catalyst project, add the code snippet below to your Java source code as the very first statement, before you start writing your business logic.
In Java SDK it is not mandatory to include this initialize command as it will be automatically initialized in functions.
All the Catalyst components are modelled as Java classes with their members and methods defining the behaviour of the component.
- ZCProject is the most base class of the SDK. It has methods to initialize the catalyst project configurations and associate the components of the project.
- The class relations and hierarchy of the SDK follow the project hierarchy in Zoho Catalyst.
- Each class has functions to fetch its properties and to fetch the data of its immediate child entities through an API call. For example, a Zoho Catalyst Data Store class (ZCDataStore) will have member functions to access tables that can use the functions of its immediate child class ZCTable to set the table name, ID, etc.
The class hierarchy of various Zoho Catalyst components is depicted as:
It is not always effective to follow the class hierarchy all the way from the top to fetch the data of a component at a lower level, since this would involve API calls at every level. In order to avoid this, every component class has a getInstance() method to get its dummy object and methods to get dummy objects of its child entities.
getInstance() methods will not have any of their properties filled in since no API call will be made. This will just return a dummy object that will be only used to access the non-static methods of the class.
To retrieve the properties of a Catalyst component, call the component's object with its getInstance() method, then use the same object to call the other methods defined by the component. This avoids unnecessary API calls.
Unexpected faulty behaviours are called exceptions. All errors and exceptions are handled by a class called ZCException defined by our Java SDK. We have ZCServerException and ZCClientException classes to catch the specific exceptions thrown by the client and server codes.