This project has retired. For details please refer to its
Attic page.
DummyServicesFactory xref
1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing,13 * software distributed under the License is distributed on an14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15 * KIND, either express or implied. See the License for the16 * specific language governing permissions and limitations17 * under the License.18 */19package org.apache.chemistry.opencmis.server.impl.dummy;
2021import java.util.Map;
2223import org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory;
24import org.apache.chemistry.opencmis.commons.server.CallContext;
25import org.apache.chemistry.opencmis.commons.server.CmisService;
26import org.apache.commons.logging.Log;
27import org.apache.commons.logging.LogFactory;
2829/**30 * Implementation of a repository factory without back-end for test purposes.31 */32publicclassDummyServicesFactoryextends AbstractServiceFactory {
3334privatestaticfinal String REPOSITORY_ID = "repository.id";
35privatestaticfinal String REPOSITORY_ID_DEFAULT = "test-rep";
3637privatestaticfinal String REPOSITORY_NAME = "repository.name";
38privatestaticfinal String REPOSITORY_NAME_DEFAULT = "Test Repository";
3940privatestaticfinal Log LOG = LogFactory.getLog(DummyServicesFactory.class.getName());
4142privateDummyService service;
43private String id;
44private String name;
4546 @Override
47publicvoid init(Map<String, String> parameters) {
48// get the id49 id = parameters.get(REPOSITORY_ID);
50if ((id == null) || (id.trim().length() == 0)) {
51 id = REPOSITORY_ID_DEFAULT;
52 }
5354// get the name55 name = parameters.get(REPOSITORY_NAME);
56if ((name == null) || (name.trim().length() == 0)) {
57 name = REPOSITORY_NAME_DEFAULT;
58 }
5960// create a repository service61 service = newDummyService(id, name);
6263 LOG.info("Initialized dummy repository '" + name + "' (" + id + ")");
64 }
6566 @Override
67publicvoid destroy() {
68 LOG.info("Destroyed dummy repository '" + name + "' (" + id + ")");
69 }
7071 @Override
72public CmisService getService(CallContext context) {
73return service;
74 }
75 }