*/
protected boolean __stored_in_document = false;
- protected long __last_hash = 0;
+ protected long __last_hash = 0; // default is different so doHash always returns true initially.
protected boolean registerable = false;
try {
Method fd = this.getClass().getMethod("setId", new Class[] { String.class });
fd.invoke((Object) this, new Object[] {new String(this.getVorbaId().id)});
- log.info(this.getClass().getName()+" called setInstanceIdField!");
+ log.debug(this.getClass().getName()+" called setInstanceIdField!");
} catch (InvocationTargetException e) {
- System.err
- .println("SourceGeneration of "
+ log.error("SourceGeneration of "
+ this.getClass().toString()
- + "\n has resulted in an inaccessible 'setId' method!\nCannot set ID from the vorbaId object.");
- e.printStackTrace(System.err);
+ + "\n has resulted in an inaccessible 'setId' method!\nCannot set ID from the vorbaId object.", e);
}
catch (IllegalAccessException e) {
- System.err
- .println("SourceGeneration of "
+ log.error("SourceGeneration of "
+ this.getClass().toString()
- + "\n has resulted in an inaccessible 'setId' method!\nCannot set ID from the vorbaId object.");
- e.printStackTrace(System.err);
+ + "\n has resulted in an inaccessible 'setId' method!\nCannot set ID from the vorbaId object.", e);
} catch (SecurityException e) {
- e.printStackTrace(System.err);
+ log.error("Security access violation for "+this.getClass().toString(),e);
} catch (NoSuchMethodException e) {
+ log.warn(this.getClass().toString()+" was erroneously marked as a Vorba object class (Implementation error?)");
this.setRegisterable(false);
}
} else {
/**
* calculate a hash for the object with all housekeeping fields at standard
* values. (isRegisterable is an immutable attribute property)
+ * @return true if new hash different to last hash
*/
- synchronized protected void doHash() {
+ synchronized protected boolean doHash() {
+ long __old_hash = __last_hash;
__last_hash = 0;
VorbaId thisid = vorbaId;
IVorbaIdFactory factory = __vorba;
vorbaId = thisid;
__vorba = factory;
__stored_in_document = stored;
+ return (__old_hash==0) || (__old_hash == __last_hash);
}
/**
* @return
*/
protected boolean merge(object laterCopy) {
+ log.warn(this.getClass().getName()+".merge() not implemented.");
return true;
}
protected void __ensure_instance_ids() {
if (__vorba==null)
throw new Error("Improperly intialised org.vamsas.client.object - no VorbaFactory given.");
- log.info(this.getClass()+".__ensure_instance_ids()");
+ log.debug("doing "+this.getClass()+".__ensure_instance_ids()");
if (!__stored_in_document && registerable)
setInstanceIdField();
+ if (!doHash())
+ return; // nothing has changed in this object - probably visited it before.
Class descriptor = null;
XMLClassDescriptorImpl descimpl = null;
try {
descriptor = this.getClass().getClassLoader().loadClass(this.getClass().getName()+"Descriptor");
descimpl = (XMLClassDescriptorImpl) descriptor.getConstructor(null).newInstance(null);
} catch (Exception e) {
- log.error("Couldn't resolve descriptor for "+this.getClass().getName());
+ log.fatal("Source Generation Error!: Couldn't resolve descriptor for "
+ +this.getClass().getName()
+ +" was 'generate descriptors' set for castorbuilder.properties?");
return;
}
FieldDescriptor fields[] = descimpl.getFields();
//}
} else {
rf = (object) fval;
- log.info("Got value for "+fields[i].getFieldName());
+ log.debug("Got value for "+fields[i].getFieldName());
}
}
} else {