]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
4078799a81036143860493d736610c5dea6673cc
[tmp/jakarta-migration.git] /
1 package org.collectionspace.hello.client;
2
3 import javax.ws.rs.core.Response;
4
5 import org.collectionspace.hello.Person;
6 import org.jboss.resteasy.client.ProxyFactory;
7 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
8 import org.jboss.resteasy.client.ClientResponse;
9 import org.jboss.resteasy.spi.ResteasyProviderFactory;
10
11 /**
12  * A PersonClient.
13
14  * @version $Revision:$
15  */
16 public class PersonClient {
17
18     /**
19      *
20      */
21     private static final PersonClient instance = new PersonClient();
22     /**
23      *
24      */
25     private PersonProxy personProxy;
26
27     /**
28      *
29      * Create a new PersonClient.
30      *
31      */
32     private PersonClient() {
33         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
34         RegisterBuiltin.register(factory);
35         personProxy = ProxyFactory.create(PersonProxy.class, "http://localhost:8080/helloworld/cspace");
36     }
37
38     /**
39      * FIXME Comment this
40      *
41      * @return
42      */
43     public static PersonClient getInstance() {
44         return instance;
45     }
46
47     /**
48      * @param id
49      * @return
50      * @see org.collectionspace.hello.client.PersonProxy#getPerson(java.lang.Long)
51      */
52     public ClientResponse<Person> getPerson(Long id) {
53         return personProxy.getPerson(id);
54     }
55
56     /**
57      * @param person
58      * @return
59      * @see org.collectionspace.hello.client.PersonProxy#createPerson(org.collectionspace.hello.client.entity.Person)
60      */
61     public ClientResponse<Response> createPerson(Person person) {
62         return personProxy.createPerson(person);
63     }
64
65     /**
66      * @param id
67      * @param person
68      * @return
69      * @see org.collectionspace.hello.client.PersonProxy#updatePerson(java.lang.Long, org.collectionspace.hello.client.entity.Person)
70      */
71     public ClientResponse<Person> updatePerson(Long id, Person person) {
72         return personProxy.updatePerson(id, person);
73     }
74 }