📄 servernode.java
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.jackrabbit.rmi.server;import java.rmi.RemoteException;import javax.jcr.Node;import javax.jcr.Property;import javax.jcr.RepositoryException;import javax.jcr.Session;import javax.jcr.Value;import javax.jcr.lock.Lock;import javax.jcr.version.Version;import org.apache.jackrabbit.rmi.remote.RemoteItem;import org.apache.jackrabbit.rmi.remote.RemoteIterator;import org.apache.jackrabbit.rmi.remote.RemoteLock;import org.apache.jackrabbit.rmi.remote.RemoteNode;import org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition;import org.apache.jackrabbit.rmi.remote.RemoteNodeType;import org.apache.jackrabbit.rmi.remote.RemoteProperty;import org.apache.jackrabbit.rmi.remote.RemoteVersion;import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;/** * Remote adapter for the JCR {@link javax.jcr.Node Node} interface. * This class makes a local node available as an RMI service using * the {@link org.apache.jackrabbit.rmi.remote.RemoteNode RemoteNode} * interface. * * @author Jukka Zitting * @see javax.jcr.Node * @see org.apache.jackrabbit.rmi.remote.RemoteNode */public class ServerNode extends ServerItem implements RemoteNode { /** The adapted local node. */ private Node node; /** * Creates a remote adapter for the given local node. * * @param node local node * @param factory remote adapter factory * @throws RemoteException on RMI errors */ public ServerNode(Node node, RemoteAdapterFactory factory) throws RemoteException { super(node, factory); this.node = node; } /** {@inheritDoc} */ public RemoteNode addNode(String path) throws RepositoryException, RemoteException { try { return getRemoteNode(node.addNode(path)); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteNode addNode(String path, String type) throws RepositoryException, RemoteException { try { return getRemoteNode(node.addNode(path, type)); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteProperty getProperty(String path) throws RepositoryException, RemoteException { try { return getFactory().getRemoteProperty(node.getProperty(path)); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteIterator getProperties() throws RepositoryException, RemoteException { try { return getFactory().getRemotePropertyIterator(node.getProperties()); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteItem getPrimaryItem() throws RepositoryException, RemoteException { try { return getRemoteItem(node.getPrimaryItem()); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteIterator getProperties(String pattern) throws RepositoryException, RemoteException { try { return getFactory().getRemotePropertyIterator(node.getProperties(pattern)); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteIterator getReferences() throws RepositoryException, RemoteException { try { return getFactory().getRemotePropertyIterator(node.getReferences()); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public String getUUID() throws RepositoryException, RemoteException { try { return node.getUUID(); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public boolean hasNodes() throws RepositoryException, RemoteException { try { return node.hasNodes(); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public boolean hasProperties() throws RepositoryException, RemoteException { try { return node.hasProperties(); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public boolean hasProperty(String path) throws RepositoryException, RemoteException { try { return node.hasProperty(path); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteNodeType[] getMixinNodeTypes() throws RepositoryException, RemoteException { try { return getRemoteNodeTypeArray(node.getMixinNodeTypes()); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteNodeType getPrimaryNodeType() throws RepositoryException, RemoteException { try { return getFactory().getRemoteNodeType(node.getPrimaryNodeType()); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public boolean isNodeType(String type) throws RepositoryException, RemoteException { try { return node.isNodeType(type); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteIterator getNodes() throws RepositoryException, RemoteException { try { return getFactory().getRemoteNodeIterator(node.getNodes()); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteIterator getNodes(String pattern) throws RepositoryException, RemoteException { try { return getFactory().getRemoteNodeIterator(node.getNodes(pattern)); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteNode getNode(String path) throws RepositoryException, RemoteException { try { return getRemoteNode(node.getNode(path)); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public boolean hasNode(String path) throws RepositoryException, RemoteException { try { return node.hasNode(path); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteProperty setProperty(String name, Value value) throws RepositoryException, RemoteException { try { return getFactory().getRemoteProperty(node.setProperty(name, value)); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public RemoteProperty setProperty(String name, Value value, int type) throws RepositoryException, RemoteException { try { Property property = node.setProperty(name, value, type); if (property == null) { return null; } else { return getFactory().getRemoteProperty(property); } } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public void addMixin(String name) throws RepositoryException, RemoteException { try { node.addMixin(name); } catch (RepositoryException ex) { throw getRepositoryException(ex); } } /** {@inheritDoc} */ public boolean canAddMixin(String name) throws RepositoryException, RemoteException { try { return node.canAddMixin(name); } catch (RepositoryException ex) { throw getRepositoryException(ex);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -