Chapter 10. Extending jPetStore
The previous chapter introduced the workhorse Simple Spider service
with its console-based user interface and web service endpoint. In
this chapter, we see how easy it is to add the Spider to an existing
application, jPetStore. Some might argue the
jPetStore already has a search tool; but that tool
only searches the database of animals in the pet store, not all the
pages on the site. Our customer needs to search the entire site;
jPetStore has at least one page in the current
version that isn't searchable at all (the Help page)
and text describing the different animals that
doesn't show up in a query.
We'll add the Spider to the
jPetStore, paying careful attention to what we
need to change in the code in order to enable the integration. In
addition, we will replace the existing persistence layer with
Hibernate. By carefully adhering to our core principles, our code
will be reusable, and since the jPetStore is based
on a lightweight framework (Spring), it doesn't make
unreasonable demands on our code in order to incorporate the search
capability or the new persistence layer. Coming and going, the
inclusion will be simple and almost completely transparent.
|