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.NamespaceManager;
19: import org.outerj.daisy.repository.RepositoryException;
20: import org.outerj.daisy.repository.commonimpl.AuthenticatedUser;
21: import org.outerj.daisy.repository.namespace.Namespace;
22: import org.outerj.daisy.repository.namespace.Namespaces;
23: import org.outerj.daisy.repository.namespace.NamespaceNotFoundException;
24:
25: public class NamespaceManagerImpl implements NamespaceManager {
26: private CommonNamespaceManager commonNamespaceManager;
27: private AuthenticatedUser user;
28:
29: public NamespaceManagerImpl(
30: CommonNamespaceManager commonNamespaceManager,
31: AuthenticatedUser user) {
32: this .commonNamespaceManager = commonNamespaceManager;
33: this .user = user;
34: }
35:
36: public String getRepositoryNamespace() {
37: return commonNamespaceManager.getRepositoryNamespace();
38: }
39:
40: public Namespace registerNamespace(String namespaceName)
41: throws RepositoryException {
42: return commonNamespaceManager.registerNamespace(namespaceName,
43: user);
44: }
45:
46: public Namespace registerNamespace(String namespaceName,
47: String fingerprint) throws RepositoryException {
48: return commonNamespaceManager.registerNamespace(namespaceName,
49: fingerprint, user);
50: }
51:
52: public Namespace unregisterNamespace(String namespaceName)
53: throws RepositoryException {
54: return commonNamespaceManager.unregisterNamespace(
55: namespaceName, user);
56: }
57:
58: public Namespace unregisterNamespace(long id)
59: throws RepositoryException {
60: return commonNamespaceManager.unregisterNamespace(id, user);
61: }
62:
63: public Namespace getNamespace(String name)
64: throws NamespaceNotFoundException {
65: if (name == null)
66: throw new IllegalArgumentException("Null argument: name");
67: return commonNamespaceManager.getNamespace(name);
68: }
69:
70: public Namespace getNamespace(long id)
71: throws NamespaceNotFoundException {
72: return commonNamespaceManager.getNamespace(id);
73: }
74:
75: public Namespaces getAllNamespaces() throws RepositoryException {
76: return new NamespacesImpl(commonNamespaceManager
77: .getAllNamespaces(user), commonNamespaceManager
78: .getRepositoryNamespace());
79: }
80: }
|