-
Notifications
You must be signed in to change notification settings - Fork 23
/
api_overview.html
46 lines (44 loc) · 3.36 KB
/
api_overview.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<body>
<! -- $HeadURL: http://pc2.ecs.csus.edu/repos/pc2v9/trunk/edu/csus/ecs/pc2/package.html $ -- >
This documentation describes the current <I>draft</i> of the PC<sup>2</sup> API, which is subject to change.
<p>
The <B>API</b> package provides the facilities necessary for user-written Client applications to directly access
a <A HREf="http://www.ecs.csus.edu/pc2"> PC<sup>2</sup></a> Server. The API would typically be used
by those wishing to write their own custom Clients; for example, specialized Team, Judge, or Scoreboard
modules. Utilizing the facilities of the API package, such user-written modules can gain access to a wide variety of
contest data for the contest being run by the targeted PC<sup>2</sup> Server.
<P>
<I><B>NOTE:</b> while anyone can <I>write</i> a custom client module to access a PC<sup>2</sup> Server,
the ability to actually <I>connect</i> such a module to a Server is enforced at the <I>Server</i> side.
In order for a Client to login to a Server and access its services, the Client must provide authentication
credentials in the form of a login account and password which has been created on the Server by the Contest
Administrator. In addition, access provided to such a logged-in client is limited to the privileges
granted by the Contest Administrator to that account.</i>
<P>
Using the facilities in the API package requires that a PC<sup>2</sup> Server already be running, and that
the custom Client making use of the API be provided with a <font face=courier> pc2v9.ini </font> file just as
with any other PC<sup>2</sup> client. The API package documentation assumes the reader is already familiar
with these concepts; see the separate PC<sup>2</sup> Contest Administrator's Guide for additional details.
<P>
Writing a custom Client using the PC<sup>2</sup> API involves three basic steps:
<ol>
<li> Creating a <i>server connection</i>
<li> Logging in to the server via the server connection by providing valid authentication credentials. Successfully
logging in to a server provides access to an object of type <code>IContest</code>, a representation of the
contest being controlled by the server.
<li> Invoking the various <code>IContest</code> methods to access server operations and obtain contest data.
</ol>
The following links provide access to examples of how each of these basic steps is performed.
Further examples can be found in the documentation for each of the API packages, classes, interfaces, and methods.
<P>
<h3>Quick Samples</h3>
<ul>
<li> <a href="edu/csus/ecs/pc2/api/ServerConnection.html#loginsample"> Connect and login to a PC<sup>2</sup> server</a> <br>
<li> <a href="edu/csus/ecs/pc2/api/IContest.html#getRunsSample"> Print data from all runs in the contest</a> <br>
<li> <a href="edu/csus/ecs/pc2/api/IContest.html#printTeamsSample"> Print the name, site, and group of each team in the contest</a> <br>
<li> <a href="edu/csus/ecs/pc2/api/IContest.html#printLanguagesSample"> Print the names of all the currently defined contest languages </a> <br>
<li> <a href="edu/csus/ecs/pc2/api/IContest.html#printProblemsSample"> Print the names of all the currently defined contest problems </a> <br>
<li> <a href="edu/csus/ecs/pc2/api/IContest.html#printJudgementsSample"> Print the names of all currently defined (allowable) judgements
(that is, judgements which a Judge may choose to assign to a given submitted run)</a> <br>
</ul>
</body>