You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2005/02/08 09:58:26 UTC
svn commit: r152652 -
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server
Author: stefan
Date: Tue Feb 8 00:58:19 2005
New Revision: 152652
URL: http://svn.apache.org/viewcvs?view=rev&rev=152652
Log:
Clean up exceptions thrown by a remote repository to avoid deserialization problems.
(applying patch supplied by jukka)
Modified:
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItem.java
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNamespaceRegistry.java
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerProperty.java
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRepository.java
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerSession.java
incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java
Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItem.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItem.java?view=diff&r1=152651&r2=152652
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItem.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerItem.java Tue Feb 8 00:58:19 2005
@@ -63,36 +63,60 @@
/** {@inheritDoc} */
public String getPath() throws RepositoryException, RemoteException {
- return item.getPath();
+ try {
+ return item.getPath();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public String getName() throws RepositoryException, RemoteException {
- return item.getName();
+ try {
+ return item.getName();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void save() throws AccessDeniedException, LockException,
ConstraintViolationException, InvalidItemStateException,
ReferentialIntegrityException, RepositoryException, RemoteException {
- item.save();
+ try {
+ item.save();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteItem getAncestor(int level) throws ItemNotFoundException,
AccessDeniedException, RepositoryException, RemoteException {
- return getRemoteItem(item.getAncestor(level));
+ try {
+ return getRemoteItem(item.getAncestor(level));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public int getDepth() throws RepositoryException, RemoteException {
- return item.getDepth();
+ try {
+ return item.getDepth();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNode getParent() throws ItemNotFoundException,
AccessDeniedException, RepositoryException, RemoteException {
- return factory.getRemoteNode(item.getParent());
+ try {
+ return factory.getRemoteNode(item.getParent());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -108,12 +132,20 @@
/** {@inheritDoc} */
public void refresh(boolean keepChanges) throws InvalidItemStateException,
RepositoryException, RemoteException {
- item.refresh(keepChanges);
+ try {
+ item.refresh(keepChanges);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void remove() throws RepositoryException, RemoteException {
- item.remove();
+ try {
+ item.remove();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
}
Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNamespaceRegistry.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNamespaceRegistry.java?view=diff&r1=152651&r2=152652
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNamespaceRegistry.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNamespaceRegistry.java Tue Feb 8 00:58:19 2005
@@ -58,35 +58,59 @@
/** {@inheritDoc} */
public void registerNamespace(String prefix, String uri)
throws NamespaceException, RepositoryException, RemoteException {
- registry.registerNamespace(prefix, uri);
+ try {
+ registry.registerNamespace(prefix, uri);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void unregisterNamespace(String prefix) throws NamespaceException,
RepositoryException, RemoteException {
- registry.unregisterNamespace(prefix);
+ try {
+ registry.unregisterNamespace(prefix);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public String[] getPrefixes() throws RepositoryException, RemoteException {
- return registry.getPrefixes();
+ try {
+ return registry.getPrefixes();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public String[] getURIs() throws RepositoryException, RemoteException {
- return registry.getURIs();
+ try {
+ return registry.getURIs();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public String getURI(String prefix) throws NamespaceException,
RepositoryException, RemoteException {
- return registry.getURI(prefix);
+ try {
+ return registry.getURI(prefix);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public String getPrefix(String uri) throws NamespaceException,
RepositoryException, RemoteException {
- return registry.getPrefix(uri);
+ try {
+ return registry.getPrefix(uri);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
}
Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java?view=diff&r1=152651&r2=152652
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java Tue Feb 8 00:58:19 2005
@@ -74,7 +74,11 @@
public RemoteNode addNode(String path) throws ItemExistsException,
PathNotFoundException, ConstraintViolationException,
RepositoryException, RemoteException {
- return factory.getRemoteNode(node.addNode(path));
+ try {
+ return factory.getRemoteNode(node.addNode(path));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -82,124 +86,208 @@
ItemExistsException, PathNotFoundException,
NoSuchNodeTypeException, ConstraintViolationException,
RepositoryException, RemoteException {
- return factory.getRemoteNode(node.addNode(path, type));
+ try {
+ return factory.getRemoteNode(node.addNode(path, type));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteProperty getProperty(String path) throws PathNotFoundException,
RepositoryException, RemoteException {
- return factory.getRemoteProperty(node.getProperty(path));
+ try {
+ return factory.getRemoteProperty(node.getProperty(path));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteProperty[] getProperties() throws RepositoryException,
RemoteException {
- return getRemotePropertyArray(node.getProperties());
+ try {
+ return getRemotePropertyArray(node.getProperties());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteItem getPrimaryItem() throws ItemNotFoundException,
RepositoryException, RemoteException {
- return getRemoteItem(node.getPrimaryItem());
+ try {
+ return getRemoteItem(node.getPrimaryItem());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteProperty[] getProperties(String pattern)
throws RepositoryException, RemoteException {
- return getRemotePropertyArray(node.getProperties(pattern));
+ try {
+ return getRemotePropertyArray(node.getProperties(pattern));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteProperty[] getReferences() throws RepositoryException,
RemoteException {
- return getRemotePropertyArray(node.getReferences());
+ try {
+ return getRemotePropertyArray(node.getReferences());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public String getUUID() throws UnsupportedRepositoryOperationException,
RepositoryException, RemoteException {
- return node.getUUID();
+ try {
+ return node.getUUID();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public boolean hasNodes() throws RepositoryException, RemoteException {
- return node.hasNodes();
+ try {
+ return node.hasNodes();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public boolean hasProperties() throws RepositoryException, RemoteException {
- return node.hasProperties();
+ try {
+ return node.hasProperties();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public boolean hasProperty(String path) throws RepositoryException,
RemoteException {
- return node.hasProperty(path);
+ try {
+ return node.hasProperty(path);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNodeType[] getMixinNodeTypes() throws RepositoryException,
RemoteException {
- return getRemoteNodeTypeArray(node.getMixinNodeTypes());
+ try {
+ return getRemoteNodeTypeArray(node.getMixinNodeTypes());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNodeType getPrimaryNodeType() throws RepositoryException,
RemoteException {
- return factory.getRemoteNodeType(node.getPrimaryNodeType());
+ try {
+ return factory.getRemoteNodeType(node.getPrimaryNodeType());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public boolean isNodeType(String type) throws RepositoryException,
RemoteException {
- return node.isNodeType(type);
+ try {
+ return node.isNodeType(type);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNode[] getNodes() throws RepositoryException, RemoteException {
- return getRemoteNodeArray(node.getNodes());
+ try {
+ return getRemoteNodeArray(node.getNodes());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNode[] getNodes(String pattern) throws RepositoryException,
RemoteException {
- return getRemoteNodeArray(node.getNodes(pattern));
+ try {
+ return getRemoteNodeArray(node.getNodes(pattern));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNode getNode(String path) throws PathNotFoundException,
RepositoryException, RemoteException {
- return factory.getRemoteNode(node.getNode(path));
+ try {
+ return factory.getRemoteNode(node.getNode(path));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public boolean hasNode(String path) throws RepositoryException,
RemoteException {
- return node.hasNode(path);
+ try {
+ return node.hasNode(path);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteProperty setProperty(String name, Value value)
throws ValueFormatException, RepositoryException, RemoteException {
- return factory.getRemoteProperty(node.setProperty(name, value));
+ try {
+ return factory.getRemoteProperty(node.setProperty(name, value));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void addMixin(String name) throws NoSuchNodeTypeException,
ConstraintViolationException, RepositoryException, RemoteException {
- node.addMixin(name);
+ try {
+ node.addMixin(name);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public boolean canAddMixin(String name) throws RepositoryException,
RemoteException {
- return node.canAddMixin(name);
+ try {
+ return node.canAddMixin(name);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void removeMixin(String name) throws NoSuchNodeTypeException,
ConstraintViolationException, RepositoryException, RemoteException {
- node.removeMixin(name);
+ try {
+ node.removeMixin(name);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -207,37 +295,61 @@
throws UnsupportedRepositoryOperationException,
ConstraintViolationException, ItemNotFoundException,
RepositoryException, RemoteException {
- node.orderBefore(src, dst);
+ try {
+ node.orderBefore(src, dst);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteProperty setProperty(String name, Value[] values)
throws ValueFormatException, RepositoryException, RemoteException {
- return factory.getRemoteProperty(node.setProperty(name, values));
+ try {
+ return factory.getRemoteProperty(node.setProperty(name, values));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNodeDef getDefinition() throws RepositoryException,
RemoteException {
- return factory.getRemoteNodeDef(node.getDefinition());
+ try {
+ return factory.getRemoteNodeDef(node.getDefinition());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void checkout() throws UnsupportedRepositoryOperationException,
RepositoryException, RemoteException {
- node.checkout();
+ try {
+ node.checkout();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public String getCorrespondingNodePath(String workspace)
throws ItemNotFoundException, NoSuchWorkspaceException,
AccessDeniedException, RepositoryException, RemoteException {
- return node.getCorrespondingNodePath(workspace);
+ try {
+ return node.getCorrespondingNodePath(workspace);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public int getIndex() throws RepositoryException, RemoteException {
- return node.getIndex();
+ try {
+ return node.getIndex();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -245,7 +357,11 @@
throws UnsupportedRepositoryOperationException,
NoSuchWorkspaceException, AccessDeniedException, MergeException,
RepositoryException, RemoteException {
- node.merge(workspace, bestEffort);
+ try {
+ node.merge(workspace, bestEffort);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -253,7 +369,11 @@
throws VersionException, ItemExistsException,
UnsupportedRepositoryOperationException, LockException,
InvalidItemStateException, RepositoryException, RemoteException {
- node.restore(version, removeExisting);
+ try {
+ node.restore(version, removeExisting);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -261,57 +381,93 @@
throws VersionException, ItemExistsException,
UnsupportedRepositoryOperationException, LockException,
InvalidItemStateException, RepositoryException, RemoteException {
- node.restoreByLabel(label, removeExisting);
+ try {
+ node.restoreByLabel(label, removeExisting);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void update(String workspace) throws NoSuchWorkspaceException,
AccessDeniedException, RepositoryException, RemoteException {
- node.update(workspace);
+ try {
+ node.update(workspace);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public boolean holdsLock() throws RepositoryException, RemoteException {
- return node.holdsLock();
+ try {
+ return node.holdsLock();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public boolean isCheckedOut() throws
UnsupportedRepositoryOperationException, RepositoryException,
RemoteException {
- return node.isCheckedOut();
+ try {
+ return node.isCheckedOut();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public boolean isLocked() throws RepositoryException, RemoteException {
- return node.isLocked();
+ try {
+ return node.isLocked();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteProperty setProperty(String name, Value[] values, int type)
throws ValueFormatException, VersionException, LockException,
RepositoryException, RemoteException {
- return factory.getRemoteProperty(node.setProperty(name, values, type));
+ try {
+ return factory.getRemoteProperty(node.setProperty(name, values, type));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void unlock() throws UnsupportedRepositoryOperationException,
LockException, AccessDeniedException, RepositoryException,
RemoteException {
- node.unlock();
+ try {
+ node.unlock();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteLock getLock() throws UnsupportedRepositoryOperationException,
LockException, AccessDeniedException, RepositoryException,
RemoteException {
- return factory.getRemoteLock(node.getLock());
+ try {
+ return factory.getRemoteLock(node.getLock());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteLock lock(boolean isDeep, boolean isSessionScoped)
throws UnsupportedRepositoryOperationException, LockException,
AccessDeniedException, RepositoryException, RemoteException {
- return factory.getRemoteLock(node.lock(isDeep, isSessionScoped));
+ try {
+ return factory.getRemoteLock(node.lock(isDeep, isSessionScoped));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
}
Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java?view=diff&r1=152651&r2=152652
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java Tue Feb 8 00:58:19 2005
@@ -60,25 +60,41 @@
/** {@inheritDoc} */
public RemoteNodeType getNodeType(String name) throws
NoSuchNodeTypeException, RepositoryException, RemoteException {
- return factory.getRemoteNodeType(manager.getNodeType(name));
+ try {
+ return factory.getRemoteNodeType(manager.getNodeType(name));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNodeType[] getAllNodeTypes() throws RepositoryException,
RemoteException {
- return getRemoteNodeTypeArray(manager.getAllNodeTypes());
+ try {
+ return getRemoteNodeTypeArray(manager.getAllNodeTypes());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNodeType[] getPrimaryNodeTypes() throws RepositoryException,
RemoteException {
- return getRemoteNodeTypeArray(manager.getPrimaryNodeTypes());
+ try {
+ return getRemoteNodeTypeArray(manager.getPrimaryNodeTypes());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNodeType[] getMixinNodeTypes() throws RepositoryException,
RemoteException {
- return getRemoteNodeTypeArray(manager.getMixinNodeTypes());
+ try {
+ return getRemoteNodeTypeArray(manager.getMixinNodeTypes());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
}
Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java?view=diff&r1=152651&r2=152652
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java Tue Feb 8 00:58:19 2005
@@ -19,15 +19,34 @@
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.InvalidSerializedDataException;
import javax.jcr.Item;
+import javax.jcr.ItemExistsException;
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.LoginException;
+import javax.jcr.MergeException;
+import javax.jcr.NamespaceException;
+import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
+import javax.jcr.ReferentialIntegrityException;
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.ValueFormatException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
import javax.jcr.nodetype.NodeDef;
import javax.jcr.nodetype.NodeType;
import javax.jcr.nodetype.NodeTypeIterator;
import javax.jcr.nodetype.PropertyDef;
+import javax.jcr.query.InvalidQueryException;
+import javax.jcr.version.VersionException;
import org.apache.jackrabbit.rmi.remote.RemoteItem;
import org.apache.jackrabbit.rmi.remote.RemoteNode;
@@ -57,6 +76,63 @@
protected ServerObject(RemoteAdapterFactory factory)
throws RemoteException {
this.factory = factory;
+ }
+
+ /**
+ * Returns a cleaned version of the given exception. In some cases
+ * the underlying repository implementation may throw exceptions
+ * that are either unserializable, use exception subclasses that are
+ * only locally available, contain references to unserializable or
+ * only locally available classes. This method returns a cleaned
+ * version of such an exception. The returned exception contains only
+ * the message string from the original exception, and uses the public
+ * JCR exception class that most specifically matches the original
+ * exception.
+ *
+ * @param ex the original exception
+ * @return clean exception
+ */
+ protected RepositoryException getRepositoryException(
+ RepositoryException ex) {
+ if (ex instanceof AccessDeniedException) {
+ return new AccessDeniedException(ex.getMessage());
+ } else if (ex instanceof ConstraintViolationException) {
+ return new ConstraintViolationException(ex.getMessage());
+ } else if (ex instanceof InvalidItemStateException) {
+ return new InvalidItemStateException(ex.getMessage());
+ } else if (ex instanceof InvalidQueryException) {
+ return new InvalidQueryException(ex.getMessage());
+ } else if (ex instanceof InvalidSerializedDataException) {
+ return new InvalidSerializedDataException(ex.getMessage());
+ } else if (ex instanceof ItemExistsException) {
+ return new ItemExistsException(ex.getMessage());
+ } else if (ex instanceof ItemNotFoundException) {
+ return new ItemNotFoundException(ex.getMessage());
+ } else if (ex instanceof LockException) {
+ return new LockException(ex.getMessage());
+ } else if (ex instanceof LoginException) {
+ return new LoginException(ex.getMessage());
+ } else if (ex instanceof MergeException) {
+ return new MergeException(ex.getMessage());
+ } else if (ex instanceof NamespaceException) {
+ return new NamespaceException(ex.getMessage());
+ } else if (ex instanceof NoSuchNodeTypeException) {
+ return new NoSuchNodeTypeException(ex.getMessage());
+ } else if (ex instanceof NoSuchWorkspaceException) {
+ return new NoSuchWorkspaceException(ex.getMessage());
+ } else if (ex instanceof PathNotFoundException) {
+ return new PathNotFoundException(ex.getMessage());
+ } else if (ex instanceof ReferentialIntegrityException) {
+ return new ReferentialIntegrityException(ex.getMessage());
+ } else if (ex instanceof UnsupportedRepositoryOperationException) {
+ return new UnsupportedRepositoryOperationException(ex.getMessage());
+ } else if (ex instanceof ValueFormatException) {
+ return new ValueFormatException(ex.getMessage());
+ } else if (ex instanceof VersionException) {
+ return new VersionException(ex.getMessage());
+ } else {
+ return new RepositoryException(ex.getMessage());
+ }
}
/**
Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerProperty.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerProperty.java?view=diff&r1=152651&r2=152652
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerProperty.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerProperty.java Tue Feb 8 00:58:19 2005
@@ -59,48 +59,80 @@
/** {@inheritDoc} */
public Value getValue() throws ValueFormatException, RepositoryException,
RemoteException {
- return new SerialValue(property.getValue());
+ try {
+ return new SerialValue(property.getValue());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public Value[] getValues() throws ValueFormatException,
RepositoryException, RemoteException {
- return SerialValue.makeSerialValueArray(property.getValues());
+ try {
+ return SerialValue.makeSerialValueArray(property.getValues());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void setValue(Value value) throws ValueFormatException,
RepositoryException, RemoteException {
- property.setValue(value);
+ try {
+ property.setValue(value);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void setValue(Value[] values) throws ValueFormatException,
RepositoryException, RemoteException {
- property.setValue(values);
+ try {
+ property.setValue(values);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public long getLength() throws ValueFormatException, RepositoryException,
RemoteException {
- return property.getLength();
+ try {
+ return property.getLength();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public long[] getLengths() throws ValueFormatException,
RepositoryException, RemoteException {
- return property.getLengths();
+ try {
+ return property.getLengths();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemotePropertyDef getDefinition() throws RepositoryException,
RemoteException {
- return factory.getRemotePropertyDef(property.getDefinition());
+ try {
+ return factory.getRemotePropertyDef(property.getDefinition());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public int getType() throws RepositoryException, RemoteException {
- return property.getType();
+ try {
+ return property.getType();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
}
Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRepository.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRepository.java?view=diff&r1=152651&r2=152652
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRepository.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerRepository.java Tue Feb 8 00:58:19 2005
@@ -70,30 +70,46 @@
/** {@inheritDoc} */
public RemoteSession login() throws LoginException,
NoSuchWorkspaceException, RepositoryException, RemoteException {
- Session session = repository.login();
- return factory.getRemoteSession(session);
+ try {
+ Session session = repository.login();
+ return factory.getRemoteSession(session);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteSession login(String workspace) throws LoginException,
NoSuchWorkspaceException, RepositoryException, RemoteException {
- Session session = repository.login(workspace);
- return factory.getRemoteSession(session);
+ try {
+ Session session = repository.login(workspace);
+ return factory.getRemoteSession(session);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteSession login(Credentials credentials) throws LoginException,
NoSuchWorkspaceException, RepositoryException, RemoteException {
- Session session = repository.login(credentials);
- return factory.getRemoteSession(session);
+ try {
+ Session session = repository.login(credentials);
+ return factory.getRemoteSession(session);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteSession login(Credentials credentials, String workspace)
throws LoginException, NoSuchWorkspaceException,
RepositoryException, RemoteException {
- Session session = repository.login(credentials, workspace);
- return factory.getRemoteSession(session);
+ try {
+ Session session = repository.login(credentials, workspace);
+ return factory.getRemoteSession(session);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
}
Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerSession.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerSession.java?view=diff&r1=152651&r2=152652
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerSession.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerSession.java Tue Feb 8 00:58:19 2005
@@ -87,7 +87,11 @@
/** {@inheritDoc} */
public RemoteSession impersonate(Credentials credentials)
throws LoginException, RepositoryException, RemoteException {
- return factory.getRemoteSession(session.impersonate(credentials));
+ try {
+ return factory.getRemoteSession(session.impersonate(credentials));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -104,25 +108,41 @@
/** {@inheritDoc} */
public String getNamespacePrefix(String uri) throws NamespaceException,
RepositoryException, RemoteException {
- return session.getNamespacePrefix(uri);
+ try {
+ return session.getNamespacePrefix(uri);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public String[] getNamespacePrefixes() throws RepositoryException,
RemoteException {
- return session.getNamespacePrefixes();
+ try {
+ return session.getNamespacePrefixes();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public String getNamespaceURI(String prefix) throws NamespaceException,
RepositoryException, RemoteException {
- return session.getNamespaceURI(prefix);
+ try {
+ return session.getNamespaceURI(prefix);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void setNamespacePrefix(String prefix, String uri)
throws NamespaceException, RepositoryException, RemoteException {
- session.setNamespacePrefix(prefix, uri);
+ try {
+ session.setNamespacePrefix(prefix, uri);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -133,45 +153,73 @@
/** {@inheritDoc} */
public RemoteNode getNodeByUUID(String uuid) throws ItemNotFoundException,
RepositoryException, RemoteException {
- return factory.getRemoteNode(session.getNodeByUUID(uuid));
+ try {
+ return factory.getRemoteNode(session.getNodeByUUID(uuid));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNode getRootNode() throws RepositoryException,
RemoteException {
- return factory.getRemoteNode(session.getRootNode());
+ try {
+ return factory.getRemoteNode(session.getRootNode());
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteItem getItem(String path) throws PathNotFoundException,
RepositoryException, RemoteException {
- return getRemoteItem(session.getItem(path));
+ try {
+ return getRemoteItem(session.getItem(path));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public boolean hasPendingChanges() throws RepositoryException,
RemoteException {
- return session.hasPendingChanges();
+ try {
+ return session.hasPendingChanges();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void move(String from, String to) throws ItemExistsException,
PathNotFoundException, ConstraintViolationException,
RepositoryException, RemoteException {
- session.move(from, to);
+ try {
+ session.move(from, to);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void save() throws AccessDeniedException, LockException,
ConstraintViolationException, InvalidItemStateException,
RepositoryException, RemoteException {
- session.save();
+ try {
+ session.save();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public void refresh(boolean keepChanges) throws RepositoryException,
RemoteException {
- session.refresh(keepChanges);
+ try {
+ session.refresh(keepChanges);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -184,7 +232,11 @@
PathNotFoundException, ItemExistsException,
ConstraintViolationException, InvalidSerializedDataException,
RepositoryException, RemoteException {
- session.importXML(path, new ByteArrayInputStream(xml));
+ try {
+ session.importXML(path, new ByteArrayInputStream(xml));
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -207,17 +259,25 @@
boolean noRecurse) throws InvalidSerializedDataException,
PathNotFoundException, IOException, RepositoryException,
RemoteException {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- session.exportDocView(path, buffer, binaryAsLink, noRecurse);
- return buffer.toByteArray();
+ try {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ session.exportDocView(path, buffer, binaryAsLink, noRecurse);
+ return buffer.toByteArray();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public byte[] exportSysView(String path, boolean binaryAsLink,
boolean noRecurse) throws PathNotFoundException, IOException,
RepositoryException, RemoteException {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- session.exportSysView(path, buffer, binaryAsLink, noRecurse);
- return buffer.toByteArray();
+ try {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ session.exportSysView(path, buffer, binaryAsLink, noRecurse);
+ return buffer.toByteArray();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
}
Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java?view=diff&r1=152651&r2=152652
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerWorkspace.java Tue Feb 8 00:58:19 2005
@@ -74,7 +74,11 @@
throws ConstraintViolationException, AccessDeniedException,
PathNotFoundException, ItemExistsException, RepositoryException,
RemoteException {
- workspace.copy(from, to);
+ try {
+ workspace.copy(from, to);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -82,7 +86,11 @@
throws NoSuchWorkspaceException, ConstraintViolationException,
AccessDeniedException, PathNotFoundException, ItemExistsException,
RepositoryException, RemoteException {
- this.workspace.copy(from, to, workspace);
+ try {
+ this.workspace.copy(from, to, workspace);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -91,7 +99,11 @@
ConstraintViolationException, AccessDeniedException,
PathNotFoundException, ItemExistsException, RepositoryException,
RemoteException {
- this.workspace.clone(workspace, from, to, removeExisting);
+ try {
+ this.workspace.clone(workspace, from, to, removeExisting);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -99,27 +111,43 @@
throws ConstraintViolationException, AccessDeniedException,
PathNotFoundException, ItemExistsException, RepositoryException,
RemoteException {
- workspace.move(from, to);
+ try {
+ workspace.move(from, to);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNodeTypeManager getNodeTypeManager()
throws RepositoryException, RemoteException {
- NodeTypeManager manager = workspace.getNodeTypeManager();
- return factory.getRemoteNodeTypeManager(manager);
+ try {
+ NodeTypeManager manager = workspace.getNodeTypeManager();
+ return factory.getRemoteNodeTypeManager(manager);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public RemoteNamespaceRegistry getNamespaceRegistry()
throws RepositoryException, RemoteException {
- NamespaceRegistry registry = workspace.getNamespaceRegistry();
- return factory.getRemoteNamespaceRegistry(registry);
+ try {
+ NamespaceRegistry registry = workspace.getNamespaceRegistry();
+ return factory.getRemoteNamespaceRegistry(registry);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
public String[] getAccessibleWorkspaceNames() throws RepositoryException,
RemoteException {
- return workspace.getAccessibleWorkspaceNames();
+ try {
+ return workspace.getAccessibleWorkspaceNames();
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
/** {@inheritDoc} */
@@ -127,6 +155,10 @@
throws IOException, PathNotFoundException, ItemExistsException,
ConstraintViolationException, InvalidSerializedDataException,
LockException, RepositoryException, RemoteException {
- workspace.importXML(path, new ByteArrayInputStream(xml), uuidBehaviour);
+ try {
+ workspace.importXML(path, new ByteArrayInputStream(xml), uuidBehaviour);
+ } catch (RepositoryException ex) {
+ throw getRepositoryException(ex);
+ }
}
}