You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2017/06/29 10:45:41 UTC

[05/11] jena git commit: Readonly enforcement wrapper.

Readonly enforcement wrapper.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/9d6c6e3c
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/9d6c6e3c
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/9d6c6e3c

Branch: refs/heads/master
Commit: 9d6c6e3c4436fa2f0f23f3bfa8415296015251ef
Parents: 9dc27c4
Author: Andy Seaborne <an...@apache.org>
Authored: Tue Jun 27 22:43:04 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Tue Jun 27 22:43:04 2017 +0100

----------------------------------------------------------------------
 .../tdb/base/objectfile/ObjectFileReadonly.java | 37 ++++++++++++++++++++
 1 file changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/9d6c6e3c/jena-tdb/src/main/java/org/apache/jena/tdb/base/objectfile/ObjectFileReadonly.java
----------------------------------------------------------------------
diff --git a/jena-tdb/src/main/java/org/apache/jena/tdb/base/objectfile/ObjectFileReadonly.java b/jena-tdb/src/main/java/org/apache/jena/tdb/base/objectfile/ObjectFileReadonly.java
new file mode 100644
index 0000000..9044b82
--- /dev/null
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/base/objectfile/ObjectFileReadonly.java
@@ -0,0 +1,37 @@
+/*
+ * 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.jena.tdb.base.objectfile;
+
+import java.nio.ByteBuffer ;
+
+import org.apache.jena.tdb.TDBException;
+import org.apache.jena.tdb.base.block.Block ;
+
+public class ObjectFileReadonly extends ObjectFileWrapper
+{
+    public ObjectFileReadonly(ObjectFile other)         { super(other) ; }
+    @Override public Block allocWrite(int maxBytes)     { throw new TDBException("Read-only object file") ; }
+    @Override public void completeWrite(Block buffer)   { throw new TDBException("Read-only object file") ; }
+    @Override public void abortWrite(Block buffer)      { throw new TDBException("Read-only object file") ; }
+    @Override public long write(ByteBuffer buffer)      { throw new TDBException("Read-only object file") ; }
+    @Override public void reposition(long id)           { throw new TDBException("Read-only object file") ; }
+    @Override public void truncate(long size)           { throw new TDBException("Read-only object file") ; }
+    
+    @Override public String toString()              { return "RO:"+super.toString() ; } 
+}