This project has retired. For details please refer to its Attic page.
DiscoveryService xref

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.chemistry.opencmis.server.impl.webservices;
20  
21  import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
22  import static org.apache.chemistry.opencmis.commons.impl.Converter.convertHolder;
23  import static org.apache.chemistry.opencmis.commons.impl.Converter.setHolderValue;
24  
25  import java.math.BigInteger;
26  
27  import javax.annotation.Resource;
28  import javax.jws.WebService;
29  import javax.xml.ws.Holder;
30  import javax.xml.ws.WebServiceContext;
31  import javax.xml.ws.soap.MTOM;
32  
33  import org.apache.chemistry.opencmis.commons.data.ObjectList;
34  import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
35  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
36  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisExtensionType;
37  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectListType;
38  import org.apache.chemistry.opencmis.commons.impl.jaxb.DiscoveryServicePort;
39  import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
40  import org.apache.chemistry.opencmis.commons.server.CmisService;
41  
42  /**
43   * CMIS Discovery Service.
44   */
45  @MTOM
46  @WebService(endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.DiscoveryServicePort")
47  public class DiscoveryService extends AbstractService implements DiscoveryServicePort {
48      @Resource
49      public WebServiceContext wsContext;
50  
51      public void getContentChanges(String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
52              String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems,
53              CmisExtensionType extension, Holder<CmisObjectListType> objects) throws CmisException {
54          CmisService service = null;
55          try {
56              service = getService(wsContext, repositoryId);
57  
58              org.apache.chemistry.opencmis.commons.spi.Holder<String> changeLogTokenHolder = convertHolder(changeLogToken);
59  
60              ObjectList changesList = service.getContentChanges(repositoryId, changeLogTokenHolder, includeProperties,
61                      filter, includePolicyIds, includeAcl, maxItems, convert(extension));
62  
63              if (objects != null) {
64                  objects.value = convert(changesList);
65              }
66  
67              setHolderValue(changeLogTokenHolder, changeLogToken);
68          } catch (Exception e) {
69              throw convertException(e);
70          } finally {
71              closeService(service);
72          }
73      }
74  
75      public CmisObjectListType query(String repositoryId, String statement, Boolean searchAllVersions,
76              Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships, String renditionFilter,
77              BigInteger maxItems, BigInteger skipCount, CmisExtensionType extension) throws CmisException {
78          CmisService service = null;
79          try {
80              service = getService(wsContext, repositoryId);
81  
82              return convert(service.query(repositoryId, statement, searchAllVersions, includeAllowableActions,
83                      convert(IncludeRelationships.class, includeRelationships), renditionFilter, maxItems, skipCount,
84                      convert(extension)));
85          } catch (Exception e) {
86              throw convertException(e);
87          } finally {
88              closeService(service);
89          }
90      }
91  }