001/*
002 * (C) Copyright 2006-2008 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Alexandre Russel
018 *
019 * $Id$
020 */
021
022package org.nuxeo.ecm.platform.annotations.service;
023
024import java.util.ArrayList;
025import java.util.List;
026
027import org.nuxeo.ecm.platform.annotations.api.AnnotationsConstants;
028import org.nuxeo.ecm.platform.annotations.api.UriResolver;
029import org.nuxeo.ecm.platform.annotations.descriptors.PermissionMapperDescriptor;
030
031/**
032 * @author Alexandre Russel
033 */
034public class AnnotationConfigurationServiceImpl implements AnnotationConfigurationService {
035
036    private final List<EventListener> listeners = new ArrayList<EventListener>();
037
038    private UriResolver resolver;
039
040    private URLPatternFilter filter;
041
042    private MetadataMapper mapper;
043
044    private PermissionManager permissionManager;
045
046    private AnnotabilityManager annotabilityManager;
047
048    private AnnotationIDGenerator idGenerator;
049
050    private String baseUrl = AnnotationsConstants.annotationBaseUrl;
051
052    private PermissionMapperDescriptor permissionMapper;
053
054    public UriResolver getUriResolver() {
055        return resolver;
056    }
057
058    public void setUriResolver(UriResolver resolver) {
059        this.resolver = resolver;
060    }
061
062    public URLPatternFilter getUrlPatternFilter() {
063        return filter;
064    }
065
066    public void setFilter(URLPatternFilter filter) {
067        this.filter = filter;
068    }
069
070    public MetadataMapper getMetadataMapper() {
071        return mapper;
072    }
073
074    public void setMetadataMapper(MetadataMapper mapper) {
075        this.mapper = mapper;
076    }
077
078    public PermissionManager getPermissionManager() {
079        return permissionManager;
080    }
081
082    public void setPermissionManager(PermissionManager permissionManager) {
083        this.permissionManager = permissionManager;
084    }
085
086    public AnnotabilityManager getAnnotabilityManager() {
087        return annotabilityManager;
088    }
089
090    public void setAnnotabilityManager(AnnotabilityManager annotabilityManager) {
091        this.annotabilityManager = annotabilityManager;
092    }
093
094    public AnnotationIDGenerator getIDGenerator() {
095        return idGenerator;
096    }
097
098    public void setIDGenerator(AnnotationIDGenerator idGenerator) {
099        this.idGenerator = idGenerator;
100    }
101
102    public String getBaseUrl() {
103        return baseUrl;
104    }
105
106    public void setBaseUrl(String baseUrl) {
107        this.baseUrl = baseUrl;
108    }
109
110    public PermissionMapperDescriptor getPermissionMapper() {
111        return permissionMapper;
112    }
113
114    public void setPermissionMapper(PermissionMapperDescriptor permissionMapper) {
115        this.permissionMapper = permissionMapper;
116    }
117
118    public List<EventListener> getListeners() {
119        return listeners;
120    }
121
122    public void addListener(EventListener listener) {
123        listeners.add(listener);
124    }
125
126    public String getCreateAnnotationPermission() {
127        return permissionMapper.getCreateAnnotationValue();
128    }
129
130    public String getDeleteAnnotationPermission() {
131        return permissionMapper.getDeleteAnnotationValue();
132    }
133
134    public String getReadAnnotationPermission() {
135        return permissionMapper.getReadAnnotationValue();
136    }
137
138    public String getUpdateAnnotationPermission() {
139        return permissionMapper.getUpdateAnnotationValue();
140    }
141
142}