From: Bryan T. <tho...@us...> - 2007-12-04 20:30:46
|
Update of /cvsroot/cweb/generic-native/src/java/org/CognitiveWeb/generic/core In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv26710/src/java/org/CognitiveWeb/generic/core Modified Files: LinkSetIndex.java AbstractBTree.java Log Message: working through changes to variable length text fields embedded within multi-field keys to support GOM and the sparse row store. Index: AbstractBTree.java =================================================================== RCS file: /cvsroot/cweb/generic-native/src/java/org/CognitiveWeb/generic/core/AbstractBTree.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AbstractBTree.java 30 Nov 2007 21:54:08 -0000 1.6 --- AbstractBTree.java 4 Dec 2007 20:30:42 -0000 1.7 *************** *** 63,66 **** --- 63,67 ---- import org.CognitiveWeb.generic.core.ndx.Successor; import org.CognitiveWeb.generic.core.om.BaseObject; + import org.apache.log4j.Logger; /** *************** *** 78,81 **** --- 79,84 ---- public abstract class AbstractBTree extends BaseObject { + + protected static final Logger log = Logger.getLogger(AbstractBTree.class); // *************** *** 325,328 **** --- 328,341 ---- } + /** + * Method offers an opportunity to flush the backend BTree object to the + * store (default is NOP). If necessary, you can replace the + * {@link #_nativeBTreeId} in this method. The method is invoked whever the + * {@link AbstractBTree} object is serialized. + */ + protected void saveBTree() { + + } + //************************************************************ //********************* Externalizable *********************** *************** *** 331,340 **** /** * <p> ! * This class has NO persistent state - concrete classes MUST extend this ! * method to write out any additional persistent state. * </p> */ public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); --- 344,354 ---- /** * <p> ! * Extended to write out the metadata associated with the BTree. * </p> */ public void writeExternal(ObjectOutput out) throws IOException { + saveBTree(); + super.writeExternal(out); *************** *** 347,352 **** /** ! * This class has NO persistent state - concrete classes MUST extend this ! * method to read in any additional persistent state. */ public void readExternal(ObjectInput in) throws IOException, --- 361,367 ---- /** ! * <p> ! * Extended to read in the metadata associated with the BTree. ! * </p> */ public void readExternal(ObjectInput in) throws IOException, *************** *** 386,389 **** --- 401,406 ---- AbstractBTree tmp = (AbstractBTree) obj; + tmp.saveBTree(); + out.writePackedOId(tmp._nativeBTreeId); out.serialize(tmp._coercer); Index: LinkSetIndex.java =================================================================== RCS file: /cvsroot/cweb/generic-native/src/java/org/CognitiveWeb/generic/core/LinkSetIndex.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** LinkSetIndex.java 30 Nov 2007 21:54:08 -0000 1.18 --- LinkSetIndex.java 4 Dec 2007 20:30:42 -0000 1.19 *************** *** 1447,1450 **** --- 1447,1452 ---- // returns theValue is non-null). + log.debug("what="+gx+", value="+theValue); + add(getInternalKey(true, theValue, gx), gx); *************** *** 1582,1585 **** --- 1584,1589 ---- m_btreeId = m_btree.getOID(); // Save the oid of the BTree. + + log.info("btreeId="+m_btreeId+", nentries="+m_btree.size()); /* *************** *** 1610,1613 **** --- 1614,1618 ---- } + log.info(""); getBTree(); // make sure that the btree object is loaded. *************** *** 1638,1641 **** --- 1643,1648 ---- } + log.info("linkSetSize=" + getLinkSet().size() + ", indexSize=" + size()); + final IPropertyClass valuePropertyClass = getValuePropertyClass(); *************** *** 1644,1650 **** while (itr.hasNext()) { ! Generic what = (Generic) itr.next(); ! drop(getInternalKey(true, what.get(valuePropertyClass), what), what); what.removePropertyChangeListener(valuePropertyClass, this); --- 1651,1661 ---- while (itr.hasNext()) { ! final Generic what = (Generic) itr.next(); ! final Object value = what.get(valuePropertyClass); ! ! log.debug("what="+what+", value="+value); ! ! drop(getInternalKey(true, value, what), what); what.removePropertyChangeListener(valuePropertyClass, this); |