01: /*
02: * Copyright 2004 Outerthought bvba and Schaubroeck nv
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.outerj.daisy.repository.commonimpl.namespace;
17:
18: import org.outerj.daisy.repository.namespace.Namespace;
19: import org.outerj.daisy.repository.RepositoryException;
20: import org.outerj.daisy.repository.RepositoryListener;
21: import org.outerj.daisy.repository.commonimpl.RepositoryStrategy;
22: import org.outerj.daisy.repository.commonimpl.AuthenticatedUser;
23: import org.outerj.daisy.repository.namespace.NamespaceNotFoundException;
24:
25: public class CommonNamespaceManager {
26: private NamespaceCache namespaceCache;
27: private RepositoryStrategy repositoryStrategy;
28:
29: public CommonNamespaceManager(NamespaceCache namespaceCache,
30: RepositoryStrategy repositoryStrategy) {
31: this .namespaceCache = namespaceCache;
32: this .repositoryStrategy = repositoryStrategy;
33: }
34:
35: public RepositoryListener getCacheListener() {
36: return namespaceCache;
37: }
38:
39: public String getRepositoryNamespace() {
40: return namespaceCache.getRepositoryNamespace();
41: }
42:
43: public Namespace registerNamespace(String namespaceName,
44: AuthenticatedUser user) throws RepositoryException {
45: return repositoryStrategy
46: .registerNamespace(namespaceName, user);
47: }
48:
49: public Namespace registerNamespace(String namespaceName,
50: String fingerprint, AuthenticatedUser user)
51: throws RepositoryException {
52: return repositoryStrategy.registerNamespace(namespaceName,
53: fingerprint, user);
54: }
55:
56: public Namespace unregisterNamespace(String namespaceName,
57: AuthenticatedUser user) throws RepositoryException {
58: return repositoryStrategy.unregisterNamespace(namespaceName,
59: user);
60: }
61:
62: public Namespace unregisterNamespace(long id, AuthenticatedUser user)
63: throws RepositoryException {
64: return repositoryStrategy.unregisterNamespace(id, user);
65: }
66:
67: public Namespace[] getAllNamespaces(AuthenticatedUser user)
68: throws RepositoryException {
69: return repositoryStrategy.getAllNamespaces(user);
70: }
71:
72: public Namespace getNamespace(String name)
73: throws NamespaceNotFoundException {
74: return namespaceCache.getNamespace(name);
75: }
76:
77: public Namespace getNamespace(long id)
78: throws NamespaceNotFoundException {
79: return namespaceCache.getNamespace(id);
80: }
81: }
|