This project has retired. For details please refer to its
Attic page.
ServiceDocument xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.chemistry.opencmis.server.impl.atompub;
20
21 import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
22
23 import javax.xml.bind.JAXBException;
24 import javax.xml.stream.XMLStreamException;
25 import javax.xml.stream.XMLStreamWriter;
26
27 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
28 import org.apache.chemistry.opencmis.commons.impl.Constants;
29 import org.apache.chemistry.opencmis.commons.impl.JaxBHelper;
30 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisRepositoryInfoType;
31
32
33
34
35
36
37
38 public class ServiceDocument extends AtomDocumentBase {
39
40 public ServiceDocument() {
41 }
42
43 public void startServiceDocument() throws XMLStreamException {
44 XMLStreamWriter xsw = getWriter();
45 xsw.writeStartElement(Constants.NAMESPACE_APP, "service");
46 writeNamespace(Constants.NAMESPACE_APP);
47 writeNamespace(Constants.NAMESPACE_ATOM);
48 writeNamespace(Constants.NAMESPACE_CMIS);
49 writeNamespace(Constants.NAMESPACE_RESTATOM);
50 }
51
52 public void endServiceDocument() throws XMLStreamException {
53 getWriter().writeEndElement();
54 }
55
56 public void startWorkspace(String title) throws XMLStreamException {
57 getWriter().writeStartElement(Constants.NAMESPACE_APP, "workspace");
58 writeSimpleTag(Constants.NAMESPACE_ATOM, "title", title);
59 }
60
61 public void endWorkspace() throws XMLStreamException {
62 getWriter().writeEndElement();
63 }
64
65 public void writeRepositoryInfo(RepositoryInfo repInfo) throws JAXBException {
66 CmisRepositoryInfoType repInfoJaxb = convert(repInfo);
67 if (repInfoJaxb == null) {
68 return;
69 }
70
71 JaxBHelper.marshal(JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createRepositoryInfo(repInfoJaxb), getWriter(), true);
72 }
73
74 public void writeUriTemplate(String template, String type, String mediatype) throws XMLStreamException {
75 XMLStreamWriter xsw = getWriter();
76
77 xsw.writeStartElement(Constants.NAMESPACE_RESTATOM, "uritemplate");
78 writeSimpleTag(Constants.NAMESPACE_RESTATOM, "template", template);
79 writeSimpleTag(Constants.NAMESPACE_RESTATOM, "type", type);
80 writeSimpleTag(Constants.NAMESPACE_RESTATOM, "mediatype", mediatype);
81 xsw.writeEndElement();
82 }
83 }