|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.AllExhibitPropertiesDelta
public final class AllExhibitPropertiesDelta
Class to compute/represent changes from one AEP instance to another. Where a small number of changes has occurred between one AEP and another, especially where those changes are renamings or minor textual changes, it may often be vastly more efficient to send a diff from an extant AEP instance than send the new instance in toto.
There may be circumstances in which this class cannot compute a diff, or where the diff is unlikely to be worthwhile (eg after huge changes), in which case the diff computation routine indicates failure/unwillingness and the caller may have to arrange for a full AEP to be transmitted.
This class is Serializable, and is reasonably efficient on-the-wire, but is not necessarily intended for long-term persistence; store the AEP instances themselves for that by preference.
We are cautious in that we store several explicit before-and-after hashes to be clear that we are applying diffs to the right AEP instance and so as to be sure that we end up with the correct value.
| Nested Class Summary | |
|---|---|
private static class |
AllExhibitPropertiesDelta.Change
Data for new/changed exhibit; immutable and serialisable. |
static class |
AllExhibitPropertiesDelta.DiffException
Minimal checked exception thrown to indicate that diff could not be generated/applied. |
| Field Summary | |
|---|---|
private ExhibitPropsGlobalImmutable.EPGIDiff |
epgiDiff
The diff from the previous EPGI; may be null to represent no changes to EPGI value. |
private java.util.Set<AllExhibitPropertiesDelta.Change> |
exhibitsAdded
The set of exhibits (full exhibit names) added (or changed); may be null if no additions/changes. |
private java.util.Set<Name.ExhibitFull> |
exhibitsDeleted
The set of exhibits (full exhibit names) removed (or changed); may be null if no deletions/changes. |
long |
hashNotChangedSinceAfter
The timestamp from the AEP result; guaranteed non-negative. |
int |
lengthAEIDAfter
The exhibit count for the AEIP in the AEP result; guaranteed non-negative. |
int |
lengthAEIDBefore
The exhibit count for the AEIP in the AEP to which the diff is to be applied; guaranteed non-negative. |
long |
longHashAEPAfter
The long hash for the AEP result; guaranteed non-negative. |
long |
longHashAEPBefore
The long hash for the AEP to which the diff is to be applied; guaranteed non-negative. |
private static long |
serialVersionUID
Serialisation ID. |
long |
timestampAEIDAfter
The timestamp/hash for the AEIP in the AEP result; guaranteed non-negative. |
long |
timestampAEIDBefore
The timestamp/hash for the AEIP in the AEP to which the diff is to be applied; guaranteed non-negative. |
| Constructor Summary | |
|---|---|
AllExhibitPropertiesDelta()
Construct an empty instance. |
|
AllExhibitPropertiesDelta(long longHashAEPBefore,
long longHashAEPAfter,
long timestampAEIDBefore,
long timestampAEIDAfter,
int lengthAEIDBefore,
int lengthAEIDAfter,
long hashNotChangedSinceAfter,
ExhibitPropsGlobalImmutable.EPGIDiff epgiDiff,
java.util.Set<Name.ExhibitFull> exhibitsDeleted,
java.util.Set<AllExhibitPropertiesDelta.Change> exhibitsAdded)
Construct an instance. |
|
| Method Summary | |
|---|---|
private static java.util.Set<AllExhibitPropertiesDelta.Change> |
_computeChangeValues(AllExhibitProperties aep)
Create "change" values from AEP; never null. |
static AllExhibitProperties |
applyDiff(AllExhibitProperties aep1,
AllExhibitPropertiesDelta diff)
Applies diff to an extant AEP instance to generate a new AEP instance; never null. |
static AllExhibitPropertiesDelta |
createDiff(AllExhibitProperties aep1,
AllExhibitProperties aep2,
boolean force)
Create diff between two AEP instances. |
private void |
readObject(java.io.ObjectInputStream ois)
Deserialise. |
java.lang.String |
toString()
Human-readable summary. |
void |
validateObject()
Validate fields/state. |
private void |
writeObject(java.io.ObjectOutputStream oos)
Write out a less-redundant form of our internal information. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final long longHashAEPBefore
public final long longHashAEPAfter
public final long hashNotChangedSinceAfter
public final long timestampAEIDBefore
public final long timestampAEIDAfter
public final int lengthAEIDBefore
public final int lengthAEIDAfter
private final ExhibitPropsGlobalImmutable.EPGIDiff epgiDiff
private transient java.util.Set<Name.ExhibitFull> exhibitsDeleted
Does not contain duplicates, nulls or invalid-syntax values.
This is all exhibits whose old definitions/data must be logically removed from the input AEP first.
private transient java.util.Set<AllExhibitPropertiesDelta.Change> exhibitsAdded
Does not contain duplicates, nulls or invalid-syntax values.
This is all exhibits whose old definitions/data must be logically added to the input AEP after the exhibitsDeleted set has been removed.
private static final long serialVersionUID
| Constructor Detail |
|---|
public AllExhibitPropertiesDelta()
public AllExhibitPropertiesDelta(long longHashAEPBefore,
long longHashAEPAfter,
long timestampAEIDBefore,
long timestampAEIDAfter,
int lengthAEIDBefore,
int lengthAEIDAfter,
long hashNotChangedSinceAfter,
ExhibitPropsGlobalImmutable.EPGIDiff epgiDiff,
java.util.Set<Name.ExhibitFull> exhibitsDeleted,
java.util.Set<AllExhibitPropertiesDelta.Change> exhibitsAdded)
The String and other complex values are assumed to already have been intern()ed as far as needed/possible, given that any diff instance may be short-lived.
| Method Detail |
|---|
private void writeObject(java.io.ObjectOutputStream oos)
throws java.io.IOException
java.io.IOException
private void readObject(java.io.ObjectInputStream ois)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void validateObject()
throws java.io.InvalidObjectException
Barf if something bad is found. (Maybe allow some extra info in debug version.)
java.io.InvalidObjectExceptionprivate static java.util.Set<AllExhibitPropertiesDelta.Change> _computeChangeValues(AllExhibitProperties aep)
public static AllExhibitPropertiesDelta createDiff(AllExhibitProperties aep1,
AllExhibitProperties aep2,
boolean force)
throws AllExhibitPropertiesDelta.DiffException
This will refuse to create a diff if it seems that the diff is unlikely to be useful, for example:
force - if true then force a diff to be produced
even if this routine would normally refuse to do so on efficiency grounds
AllExhibitPropertiesDelta.DiffException - if no diff can be generated
or is unlikely to be worthwhile to use
(eg would be more than a fraction of the size of the second AEP)
public static AllExhibitProperties applyDiff(AllExhibitProperties aep1,
AllExhibitPropertiesDelta diff)
throws AllExhibitPropertiesDelta.DiffException
AllExhibitPropertiesDelta.DiffException - if the diff cannot be appliedpublic final java.lang.String toString()
toString in class java.lang.Object
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||