Skip to content

Commit 128e2c1

Browse files
committed
[refactor] Remove undocumented configuration option that appears to be unused; default behaviour remains the same
1 parent 1042555 commit 128e2c1

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

exist-core/src/main/java/org/exist/storage/NativeBroker.java

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ public class NativeBroker implements DBBroker {
130130
public static final String EXIST_STATISTICS_LOGGER = "org.exist.statistics";
131131
private static final Logger LOG_STATS = LogManager.getLogger(EXIST_STATISTICS_LOGGER);
132132

133-
public static final byte PREPEND_DB_ALWAYS = 0;
134-
public static final byte PREPEND_DB_NEVER = 1;
135-
public static final byte PREPEND_DB_AS_NEEDED = 2;
136-
137133
public static final byte COLLECTIONS_DBX_ID = 0;
138134
public static final byte VALUES_DBX_ID = 2;
139135
public static final byte DOM_DBX_ID = 3;
@@ -213,8 +209,6 @@ public class NativeBroker implements DBBroker {
213209

214210
private final Path dataDir;
215211

216-
private final byte prepend;
217-
218212
private final Runtime run = Runtime.getRuntime();
219213

220214
private final NodeProcessor nodeProcessor = new NodeProcessor();
@@ -239,15 +233,6 @@ public NativeBroker(final BrokerPool pool, final Configuration config) throws EX
239233
this.lockManager = pool.getLockManager();
240234
LOG.debug("Initializing broker {}", hashCode());
241235

242-
final String prependDB = (String) config.getProperty("db-connection.prepend-db");
243-
if("always".equalsIgnoreCase(prependDB)) {
244-
this.prepend = PREPEND_DB_ALWAYS;
245-
} else if("never".equalsIgnoreCase(prependDB)) {
246-
this.prepend = PREPEND_DB_NEVER;
247-
} else {
248-
this.prepend = PREPEND_DB_AS_NEEDED;
249-
}
250-
251236
this.dataDir = config.getProperty(BrokerPool.PROPERTY_DATA_DIR, Paths.get(DEFAULT_DATA_DIR));
252237

253238
nodesCountThreshold = config.getInteger(BrokerPool.PROPERTY_NODES_BUFFER);
@@ -696,15 +681,21 @@ public Serializer newSerializer(final List<String> chainOfReceivers) {
696681
return new NativeSerializer(this, getConfiguration(), chainOfReceivers);
697682
}
698683

699-
public XmldbURI prepend(final XmldbURI uri) {
700-
switch(prepend) {
701-
case PREPEND_DB_ALWAYS:
702-
return uri.prepend(XmldbURI.ROOT_COLLECTION_URI);
703-
case PREPEND_DB_AS_NEEDED:
704-
return uri.startsWith(XmldbURI.ROOT_COLLECTION_URI) ? uri : uri.prepend(XmldbURI.ROOT_COLLECTION_URI);
705-
default:
706-
return uri;
684+
/**
685+
* Prepends '/db' to the URI if it is missing
686+
*
687+
* @param uri the URI
688+
*
689+
* @return the database URI
690+
*
691+
* @deprecated This is used inconsistently in NativeBroker, instead the caller should if necessary enforce the correct URI
692+
*/
693+
@Deprecated
694+
private XmldbURI prepend(final XmldbURI uri) {
695+
if (uri.startsWith(XmldbURI.ROOT_COLLECTION_URI)) {
696+
return uri;
707697
}
698+
return uri.prepend(XmldbURI.ROOT_COLLECTION_URI);
708699
}
709700

710701
/**

0 commit comments

Comments
 (0)