A functional type is a construct in Service Definer that allows you to name a service, class, structure or Java interface and then refer to it by name in a service, class or structure in order to re-use the corresponding implementation logic.
Functional types are grouped by type of service. For each functional type, you can specify the type of service where the functional type may be used.
USoft delivers a set of functional types by default.
You can add further your custom functional types by:
- creating your own service, class or structure in Service Definer.
- using a class or interface from the Java libraries delivered with USoft Service Framework.
- using a class or interface from an external Java library (not delivered by USoft).
Functional types delivered by USoft for REST services
This table lists functional types delivered by USoft as a factory default for REST services.
Name | Description |
---|---|
USoft Table Resource | Allows you to create a REST Service for basic browsing and manipulation of table data in your USoft application. |
USoft Job Resource | Allows you to create a REST Service for calling batch jobs defined in your USoft application |
USoft REST Default Provider | Allows you to create a REST Service that uses SQL statements for implementation logic. You can also use Java code in the service implementation, if necessary. When using this functional type you have access to utility functions for connecting to the Rules Engine. |
USoft Page Engine Resource | Allows you to create a service based on a Web Designer publication. At runtime, the USoft Page Engine runs inside the Service Framework.For introductory help, read the "Getting Started" sections of USoft Web Designer Help. |
USoft Generic Exception Handler | Allows you to customise errors generated by the Rules Engine and errors raised by the Service Framework.Allows you to send customised messages to the client.USoft delivers the AppExceptionMapper service as an example of how to customise errors. |
Functional types delivered by USoft for SOAP Services
This table lists functional types delivered by USoft as a factory default for SOAP services.
Name | Description |
---|---|
USoft SOAP Default Provider | Allows you to define a SOAP service that uses a SQL statement as its implementation logic. You can also use Java code in the service implementation, if necessary. When using this functional type you have access to utility functions for connecting to the Rules Engine. |
Functional types delivered by USoft for WebSocket services
This table lists functional types delivered by USoft as a factory default for WebSocket services.
Name | Description |
---|---|
USoft Default Web Socket Provider | Allows you to implement a service that uses the web socket communication protocol. When using this functional type you have access to utility functions for connecting to the Rules Engine. |
Functional types delivered by USoft for services (Other)
This table lists functional types delivered by USoft as a factory default for services (Other).
Name | Description |
---|---|
USoft Server Lifecycle Listener | Allows you to write Java code that is executed when the server starts and stops. Using this functional type, you can add different services that will start and stop when the server starts or stops. This way, Service Framework is extensible to any kind of service, such as Java Messaging Services (JMS) and Kafka streaming services. |
USoft Engine Task Provider | This is a generic functional type that allows you to useutility functions for connecting to the Rules Engine. It can be used in combination with the @QueueTask annotation to create a queue service. |
Custom functional types
You can define custom functional types in addition to the ones provided by USoft. A functional type is a name that you can specify for reusable code. It is based on the concept of inheritance in Java. The existing code may be:
- a class or structure that you have created in Service Definer.
- a class or interface from the Java libraries delivered with USoft Service Framework.
- a class or interface from an external Java library (not delivered by USoft).
Creating a custom functional type
1. Choose Define, Functional Types from the USoft Service Definer menu.
The Functional Types window appears.
2. Specify a name in the Functional Type field. This is the name that you can use in the Services/Classes window as Functional Type for a service/class.
3. Specify either a Super Class Name, a Base Class Name, or Implemented Interfaces Names.
Specify a Super Class Name (including a namespace) if the reusable code is a Java class, Service Framework class or structure, and each time you use it you want USoft Service Framework to create a new class that inherits from it.
Example
In this example, ReservationEvent is a structure defined in Service Definer that holds common fields for different message events available for a reservation in a travel agency event processing system. See the reservation event example
com.usoft.service.ReservationEvent
Specify a Base Class Name ( including a namespace ) if the reusable code is a Java class, Service Framework class or structure, and each time you use it you want USoft Service Framework to make a copy of the existing class and extend it.
Example
com.usoft.service.ReservationEvent
Specify Implemented Interfaces Names if the reusable code is a collection of Java interfaces and you want to inherit from them. Supply a semicolon-separated list of Java interfaces (including namespaces) here. See the log REST request example.
Example
javax.ws.rs.container.ContainerRequestFilter
4. Choose the Class Type where this Functional Type may be used.