1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package info.magnolia.jcr.wrapper;
35
36 import java.io.IOException;
37 import java.io.InputStream;
38
39 import javax.jcr.AccessDeniedException;
40 import javax.jcr.InvalidItemStateException;
41 import javax.jcr.InvalidSerializedDataException;
42 import javax.jcr.ItemExistsException;
43 import javax.jcr.NamespaceRegistry;
44 import javax.jcr.NoSuchWorkspaceException;
45 import javax.jcr.PathNotFoundException;
46 import javax.jcr.RepositoryException;
47 import javax.jcr.Session;
48 import javax.jcr.UnsupportedRepositoryOperationException;
49 import javax.jcr.Workspace;
50 import javax.jcr.lock.LockException;
51 import javax.jcr.lock.LockManager;
52 import javax.jcr.nodetype.ConstraintViolationException;
53 import javax.jcr.nodetype.NodeTypeManager;
54 import javax.jcr.observation.ObservationManager;
55 import javax.jcr.query.QueryManager;
56 import javax.jcr.version.Version;
57 import javax.jcr.version.VersionException;
58 import javax.jcr.version.VersionManager;
59
60 import org.xml.sax.ContentHandler;
61
62
63
64
65 public abstract class DelegateWorkspaceWrapper implements Workspace {
66
67 protected Workspace wrapped;
68
69 protected DelegateWorkspaceWrapper(Workspace workspace) {
70 this.wrapped = workspace;
71 }
72
73 public Workspace getWrappedWorkspace() {
74 return wrapped;
75 }
76
77 public void setWrappedWorkspace(Workspace workspace) {
78 this.wrapped = workspace;
79 }
80
81 @Override
82 public String toString() {
83 return wrapped != null ? wrapped.toString() : "";
84 }
85
86
87
88
89
90
91
92 @Override
93 public Session getSession() {
94 return getWrappedWorkspace().getSession();
95 }
96
97 @Override
98 public String getName() {
99 return getWrappedWorkspace().getName();
100 }
101
102 @Override
103 public void copy(String srcAbsPath, String destAbsPath) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
104 getWrappedWorkspace().copy(srcAbsPath, destAbsPath);
105 }
106
107 @Override
108 public void copy(String srcWorkspace, String srcAbsPath, String destAbsPath) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
109 getWrappedWorkspace().copy(srcWorkspace, srcAbsPath, destAbsPath);
110 }
111
112 @Override
113 public void clone(String srcWorkspace, String srcAbsPath, String destAbsPath, boolean removeExisting) throws NoSuchWorkspaceException, ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
114 getWrappedWorkspace().clone(srcWorkspace, srcAbsPath, destAbsPath, removeExisting);
115 }
116
117 @Override
118 public void move(String srcAbsPath, String destAbsPath) throws ConstraintViolationException, VersionException, AccessDeniedException, PathNotFoundException, ItemExistsException, LockException, RepositoryException {
119 getWrappedWorkspace().move(srcAbsPath, destAbsPath);
120 }
121
122 @Override
123 public void restore(Version[] versions, boolean removeExisting) throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException, RepositoryException {
124 getWrappedWorkspace().restore(versions, removeExisting);
125 }
126
127 @Override
128 public LockManager getLockManager() throws UnsupportedRepositoryOperationException, RepositoryException {
129 return getWrappedWorkspace().getLockManager();
130 }
131
132 @Override
133 public QueryManager getQueryManager() throws RepositoryException {
134 return getWrappedWorkspace().getQueryManager();
135 }
136
137 @Override
138 public NamespaceRegistry getNamespaceRegistry() throws RepositoryException {
139 return getWrappedWorkspace().getNamespaceRegistry();
140 }
141
142 @Override
143 public NodeTypeManager getNodeTypeManager() throws RepositoryException {
144 return getWrappedWorkspace().getNodeTypeManager();
145 }
146
147 @Override
148 public ObservationManager getObservationManager() throws UnsupportedRepositoryOperationException, RepositoryException {
149 return getWrappedWorkspace().getObservationManager();
150 }
151
152 @Override
153 public VersionManager getVersionManager() throws UnsupportedRepositoryOperationException, RepositoryException {
154 return getWrappedWorkspace().getVersionManager();
155 }
156
157 @Override
158 public String[] getAccessibleWorkspaceNames() throws RepositoryException {
159 return getWrappedWorkspace().getAccessibleWorkspaceNames();
160 }
161
162 @Override
163 public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws PathNotFoundException, ConstraintViolationException, VersionException, LockException, AccessDeniedException, RepositoryException {
164 return getWrappedWorkspace().getImportContentHandler(parentAbsPath, uuidBehavior);
165 }
166
167 @Override
168 public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, VersionException, PathNotFoundException, ItemExistsException, ConstraintViolationException, InvalidSerializedDataException, LockException, AccessDeniedException, RepositoryException {
169 getWrappedWorkspace().importXML(parentAbsPath, in, uuidBehavior);
170 }
171
172 @Override
173 public void createWorkspace(String name) throws AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException {
174 getWrappedWorkspace().createWorkspace(name);
175 }
176
177 @Override
178 public void createWorkspace(String name, String srcWorkspace) throws AccessDeniedException, UnsupportedRepositoryOperationException, NoSuchWorkspaceException, RepositoryException {
179 getWrappedWorkspace().createWorkspace(name, srcWorkspace);
180 }
181
182 @Override
183 public void deleteWorkspace(String name) throws AccessDeniedException, UnsupportedRepositoryOperationException, NoSuchWorkspaceException, RepositoryException {
184 getWrappedWorkspace().deleteWorkspace(name);
185 }
186
187 }