2 * (C) Copyright 2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the GNU Lesser General Public License
6 * (LGPL) version 2.1 which accompanies this distribution, and is available at
7 * http://www.gnu.org/licenses/lgpl.html
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
15 * Nuxeo - initial API and implementation
20 package org.collectionspace.ecm.platform.quote.service;
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24 import org.nuxeo.runtime.model.ComponentInstance;
25 import org.nuxeo.runtime.model.DefaultComponent;
27 import org.collectionspace.ecm.platform.quote.api.QuoteManager;
28 import org.collectionspace.ecm.platform.quote.impl.QuoteManagerImpl;
31 * @author <a href="mailto:glefter@nuxeo.com">George Lefter</a>
34 public class QuoteService extends DefaultComponent {
36 public static final String ID = "org.collectionspace.ecm.platform.quote.service.QuoteService";
38 public static final String VERSIONING_EXTENSION_POINT_RULES = "rules";
40 private static final Log log = LogFactory.getLog(QuoteService.class);
42 private QuoteManager quoteManager;
44 private QuoteServiceConfig config;
47 public void registerContribution(Object contribution,
48 String extensionPoint, ComponentInstance contributor) {
49 if ("config".equals(extensionPoint)) {
50 config = (QuoteServiceConfig) contribution;
51 log.debug("registered service config: " + config);
53 log.warn("unknown extension point: " + extensionPoint);
58 public void unregisterContribution(Object contribution,
59 String extensionPoint, ComponentInstance contributor) {
63 public QuoteManager getQuoteManager() {
64 log.debug("getQuoteManager");
65 if (quoteManager == null) {
66 quoteManager = new QuoteManagerImpl(config);
71 public QuoteServiceConfig getConfig() {
76 public <T> T getAdapter(Class<T> adapter) {
77 if (adapter == QuoteManager.class) {
78 return adapter.cast(getQuoteManager());