jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r487845 - in /jackrabbit/trunk/jackrabbit-jcr-rmi: ./ src/main/java/org/apache/jackrabbit/rmi/jackrabbit/
Date Sat, 16 Dec 2006 18:16:26 GMT
Author: jukka
Date: Sat Dec 16 10:16:25 2006
New Revision: 487845

URL: http://svn.apache.org/viewvc?view=rev&rev=487845
Log:
JCR-585: Added (undocumented) Jackrabbit extensions to JCR-RMI.

Added:
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ClientJackrabbitNodeTypeManager.java
  (with props)
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ClientJackrabbitWorkspace.java
  (with props)
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitClientAdapterFactory.java
  (with props)
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitServerAdapterFactory.java
  (with props)
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/RemoteJackrabbitNodeTypeManager.java
  (with props)
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/RemoteJackrabbitWorkspace.java
  (with props)
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ServerJackrabbitNodeTypeManager.java
  (with props)
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ServerJackrabbitWorkspace.java
  (with props)
Modified:
    jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml?view=diff&rev=487845&r1=487844&r2=487845
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml Sat Dec 16 10:16:25 2006
@@ -99,6 +99,12 @@
       <version>1.0</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-api</artifactId>
+      <version>${project.version}</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
       <groupId>xerces</groupId>
       <artifactId>xercesImpl</artifactId>
       <version>2.6.2</version>

