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

1   /*
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   *
20   */
21  package org.apache.chemistry.opencmis.client.bindings.spi.local;
22  
23  import java.math.BigInteger;
24  import java.util.List;
25  
26  import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
27  import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
28  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
29  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
30  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
31  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
32  import org.apache.chemistry.opencmis.commons.server.CmisService;
33  import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
34  import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
35  
36  /**
37   * Repository Service local client.
38   */
39  public class RepositoryServiceImpl extends AbstractLocalService implements RepositoryService {
40  
41      /**
42       * Constructor.
43       */
44      public RepositoryServiceImpl(BindingSession session, CmisServiceFactory factory) {
45          setSession(session);
46          setServiceFactory(factory);
47      }
48  
49      public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
50          CmisService service = getService(repositoryId);
51  
52          try {
53              return service.getRepositoryInfo(repositoryId, extension);
54          } finally {
55              service.close();
56          }
57      }
58  
59      public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
60          CmisService service = getService(null);
61  
62          try {
63              return service.getRepositoryInfos(extension);
64          } finally {
65              service.close();
66          }
67      }
68  
69      public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) {
70          CmisService service = getService(repositoryId);
71  
72          try {
73              return service.getTypeDefinition(repositoryId, typeId, extension);
74          } finally {
75              service.close();
76          }
77      }
78  
79      public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
80              BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
81          CmisService service = getService(repositoryId);
82  
83          try {
84              return service.getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems, skipCount,
85                      extension);
86          } finally {
87              service.close();
88          }
89      }
90  
91      public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth,
92              Boolean includePropertyDefinitions, ExtensionsData extension) {
93          CmisService service = getService(repositoryId);
94  
95          try {
96              return service.getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions, extension);
97          } finally {
98              service.close();
99          }
100     }
101 
102 }