| /////////////////////////////////////////////////////////////// |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| /////////////////////////////////////////////////////////////// |
| |
| [[tut-services-step1,Step 1 - Creating a ServiceComposite]] |
| = Step 1 - Creating a ServiceComposite = |
| |
| In this tutorial we start with basic Java classes, to simulate a very simple Library where you can borrow |
| and return books. |
| |
| Zestâ„¢ relies heavily on the use of interfaces. This makes it possible for an object |
| to externally implement a number of interfaces which internally is backed by a number |
| of Mixins, some of which you may have written yourself, and some of which may have been |
| reused. This is also true for services, which we are to cover in this tutorial. |
| |
| The first task is therefore to refactor the code so that the methods are implemented from an |
| interface instead, and to essentially make the identical "application" into a Zestâ„¢ application. |
| We also want the Book to be a ValueComposite. |
| |
| Steps for this tutorial: |
| |
| - Make the Book into a ValueComposite. |
| - Make the Library an interface with the same methods. We call this a MixinType. |
| - Create a LibraryMixin class, which implements the Library interface. |
| - Create a LibraryService that binds the LibraryMixin. |
| - The LibraryMixin will need to be injected with the ValueBuilderFactory in the @Structure scope. |
| |