Added: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ClientJackrabbitNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ClientJackrabbitNodeTypeManager.java?view=auto&rev=487845
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ClientJackrabbitNodeTypeManager.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ClientJackrabbitNodeTypeManager.java
Sat Dec 16 10:16:25 2006
@@ -0,0 +1,89 @@
+/*
+ * 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.jackrabbit;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.rmi.RemoteException;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.NodeType;
+
+import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
+import org.apache.jackrabbit.rmi.client.ClientNodeTypeManager;
+import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
+import org.apache.jackrabbit.rmi.client.RemoteRepositoryException;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class ClientJackrabbitNodeTypeManager extends ClientNodeTypeManager
+        implements JackrabbitNodeTypeManager {
+
+    private final RemoteJackrabbitNodeTypeManager remote;
+
+    public ClientJackrabbitNodeTypeManager(
+            RemoteJackrabbitNodeTypeManager remote,
+            LocalAdapterFactory factory) {
+        super(remote, factory);
+        this.remote = remote;
+    }
+
+    public boolean hasNodeType(String name) throws RepositoryException {
+        try {
+            return remote.hasNodeType(name);
+        } catch (RemoteException e) {
+            throw new RemoteRepositoryException(e);
+        }
+    }
+
+
+    public NodeType[] registerNodeTypes(InputSource in)
+            throws SAXException, RepositoryException {
+        try {
+            return registerNodeTypes(in.getByteStream(), TEXT_XML);
+        } catch (IOException e) {
+            throw new SAXException("Error reading node type stream", e);
+        }
+    }
+
+
+    public NodeType[] registerNodeTypes(InputStream in, String contentType)
+            throws IOException, RepositoryException {
+        try {
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            byte[] buffer = new byte[1000];
+            for (int n = in.read(buffer); n != -1; n = in.read(buffer)) {
+                out.write(buffer, 0, n);
+            }
+
+            RemoteNodeType[] remotes =
+                remote.registerNodeTypes(out.toByteArray(), contentType);
+            NodeType[] types = new NodeType[remotes.length];
+            for (int i = 0; i < remotes.length; i++) {
+                types[i] = getFactory().getNodeType(remotes[i]);
+            }
+            return types;
+        } catch (RemoteException e) {
+            throw new RemoteRepositoryException(e);
+        } finally {
+            in.close();
+        }
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ClientJackrabbitNodeTypeManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ClientJackrabbitWorkspace.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ClientJackrabbitWorkspace.java?view=auto&rev=487845
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ClientJackrabbitWorkspace.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ClientJackrabbitWorkspace.java
Sat Dec 16 10:16:25 2006
@@ -0,0 +1,76 @@
+/*
+ * 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.jackrabbit;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.rmi.RemoteException;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.jackrabbit.api.JackrabbitWorkspace;
+import org.apache.jackrabbit.rmi.client.ClientWorkspace;
+import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
+import org.apache.jackrabbit.rmi.client.RemoteRepositoryException;
+import org.xml.sax.InputSource;
+
+public class ClientJackrabbitWorkspace extends ClientWorkspace
+        implements JackrabbitWorkspace {
+
+    private final RemoteJackrabbitWorkspace remote;
+
+    public ClientJackrabbitWorkspace(
+            Session session, RemoteJackrabbitWorkspace remote,
+            LocalAdapterFactory factory) {
+        super(session, remote, factory);
+        this.remote = remote;
+    }
+
+    public void createWorkspace(String name) throws RepositoryException {
+        try {
+            remote.createWorkspace(name, null);
+        } catch (RemoteException e) {
+            throw new RemoteRepositoryException(e);
+        }
+    }
+
+    public void createWorkspace(String name, InputSource template)
+            throws RepositoryException {
+        try {
+            InputStream input = template.getByteStream();
+            try {
+                ByteArrayOutputStream output = new ByteArrayOutputStream();
+                byte[] buffer = new byte[1000];
+                int n = input.read(buffer);
+                while (n != -1) {
+                    output.write(buffer, 0, n);
+                    n = input.read(buffer);
+                }
+                remote.createWorkspace(name, output.toByteArray());
+            } finally {
+                input.close();
+            }
+        } catch (RemoteException e) {
+            throw new RemoteRepositoryException(e);
+        } catch (IOException e) {
+            throw new RepositoryException("Error reading workspace template", e);
+        }
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ClientJackrabbitWorkspace.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitClientAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitClientAdapterFactory.java?view=auto&rev=487845
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitClientAdapterFactory.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitClientAdapterFactory.java
Sat Dec 16 10:16:25 2006
@@ -0,0 +1,48 @@
+/*
+ * 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.jackrabbit;
+
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+import javax.jcr.nodetype.NodeTypeManager;
+
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
+import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+
+public class JackrabbitClientAdapterFactory extends ClientAdapterFactory {
+
+    public NodeTypeManager getNodeTypeManager(RemoteNodeTypeManager remote) {
+        if (remote instanceof RemoteJackrabbitNodeTypeManager) {
+            return new ClientJackrabbitNodeTypeManager(
+                    (RemoteJackrabbitNodeTypeManager) remote, this);
+        } else {
+            return super.getNodeTypeManager(remote);
+        }
+    }
+
+    public Workspace getWorkspace(Session session, RemoteWorkspace remote) {
+        if (remote instanceof RemoteJackrabbitWorkspace) {
+            return new ClientJackrabbitWorkspace(
+                    session, (RemoteJackrabbitWorkspace) remote, this);
+        } else {
+            return super.getWorkspace(session, remote);
+        }
+    }
+
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitClientAdapterFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitServerAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitServerAdapterFactory.java?view=auto&rev=487845
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitServerAdapterFactory.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitServerAdapterFactory.java
Sat Dec 16 10:16:25 2006
@@ -0,0 +1,52 @@
+/*
+ * 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.jackrabbit;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Workspace;
+import javax.jcr.nodetype.NodeTypeManager;
+
+import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
+import org.apache.jackrabbit.api.JackrabbitWorkspace;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
+import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
+
+public class JackrabbitServerAdapterFactory extends ServerAdapterFactory {
+
+    public RemoteNodeTypeManager getRemoteNodeTypeManager(
+            NodeTypeManager manager) throws RemoteException {
+        if (manager instanceof JackrabbitNodeTypeManager) {
+            return new ServerJackrabbitNodeTypeManager(
+                    (JackrabbitNodeTypeManager) manager, this);
+        } else {
+            return super.getRemoteNodeTypeManager(manager);
+        }
+    }
+
+    public RemoteWorkspace getRemoteWorkspace(Workspace workspace)
+            throws RemoteException {
+        if (workspace instanceof JackrabbitWorkspace) {
+            return new ServerJackrabbitWorkspace(
+                    (JackrabbitWorkspace) workspace, this);
+        } else {
+            return super.getRemoteWorkspace(workspace);
+        }
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/JackrabbitServerAdapterFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/RemoteJackrabbitNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/RemoteJackrabbitNodeTypeManager.java?view=auto&rev=487845
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/RemoteJackrabbitNodeTypeManager.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/RemoteJackrabbitNodeTypeManager.java
Sat Dec 16 10:16:25 2006
@@ -0,0 +1,35 @@
+/*
+ * 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.jackrabbit;
+
+import java.io.IOException;
+import java.rmi.RemoteException;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
+
+public interface RemoteJackrabbitNodeTypeManager extends RemoteNodeTypeManager {
+
+    boolean hasNodeType(String name)
+        throws RepositoryException, RemoteException;
+
+    RemoteNodeType[] registerNodeTypes(byte[] content, String contentType)
+        throws IOException, RepositoryException, RemoteException;
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/RemoteJackrabbitNodeTypeManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/RemoteJackrabbitWorkspace.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/RemoteJackrabbitWorkspace.java?view=auto&rev=487845
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/RemoteJackrabbitWorkspace.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/RemoteJackrabbitWorkspace.java
Sat Dec 16 10:16:25 2006
@@ -0,0 +1,30 @@
+/*
+ * 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.jackrabbit;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+
+public interface RemoteJackrabbitWorkspace extends RemoteWorkspace {
+
+    void createWorkspace(String name, byte[] template)
+        throws RepositoryException, RemoteException;
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/RemoteJackrabbitWorkspace.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ServerJackrabbitNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ServerJackrabbitNodeTypeManager.java?view=auto&rev=487845
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ServerJackrabbitNodeTypeManager.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ServerJackrabbitNodeTypeManager.java
Sat Dec 16 10:16:25 2006
@@ -0,0 +1,60 @@
+/*
+ * 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.jackrabbit;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.rmi.RemoteException;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.NodeType;
+
+import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
+import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerNodeTypeManager;
+
+public class ServerJackrabbitNodeTypeManager extends ServerNodeTypeManager
+        implements RemoteJackrabbitNodeTypeManager {
+
+    private final JackrabbitNodeTypeManager manager;
+
+    public ServerJackrabbitNodeTypeManager(
+            JackrabbitNodeTypeManager manager, RemoteAdapterFactory factory)
+            throws RemoteException {
+        super(manager, factory);
+        this.manager = manager;
+    }
+
+    public boolean hasNodeType(String name) throws RepositoryException {
+        return manager.hasNodeType(name);
+    }
+
+    public RemoteNodeType[] registerNodeTypes(
+            byte[] content, String type)
+            throws IOException, RepositoryException {
+        InputStream stream = new ByteArrayInputStream(content);
+        NodeType[] types = manager.registerNodeTypes(stream, type);
+        RemoteNodeType[] remotes = new RemoteNodeType[types.length];
+        for (int i = 0; i < types.length; i++) {
+            remotes[i] = getFactory().getRemoteNodeType(types[i]);
+        }
+        return remotes;
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ServerJackrabbitNodeTypeManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ServerJackrabbitWorkspace.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ServerJackrabbitWorkspace.java?view=auto&rev=487845
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ServerJackrabbitWorkspace.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ServerJackrabbitWorkspace.java
Sat Dec 16 10:16:25 2006
@@ -0,0 +1,56 @@
+/*
+ * 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.jackrabbit;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.rmi.RemoteException;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.api.JackrabbitWorkspace;
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerWorkspace;
+import org.xml.sax.InputSource;
+
+public class ServerJackrabbitWorkspace extends ServerWorkspace
+        implements RemoteJackrabbitWorkspace {
+
+    private final JackrabbitWorkspace workspace;
+
+    public ServerJackrabbitWorkspace(
+            JackrabbitWorkspace workspace, RemoteAdapterFactory factory)
+            throws RemoteException {
+        super(workspace, factory);
+        this.workspace = workspace;
+    }
+
+    public void createWorkspace(String name, byte[] template)
+            throws RepositoryException {
+        try {
+            if (template != null) {
+                InputStream stream = new ByteArrayInputStream(template);
+                workspace.createWorkspace(name, new InputSource(stream));
+            } else {
+                workspace.createWorkspace(name);
+            }
+        } catch (RepositoryException e) {
+            throw getRepositoryException(e);
+        }
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/jackrabbit/ServerJackrabbitWorkspace.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message