Remote Service Repository

Most enterprise applications work with external systems involving data exchange between them. There are two ways in which data exchange with external system can be implemented, depending on the API offered by them. Some provide plain text structured data (e.g. XML, JSON, or something similar). The user of plain text application interface is responsible for parsing and converting them to their own programmable representations. While some others go a bit further and provide an API, essentially taking away the need to parse the plain text form. Quite often, especially in case of API, the plain data objects get directly used without any behavior associated to them, leading to behavior around them spread in other parts of the application, leading to transaction scripts. The repository and domain model concepts can be applied to remote services and data retrieved from them.

Remote service repository (RSR) use the remote service proxies or act as them. In addition to this, these should interface with application service or domain service providing and accepting domain objects, instead of behavior-less objects. RSR construct the domain objects along with related objects. Modern object relational frameworks construct domain objects with their related domain objects and in most applications the database is the primary data source. This can lead to isolation of domain objects which are persisted in database, with no relation to domain objects retrieved via RSR. The domain modelling should be independent of its source. Following this, the example illustrates how it can be achieved. The important aspect of this example is that the repositories depend on each other. When using OR mapping tools like Hibernate one doesn't need to do this because it can be achieved via its mapping. These object to table mapping hide the fact that repositories are really dependent on each other.

Our micro finance application allows its users to take installment payments from its borrowers and make payment. If these borrowers have some bank account then these payment transaction can be made electronically. In order to make electronic payments it uses a payment gateway. This chosen payment gateway interface provides a Java API which our application can use.

make payment

mode of payment

payment mode details

amount

payment is a concept in both applications. in our app it means

useful to indicate somehow that it is a remote interaction

Configuration handling in trainlines on the client side