]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
3f05d6a74205cdd7a32242b221284ca5c35533a6
[tmp/jakarta-migration.git] /
1
2 package org.collectionspace.hello.client;
3
4 import javax.ws.rs.core.Response;
5
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     */
22    private static final PersonClient instance = new PersonClient();
23
24    /**
25     * 
26     */
27    private PersonProxy personProxy;
28
29    /**
30     * 
31     * Create a new PersonClient.
32     *
33     */
34    private PersonClient()
35    {
36       ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
37       RegisterBuiltin.register(factory);
38       personProxy = ProxyFactory.create(PersonProxy.class, "http://localhost:8080/helloworld/cspace");
39    }
40    
41    /**
42     * FIXME Comment this
43     * 
44     * @return
45     */
46    public static PersonClient getInstance()
47    {
48       return instance;
49    }
50
51
52
53    /**
54     * @param id
55     * @return
56     * @see org.collectionspace.hello.client.PersonProxy#getPerson(java.lang.Long)
57     */
58        public ClientResponse<Person> getPerson(Long id)
59    {
60       return personProxy.getPerson(id);
61    }
62
63    /**
64     * @param person
65     * @return
66     * @see org.collectionspace.hello.client.PersonProxy#createPerson(org.collectionspace.hello.client.entity.Person)
67     */
68    public ClientResponse<Response> createPerson(Person person)
69    {
70       return personProxy.createPerson(person);
71    }
72
73
74    /**
75     * @param id
76     * @param person
77     * @return
78     * @see org.collectionspace.hello.client.PersonProxy#updatePerson(java.lang.Long, org.collectionspace.hello.client.entity.Person)
79     */
80    public ClientResponse<Person> updatePerson(Long id, Person person)
81    {
82       return personProxy.updatePerson(id, person);
83    }
84
85    
86 }