vgritsenko 2003/12/22 06:05:33
Modified: java/src/org/apache/xindice/core Collection.java
Log:
collection_id -> collectionId, document_id -> documentId.
Fixes for BinaryResource support.
Revision Changes Path
1.40 +23 -22
xml-xindice/java/src/org/apache/xindice/core/Collection.java
Index: Collection.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/Collection.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- Collection.java 11 Dec 2003 15:35:20 -0000 1.39
+++ Collection.java 22 Dec 2003 14:05:33 -0000 1.40
@@ -211,8 +211,9 @@
if (compressed) {
Document doc = new DocumentImpl(val.getData(),
symbols, new NodeSource(Collection.this, key));
return new ColContainer(key, doc);
- } else
+ } else {
return new ColContainer(key,
DOMParser.toDocument(val));
+ }
} catch (Exception e) {
if (log.isWarnEnabled()) {
log.warn("ignored exception", e);
@@ -240,20 +241,20 @@
private String canonicalName;
// Object ID Stuff
- private int collection_id = 0;
+ private int collectionId;
private File collectionRoot;
- private boolean compressed = false;
- private long document_id = System.currentTimeMillis();
+ private boolean compressed;
+ private long documentId = System.currentTimeMillis();
private DocumentCache documentCache;
- private Filer filer = null;
+ private Filer filer;
private IndexManager indexManager;
private InlineMetaService inlineMetaService;
- private boolean internalSymbols = false;
+ private boolean internalSymbols;
private String name;
- private Object oidMutex = new Object();
- private String oidTemplate = null;
- private Collection parent = null;
- private SymbolTable symbols = null;
+ private final Object oidMutex = new Object();
+ private String oidTemplate;
+ private Collection parent;
+ private SymbolTable symbols;
protected Collection() {
@@ -345,14 +346,14 @@
long ct = System.currentTimeMillis();
synchronized (oidMutex) {
- if (ct <= document_id) {
- ct = document_id + 1;
+ if (ct <= documentId) {
+ ct = documentId + 1;
}
- document_id = ct;
+ documentId = ct;
}
StringBuffer sb = new StringBuffer(oidTemplate);
- String document = Long.toString(document_id, 16);
+ String document = Long.toString(documentId, 16);
sb.insert(32 - document.length(), document);
sb.setLength(32);
@@ -488,7 +489,7 @@
log.debug(debugHeader() + "Get binary: " + key);
}
- if (inlineMetaService != null) {
+ if (inlineMetaService == null) {
throw new DBException(FaultCodes.COL_DOCUMENT_NOT_FOUND,
"There are no binary resources in
collection '"
+ getCanonicalName() + "': inline-metadata
is not enabled.");
@@ -1353,9 +1354,9 @@
Key objKey = createNewKey(key);
- Document oldDoc = getDocument(objKey);
- if (oldDoc != null) {
- indexManager.removeDocument(objKey, oldDoc);
+ Object oldDoc = getEntry(objKey);
+ if (oldDoc != null && oldDoc instanceof Document) {
+ indexManager.removeDocument(objKey, (Document)oldDoc);
}
if (documentCache != null) {
@@ -1380,10 +1381,10 @@
this.canonicalName = canonicalName;
// Calculate The OID Template
- collection_id = Math.abs(canonicalName.hashCode());
+ collectionId = Math.abs(canonicalName.hashCode());
StringBuffer sb = new
StringBuffer("00000000000000000000000000000000");
String host = Integer.toString(host_id, 16);
- String collection = Integer.toString(collection_id, 16);
+ String collection = Integer.toString(collectionId, 16);
sb.insert(8 - host.length(), host);
sb.insert(16 - collection.length(), collection);
sb.setLength(32);