[LIB-5] Site sources of snooker-score-api
[snooker-score-api.git] / src / site / apt / usage.apt.vm
1  ------
2  Usage
3  ------
4  Dmitry Samoshin aka gotty
5  ------
6  2017-01-22
7  ------
8
9 ~~ Copyright (c) 2017. Developed by Hedgecode.
10 ~~
11 ~~ Licensed under the Apache License, Version 2.0 (the "License");
12 ~~ you may not use this file except in compliance with the License.
13 ~~ You may obtain a copy of the License at
14 ~~
15 ~~   http://www.apache.org/licenses/LICENSE-2.0
16 ~~
17 ~~ Unless required by applicable law or agreed to in writing, software
18 ~~ distributed under the License is distributed on an "AS IS" BASIS,
19 ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 ~~ See the License for the specific language governing permissions and
21 ~~ limitations under the License.
22
23 ~~ NOTE: For help with the syntax of this file, see:
24 ~~ http://maven.apache.org/doxia/references/apt-format.html
25
26 Usage
27
28 * Add the library for use in Java applications
29
30   The template for adding this library for developing Java applications
31   using the pom.xml configuration maven file is described below:
32
33 +-----
34 <project>
35     ...
36     <dependencies>
37         <dependency>
38             <groupId>${project.groupId}</groupId>
39             <artifactId>${project.artifactId}</artifactId>
40             <version>${project.version}</version>
41         </dependency>
42     </dependencies>
43     ...
44 </project>
45 +-----
46
47   <<Note>>: Maven 3.0 will issue warnings if you do not specify the version of a plugin.
48
49 * Work with the Java code of the library
50
51   After adding the library to the project you can start working with its code.\
52   To get an instance of the main library interface you need to add the following code:
53
54 +-----
55 SnookerScoreAPI api = Snooker.API();
56 +-----
57
58   <<<SnookerScoreAPI>>> is an interface with a set of all main methods that allow to access information 
59   about the seasons, tournaments, matches, players and their ratings through entity objects.
60
61   The library provides two implementations of the main interface:
62   with caching data for players and events (tournaments) inside and without caching.
63   Implementation of the interface with caching is "by default".\
64   Access to each of the two implementations of the interface can be obtained by the following method calls:
65
66 +-----
67 SnookerScoreAPI cachedApi = Snooker.cachedAPI(); /* API with cache */
68 ...
69 SnookerScoreAPI uncachedApi = Snooker.uncachedAPI(); /* API without cache */
70 +-----
71
72   Further work with the library is a sequence of calls to <<<SnookerScoreAPI>>> interface methods
73   to obtain lists of tournaments, players, current matches and other statistical information.\
74   For example, to get information on the matches currently underway, 
75   it is enough to execute the following code:
76
77 +-----
78 SnookerScoreAPI api = Snooker.API();
79 OngoingMatches matches = api.getOngoingMatches();
80 +-----
81
82   Description of most interface methods can be found in the section {{{./faq.html}FAQ}},
83   and the most often encountered situations are considered on the pages with examples.
84   Signature of methods as well as information on other entities of the library is presented in
85   {{{./apidocs/}JavaDoc}}.
86
87 * Run the library from the command line
88
89   You can run this library from the command line to check the correctness of the connection 
90   to the information portal {{{http://snooker.org/}snooker.org}}.
91   Starting the library from the command line is as follows:
92
93 +-----
94 java -jar ${project.artifactId}-${project.version}.jar
95 +-----
96
97   If the launch is working correctly, you can see a list of current and upcoming snooker tournaments.\
98   The sample output of the launching the library is shown below:
99
100 +-----
101 ********************************************************************************
102                     Welcome to Hedgecode Snooker Score API!
103                 -----------------------------------------------
104          It is an API library for portal snooker.org, which contains
105       the results of snooker competitions and other snooker information.
106     This library provides a set of entity objects that can be used in client
107     applications (to inform about the results of snooker), developed in Java.
108 ********************************************************************************
109   Current Snooker Events:
110      China Open Qualifiers [24.01.2017 - 27.01.2017] (England, Preston)
111 ********************************************************************************
112   Upcoming Snooker Events:
113      German Masters [01.02.2017 - 05.02.2017] (Germany, Berlin)
114      World Grand Prix [06.02.2017 - 12.02.2017] (England, Preston)
115      Welsh Open [13.02.2017 - 19.02.2017] (Wales, Cardiff)
116      Connie Gough Memorial Trophy [18.02.2017 - 18.02.2017] (England, Dunstable)
117      Championship League - Group 5 [20.02.2017 - 21.02.2017] (England, Coventry)
118 ********************************************************************************
119 +-----