Imagine you want to start a new Java-based project: you have plenty of frameworks to choose and to integrate before start focusing on the business logic, when it should be exactly the opposite. Then you loose a lot of time creating the project structure, thinking about infrastructure, handling compatibility issues, building, reporting and everything else, when actually you should think about what the client really wants and deliver a solution quickly!
Today most of the solutions we developers provide are pretty much the same in terms of technical choices, so why start from ground zero every time? We should maximize the reuse of components, so the GFI Foundation Platform aims to do the hard work for you and help you to deliver a reliable and scalable solution to end user without headaches.
Take a look at the following Spring configuration:
<core:service id="securityService"
interface="fr.gfi.admc.service.SecurityService"
target="fr.gfi.admc.service.SecurityServiceImpl" />
That's all you need to do in order to declare a business service. In the backwards you're service is just a POJO which inherits from fr.gfi.foundation.core.service.AbstractDatabaseService. If you want it to be transactional, it's just a matter of extending from fr.gfi.foundation.core.service.TransactionalService and declaring the Spring XML below:
<core:transaction id="admcTransaction"
entityManagerFactoryRef="admcEntityManager" />
Of course if you need a transactional service it means you need a database layer set. This is easily done by mixing Spring configuration to Entity Manager:
<core:entityManager id="admcEntityManager"
dataSourceRef="admcDataSource"
dialect="${entityManager.dialect}"
hbm2ddl="${entityManager.hbm2ddl}"
showSql="${entityManager.showSql}" />
Therefore the data source would be simply declared like this:
<core:dataSource id="admcDataSource"
driverClassName="${dataSource.driverClassName}"
url="${dataSource.url}"
username="${dataSource.username}"
password="${dataSource.password}" />
At this point you might be asking yourself about all these placeholders. That's just a matter of externalizing them within regular properties files. For this purpose, just use the following XML:
<core:properties id="admcProperties">
<property name="locations">
<list>
<value>classpath:fr/gfi/admc/context/admc.properties</value>
</list>
</property>
</core:properties>
That's it, from now on you don't need to think about concrete classes for infrastructe components anymore. Instead you simply focus on what's really important: the business logic!