r6984 - in dumbhippo/trunk/server/src/com/dumbhippo/dm: . schema store
- From: commits mugshot org
- To: online-desktop-list gnome org
- Subject: r6984 - in dumbhippo/trunk/server/src/com/dumbhippo/dm: . schema store
- Date: Thu, 6 Dec 2007 17:37:30 -0600 (CST)
Author: otaylor
Date: 2007-12-06 17:37:29 -0600 (Thu, 06 Dec 2007)
New Revision: 6984
Modified:
dumbhippo/trunk/server/src/com/dumbhippo/dm/ChangeNotification.java
dumbhippo/trunk/server/src/com/dumbhippo/dm/schema/DMClassHolder.java
dumbhippo/trunk/server/src/com/dumbhippo/dm/store/StoreKey.java
Log:
DMClassHolder.getBaseClass() => getDMOClass(), now we have inheritance, since it didn't mean 'base'
Modified: dumbhippo/trunk/server/src/com/dumbhippo/dm/ChangeNotification.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/dm/ChangeNotification.java 2007-12-06 23:29:41 UTC (rev 6983)
+++ dumbhippo/trunk/server/src/com/dumbhippo/dm/ChangeNotification.java 2007-12-06 23:37:29 UTC (rev 6984)
@@ -52,7 +52,7 @@
int propertyIndex = classHolder.getPropertyIndex(propertyName);
if (propertyIndex < 0)
- throw new RuntimeException("Class " + classHolder.getBaseClass().getName() + " has no property " + propertyName);
+ throw new RuntimeException("Class " + classHolder.getDMOClass().getName() + " has no property " + propertyName);
DMPropertyHolder<K,T,?> property = classHolder.getProperty(propertyIndex);
if (property instanceof FeedPropertyHolder)
@@ -67,7 +67,7 @@
int propertyIndex = classHolder.getPropertyIndex(propertyName);
if (propertyIndex < 0)
- throw new RuntimeException("Class " + classHolder.getBaseClass().getName() + " has no property " + propertyName);
+ throw new RuntimeException("Class " + classHolder.getDMOClass().getName() + " has no property " + propertyName);
addProperty(propertyIndex);
@@ -104,7 +104,7 @@
model.getStore().invalidate(classHolder, key, propertyIndex, timestamp);
logger.debug("Invalidated {}#{}.{}", new Object[] {
- classHolder.getBaseClass().getSimpleName(),
+ classHolder.getDMOClass().getSimpleName(),
key,
property.getName() });
}
Modified: dumbhippo/trunk/server/src/com/dumbhippo/dm/schema/DMClassHolder.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/dm/schema/DMClassHolder.java 2007-12-06 23:29:41 UTC (rev 6983)
+++ dumbhippo/trunk/server/src/com/dumbhippo/dm/schema/DMClassHolder.java 2007-12-06 23:37:29 UTC (rev 6984)
@@ -54,7 +54,7 @@
static private final Logger logger = GlobalSetup.getLogger(DMClassHolder.class);
private DataModel model;
- private Class<T> baseClass;
+ private Class<T> dmoClass;
private Class<K> keyClass;
private Constructor<K> keyStringConstructor;
private Constructor<? extends T> wrapperConstructor;
@@ -73,46 +73,46 @@
public DMClassHolder(DataModel model, DMClassInfo<K,T> classInfo) {
this.model = model;
- baseClass = classInfo.getObjectClass();
+ dmoClass = classInfo.getObjectClass();
keyClass = classInfo.getKeyClass();
if (keyClass != Guid.class && keyClass != String.class && keyClass != Long.class) {
try {
keyStringConstructor = keyClass.getConstructor(String.class);
} catch (NoSuchMethodException e) {
- throw new RuntimeException(baseClass.getName() + ": Can't find constructor for key class from a string");
+ throw new RuntimeException(dmoClass.getName() + ": Can't find constructor for key class from a string");
}
for (Class<?> exceptionClass : keyStringConstructor.getExceptionTypes()) {
if (!(RuntimeException.class.isAssignableFrom(exceptionClass) ||
BadIdException.class.isAssignableFrom(exceptionClass)))
- throw new RuntimeException(baseClass.getName() + ": String key constructor can only throw BadIdException");
+ throw new RuntimeException(dmoClass.getName() + ": String key constructor can only throw BadIdException");
}
}
- annotation = baseClass.getAnnotation(DMO.class);
+ annotation = dmoClass.getAnnotation(DMO.class);
if (annotation == null)
- throw new RuntimeException("DMObject class " + baseClass.getName() + " doesn't have a @DMO annotation");
+ throw new RuntimeException("DMObject class " + dmoClass.getName() + " doesn't have a @DMO annotation");
// Validate the classId as an URI
try {
URI uri = new URI(annotation.classId());
if (uri.getFragment() != null)
- throw new RuntimeException(baseClass.getName() + ": classId '" + annotation.classId() + "' can't have a fragment identifier");
+ throw new RuntimeException(dmoClass.getName() + ": classId '" + annotation.classId() + "' can't have a fragment identifier");
} catch (URISyntaxException e1) {
- throw new RuntimeException(baseClass.getName() + ": classId '" + annotation.classId() + "' is not a valid URI");
+ throw new RuntimeException(dmoClass.getName() + ": classId '" + annotation.classId() + "' is not a valid URI");
}
buildWrapperClass();
- DMFilter filterAnnotation = baseClass.getAnnotation(DMFilter.class);
+ DMFilter filterAnnotation = dmoClass.getAnnotation(DMFilter.class);
if (filterAnnotation != null) {
try {
filter = FilterParser.parse(filterAnnotation.value());
} catch (com.dumbhippo.dm.parser.ParseException e) {
- throw new RuntimeException(baseClass.getName() + ": Error parsing filter", e);
+ throw new RuntimeException(dmoClass.getName() + ": Error parsing filter", e);
}
itemFilter = filter.asItemFilter();
@@ -148,8 +148,8 @@
return keyClass;
}
- public Class<T> getBaseClass() {
- return baseClass;
+ public Class<T> getDMOClass() {
+ return dmoClass;
}
public int getPropertyIndex(String name) {
@@ -201,7 +201,7 @@
T result = wrapperConstructor.newInstance(key, session);
return result;
} catch (Exception e) {
- throw new RuntimeException("Error creating instance of class " + baseClass.getName(), e);
+ throw new RuntimeException("Error creating instance of class " + dmoClass.getName(), e);
}
}
@@ -290,7 +290,7 @@
public void processInjections(DMSession session, T t) {
DMInjectionLookup injectionLookup = model.getInjectionLookup();
- Class<?> clazz = baseClass;
+ Class<?> clazz = dmoClass;
while (clazz != null) {
for (Field field : clazz.getDeclaredFields()) {
Object injection = null;
@@ -392,7 +392,7 @@
Map<String, Integer> nameCount = new HashMap<String, Integer>();
for (CtMethod method : baseCtClass.getDeclaredMethods()) {
- DMPropertyHolder<K,T,?> property = DMPropertyHolder.getForMethod(model, baseClass, keyClass, method);
+ DMPropertyHolder<K,T,?> property = DMPropertyHolder.getForMethod(model, dmoClass, keyClass, method);
if (property != null) {
foundProperties.add(property);
if (!nameCount.containsKey(property.getName()))
@@ -402,7 +402,7 @@
}
}
- Class<?> parentClass = baseClass.getSuperclass();
+ Class<?> parentClass = dmoClass.getSuperclass();
while (parentClass != null) {
DMO parentAnnotation = parentClass.getAnnotation(DMO.class);
if (parentAnnotation != null) {
@@ -664,9 +664,9 @@
}
private void buildWrapperClass() {
- String className = baseClass.getName();
+ String className = dmoClass.getName();
ClassPool classPool = model.getClassPool();
- CtClass baseCtClass = ctClassForClass(baseClass);
+ CtClass baseCtClass = ctClassForClass(dmoClass);
collateProperties(baseCtClass);
Modified: dumbhippo/trunk/server/src/com/dumbhippo/dm/store/StoreKey.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/dm/store/StoreKey.java 2007-12-06 23:29:41 UTC (rev 6983)
+++ dumbhippo/trunk/server/src/com/dumbhippo/dm/store/StoreKey.java 2007-12-06 23:37:29 UTC (rev 6984)
@@ -42,6 +42,6 @@
@Override
public String toString() {
- return classHolder.getBaseClass().getSimpleName() + "#" + key.toString();
+ return classHolder.getDMOClass().getSimpleName() + "#" + key.toString();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]