content: /*
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
   * with the License.  You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing,
   * software distributed under the License is distributed on an
   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   * KIND, either express or implied.  See the License for the
   * specific language governing permissions and limitations
   * under the License.
   */
  package org.apache.chemistry.opencmis.server.impl.dummy;
  
  import java.math.BigInteger;
  import java.util.Collections;
  import java.util.List;
  
  import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
  import org.apache.chemistry.opencmis.commons.data.ObjectData;
  import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
  import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
  import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
  import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
  import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
  import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
  import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
  import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
  import org.apache.chemistry.opencmis.commons.impl.server.AbstractCmisService;
  
  /**
   * Simplest Repository Service implementation.
   */
  public class DummyService extends AbstractCmisService {
  
      private final RepositoryInfoImpl fRepInfo;
  
      public DummyService(String id, String name) {
          fRepInfo = new RepositoryInfoImpl();
  
          fRepInfo.setId(id);
          fRepInfo.setName(name);
          fRepInfo.setDescription(name);
          fRepInfo.setCmisVersionSupported("1.0");
          fRepInfo.setRootFolder("root");
  
          fRepInfo.setVendorName("OpenCMIS");
          fRepInfo.setProductName("OpenCMIS Server");
          fRepInfo.setProductVersion("1.0");
      }
  
      @Override
      public RepositoryInfo getRepositoryInfo(String repositoryId,
              ExtensionsData extension) {
          if (!fRepInfo.getId().equals(repositoryId)) {
              throw new CmisObjectNotFoundException(
                      "A repository with repository id '" + repositoryId
                              + "' does not exist!");
          }
  
          return fRepInfo;
      }
  
      @Override
      public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
          return Collections.singletonList((RepositoryInfo) fRepInfo);
      }
  
      @Override
      public ObjectInFolderList getChildren(String repositoryId, String folderId,
              String filter, String orderBy, Boolean includeAllowableActions,
              IncludeRelationships includeRelationships, String renditionFilter,
              Boolean includePathSegment, BigInteger maxItems,
              BigInteger skipCount, ExtensionsData extension) {
          throw new CmisNotSupportedException();
      }
  
      @Override
      public ObjectData getObject(String repositoryId, String objectId,
              String filter, Boolean includeAllowableActions,
              IncludeRelationships includeRelationships, String renditionFilter,
              Boolean includePolicyIds, Boolean includeAcl,
              ExtensionsData extension) {
          throw new CmisNotSupportedException();
      }
  
      @Override
      public List<ObjectParentData> getObjectParents(String repositoryId,
              String objectId, String filter, Boolean includeAllowableActions,
              IncludeRelationships includeRelationships, String renditionFilter,
              Boolean includeRelativePathSegment, ExtensionsData extension) {
          throw new CmisNotSupportedException();
      }
  
      @Override
      public TypeDefinitionList getTypeChildren(String repositoryId,
              String typeId, Boolean includePropertyDefinitions,
              BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
          throw new CmisNotSupportedException();
      }
  
      @Override
      public TypeDefinition getTypeDefinition(String repositoryId, String typeId,
              ExtensionsData extension) {
          throw new CmisNotSupportedException();
      }
  }
  