Skip to content

Commit 7a12268

Browse files
committed
[refactor] VBE classes to allow additional implementations
1 parent e046777 commit 7a12268

40 files changed

+1870
-756
lines changed

exist-core/pom.xml

Lines changed: 57 additions & 1 deletion
Large diffs are not rendered by default.

exist-core/src/main/java/org/exist/collections/Collection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
import org.exist.security.SecurityManager;
5555
import org.exist.storage.*;
5656
import org.exist.storage.io.VariableByteInput;
57-
import org.exist.storage.io.VariableByteOutputStream;
57+
import org.exist.storage.io.VariableByteOutput;
5858
import org.exist.storage.lock.*;
5959
import org.exist.storage.lock.Lock.LockMode;
6060
import org.exist.storage.txn.Txn;
@@ -1207,7 +1207,7 @@ BinaryDocument addBinaryResource(Txn transaction, DBBroker broker, BinaryDocumen
12071207
* @throws IOException in case of I/O errors
12081208
12091209
*/
1210-
@EnsureContainerLocked(mode=READ_LOCK) void serialize(final VariableByteOutputStream outputStream) throws IOException, LockException;
1210+
@EnsureContainerLocked(mode=READ_LOCK) void serialize(final VariableByteOutput outputStream) throws IOException, LockException;
12111211

12121212
@Override void close();
12131213

exist-core/src/main/java/org/exist/collections/LockedCollection.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
/*
2+
* Elemental
3+
* Copyright (C) 2024, Evolved Binary Ltd
4+
*
5+
6+
* https://www.evolvedbinary.com | https://www.elemental.xyz
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; version 2.1.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+
* The original license header is included below.
23+
*
24+
* =====================================================================
25+
*
226
* eXist-db Open Source Native XML Database
327
* Copyright (C) 2001 The eXist-db Authors
428
*
@@ -29,7 +53,7 @@
2953
import org.exist.security.PermissionDeniedException;
3054
import org.exist.security.Subject;
3155
import org.exist.storage.*;
32-
import org.exist.storage.io.VariableByteOutputStream;
56+
import org.exist.storage.io.VariableByteOutput;
3357
import org.exist.storage.lock.Lock;
3458
import org.exist.storage.lock.LockedDocumentMap;
3559
import org.exist.storage.lock.ManagedCollectionLock;
@@ -473,7 +497,7 @@ public BinaryDocument addBinaryResource(final Txn transaction, final DBBroker br
473497
}
474498

475499
@Override
476-
public void serialize(final VariableByteOutputStream outputStream) throws IOException, LockException {
500+
public void serialize(final VariableByteOutput outputStream) throws IOException, LockException {
477501
collection.serialize(outputStream);
478502
}
479503

exist-core/src/main/java/org/exist/collections/MutableCollection.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
import org.exist.security.Subject;
7373
import org.exist.storage.*;
7474
import org.exist.storage.io.VariableByteInput;
75-
import org.exist.storage.io.VariableByteOutputStream;
75+
import org.exist.storage.io.VariableByteOutput;
7676
import org.exist.storage.lock.*;
7777
import org.exist.storage.lock.Lock.LockMode;
7878
import org.exist.storage.lock.Lock.LockType;
@@ -195,7 +195,7 @@ private MutableCollection(final DBBroker broker, final int collectionId,
195195
/**
196196
* Deserializes a Collection object
197197
*
198-
* Counterpart method to {@link #serialize(VariableByteOutputStream)}
198+
* Counterpart method to {@link #serialize(VariableByteOutput)}
199199
*
200200
* @param broker The database broker
201201
* @param path The path of the Collection
@@ -896,7 +896,7 @@ public Iterator<DocumentImpl> iteratorNoLock(final DBBroker broker) throws Permi
896896
* @param outputStream The output stream to write the collection contents to
897897
*/
898898
@Override
899-
public void serialize(final VariableByteOutputStream outputStream) throws IOException, LockException {
899+
public void serialize(final VariableByteOutput outputStream) throws IOException, LockException {
900900
outputStream.writeInt(collectionId);
901901

902902
final int size;
@@ -926,7 +926,7 @@ public void close() {
926926
/**
927927
* Read collection contents from the stream
928928
*
929-
* Counterpart method to {@link #serialize(VariableByteOutputStream)}
929+
* Counterpart method to {@link #serialize(VariableByteOutput)}
930930
*
931931
* @param broker The database broker
932932
* @param path The path of the Collection

exist-core/src/main/java/org/exist/dom/persistent/BinaryDocument.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
/*
2+
* Elemental
3+
* Copyright (C) 2024, Evolved Binary Ltd
4+
*
5+
6+
* https://www.evolvedbinary.com | https://www.elemental.xyz
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; version 2.1.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+
* The original license header is included below.
23+
*
24+
* =====================================================================
25+
*
226
* eXist-db Open Source Native XML Database
327
* Copyright (C) 2001 The eXist-db Authors
428
*
@@ -27,7 +51,7 @@
2751
import org.exist.storage.BrokerPool;
2852
import org.exist.storage.blob.BlobId;
2953
import org.exist.storage.io.VariableByteInput;
30-
import org.exist.storage.io.VariableByteOutputStream;
54+
import org.exist.storage.io.VariableByteOutput;
3155
import org.exist.xmldb.XmldbURI;
3256
import org.exist.xquery.Expression;
3357
import org.w3c.dom.DocumentType;
@@ -167,7 +191,7 @@ public void setBlobId(final BlobId blobId) {
167191
}
168192

169193
@Override
170-
public void write(final VariableByteOutputStream ostream) throws IOException {
194+
public void write(final VariableByteOutput ostream) throws IOException {
171195
ostream.writeInt(getDocId());
172196
ostream.writeUTF(getFileURI().toString());
173197

exist-core/src/main/java/org/exist/dom/persistent/DocumentImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
import org.exist.security.*;
6060
import org.exist.storage.*;
6161
import org.exist.storage.io.VariableByteInput;
62-
import org.exist.storage.io.VariableByteOutputStream;
62+
import org.exist.storage.io.VariableByteOutput;
6363
import org.exist.storage.lock.EnsureContainerLocked;
6464
import org.exist.storage.lock.EnsureLocked;
6565
import org.exist.storage.txn.Txn;
@@ -797,11 +797,11 @@ public void appendChild(final NodeHandle child) throws DOMException {
797797
/**
798798
* The method <code>write</code>
799799
*
800-
* @param ostream a <code>VariableByteOutputStream</code> value
800+
* @param ostream a <code>VariableByteOutput</code> value
801801
* @throws IOException if an error occurs
802802
*/
803803
@EnsureContainerLocked(mode=READ_LOCK)
804-
public void write(final VariableByteOutputStream ostream) throws IOException {
804+
public void write(final VariableByteOutput ostream) throws IOException {
805805
try {
806806
ostream.writeInt(docId);
807807
ostream.writeUTF(fileURI.toString());
@@ -823,7 +823,7 @@ public void write(final VariableByteOutputStream ostream) throws IOException {
823823
}
824824
}
825825

826-
void writeDocumentAttributes(final SymbolTable symbolTable, final VariableByteOutputStream ostream) throws IOException {
826+
void writeDocumentAttributes(final SymbolTable symbolTable, final VariableByteOutput ostream) throws IOException {
827827
ostream.writeLong(created);
828828
ostream.writeLong(lastModified);
829829
ostream.writeInt(symbolTable.getMimeTypeId(mimeType));

exist-core/src/main/java/org/exist/dom/persistent/DocumentMetadata.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
/*
2+
* Elemental
3+
* Copyright (C) 2024, Evolved Binary Ltd
4+
*
5+
6+
* https://www.evolvedbinary.com | https://www.elemental.xyz
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; version 2.1.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+
* The original license header is included below.
23+
*
24+
* =====================================================================
25+
*
226
* eXist-db Open Source Native XML Database
327
* Copyright (C) 2001 The eXist-db Authors
428
*
@@ -23,7 +47,7 @@
2347

2448
import org.exist.ResourceMetadata;
2549
import org.exist.storage.io.VariableByteInput;
26-
import org.exist.storage.io.VariableByteOutputStream;
50+
import org.exist.storage.io.VariableByteOutput;
2751
import org.w3c.dom.DocumentType;
2852

2953
import java.io.IOException;
@@ -100,7 +124,7 @@ public void decPageCount() {
100124
}
101125

102126
@Deprecated
103-
public void write(final SymbolTable symbolTable, final VariableByteOutputStream ostream) throws IOException {
127+
public void write(final SymbolTable symbolTable, final VariableByteOutput ostream) throws IOException {
104128
doc.writeDocumentAttributes(symbolTable, ostream);
105129
}
106130

exist-core/src/main/java/org/exist/dom/persistent/DocumentTypeImpl.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
/*
2+
* Elemental
3+
* Copyright (C) 2024, Evolved Binary Ltd
4+
*
5+
6+
* https://www.evolvedbinary.com | https://www.elemental.xyz
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; version 2.1.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+
* The original license header is included below.
23+
*
24+
* =====================================================================
25+
*
226
* eXist-db Open Source Native XML Database
327
* Copyright (C) 2001 The eXist-db Authors
428
*
@@ -23,7 +47,7 @@
2347

2448
import net.jcip.annotations.ThreadSafe;
2549
import org.exist.storage.io.VariableByteInput;
26-
import org.exist.storage.io.VariableByteOutputStream;
50+
import org.exist.storage.io.VariableByteOutput;
2751
import org.exist.xquery.Expression;
2852
import org.w3c.dom.DocumentType;
2953
import org.w3c.dom.NamedNodeMap;
@@ -79,7 +103,7 @@ public String getInternalSubset() {
79103
return null;
80104
}
81105

82-
protected void write(final VariableByteOutputStream ostream) throws IOException {
106+
protected void write(final VariableByteOutput ostream) throws IOException {
83107
ostream.writeUTF(name);
84108
ostream.writeUTF(systemId != null ? systemId : "");
85109
ostream.writeUTF(publicId != null ? publicId : "");

exist-core/src/main/java/org/exist/dom/persistent/LockToken.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
/*
2+
* Elemental
3+
* Copyright (C) 2024, Evolved Binary Ltd
4+
*
5+
6+
* https://www.evolvedbinary.com | https://www.elemental.xyz
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; version 2.1.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+
* The original license header is included below.
23+
*
24+
* =====================================================================
25+
*
226
* eXist-db Open Source Native XML Database
327
* Copyright (C) 2001 The eXist-db Authors
428
*
@@ -22,7 +46,7 @@
2246
package org.exist.dom.persistent;
2347

2448
import org.exist.storage.io.VariableByteInput;
25-
import org.exist.storage.io.VariableByteOutputStream;
49+
import org.exist.storage.io.VariableByteOutput;
2650
import org.exist.util.UUIDGenerator;
2751

2852
import javax.annotation.Nullable;
@@ -123,7 +147,8 @@ public static String generateUUID() {
123147
return UUIDGenerator.getUUID();
124148
}
125149

126-
public void write(final VariableByteOutputStream ostream) throws IOException {
150+
public void write(final VariableByteOutput
151+
ostream) throws IOException {
127152
// TODO(AR) these 3 bytes could be encoded into 1
128153
ostream.writeByte(type.getValue());
129154
ostream.writeByte(depth.getValue());

0 commit comments

Comments
 (0)