/** Returns null if not supported. */ private Clob masterClob() throws PersistException { Clob masterClob = mMasterClob; if (mMasterClobLoaded) { return masterClob; } S master = mMasterStorage.prepare(); mReplica.copyPrimaryKeyProperties(master); try { // FIXME: handle missing master with resync master.load(); if (master.isPropertySupported(mClobName)) { masterClob = (Clob) master.getPropertyValue(mClobName); if (masterClob == null) { // FIXME: perform resync, but still throw exception throw new PersistNoneException("Master Clob is null: " + mClobName); } } mMasterClob = masterClob; mMasterClobLoaded = true; return masterClob; } catch (FetchException e) { throw e.toPersistException(); } }
@Override public void afterLoad(S replica) { for (String name : mClobNames) { if (!replica.isPropertySupported(name)) { continue; } Clob replicaClob = (Clob) replica.getPropertyValue(name); if (replicaClob != null) { if (replicaClob instanceof ClobReplicationTrigger.Replicated) { if (((Replicated) replicaClob).parent() == this) { continue; } } Replicated clob = new Replicated(name, replica, replicaClob); replica.setPropertyValue(name, clob); } } replica.markAllPropertiesClean(); }