taylor 2004/10/20 09:43:38
Modified: components/profiler/src/test/org/apache/jetspeed/profiler
TestProfiler.java
components/profiler/src/java/org/apache/jetspeed/profiler/impl
JetspeedProfiler.java
jetspeed-api/src/java/org/apache/jetspeed/profiler
Profiler.java
Log:
simplified the rule apis to store(object) and delete(object)
this should be a general pattern for DAO apis
Revision Changes Path
1.7 +4 -4
jakarta-jetspeed-2/components/profiler/src/test/org/apache/jetspeed/profiler/TestProfiler.java
Index: TestProfiler.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/components/profiler/src/test/org/apache/jetspeed/profiler/TestProfiler.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestProfiler.java 20 Oct 2004 16:29:59 -0000 1.6
+++ TestProfiler.java 20 Oct 2004 16:43:38 -0000 1.7
@@ -381,19 +381,19 @@
rule.setClassname("org.apache.jetspeed.profiler.rules.impl.StandardProfilingRule");
rule.setId("testmo");
rule.setTitle("The Grand Title");
- profiler.addProfilingRule(rule);
+ profiler.storeProfilingRule(rule);
ProfilingRule rule2 = profiler.getRule("testmo");
assertNotNull("rule couldnt be added", rule2);
assertTrue("rule id bad", rule.getId().equals(rule2.getId()));
rule2.setTitle("The New Title");
- profiler.updateProfilingRule(rule2);
+ profiler.storeProfilingRule(rule2);
ProfilingRule rule3= profiler.getRule("testmo");
assertNotNull("rule couldnt be retrieved", rule3);
assertTrue("rule title is bad", rule3.getTitle().equals(rule2.getTitle()));
- profiler.removeProfilingRule(rule);
+ profiler.deleteProfilingRule(rule);
ProfilingRule rule4 = profiler.getRule("testmo");
assertNull("rule couldnt be deleted", rule4);
1.11 +5 -23
jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/impl/JetspeedProfiler.java
Index: JetspeedProfiler.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/components/profiler/src/java/org/apache/jetspeed/profiler/impl/JetspeedProfiler.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- JetspeedProfiler.java 20 Oct 2004 16:29:40 -0000 1.10
+++ JetspeedProfiler.java 20 Oct 2004 16:43:38 -0000 1.11
@@ -391,7 +391,8 @@
return locators;
}
- public void addProfilingRule(ProfilingRule rule)
+
+ public void storeProfilingRule(ProfilingRule rule)
throws ProfilerException
{
try
@@ -410,27 +411,8 @@
throw new ProfilerException("failed to store: " + rule.getId(), e);
}
}
-
- public void updateProfilingRule(ProfilingRule rule)
- throws ProfilerException
- {
- try
- {
- System.out.println("UP making pers : " + rule.getId());
- Transaction tx = persistentStore.getTransaction();
- tx.begin();
- persistentStore.lockForWrite(rule);
- tx.commit();
- System.out.println("UP done making pers : " + rule.getId());
-
- }
- catch (Exception e)
- {
- throw new ProfilerException("failed to store: " + rule.getId(), e);
- }
- }
- public void removeProfilingRule(ProfilingRule rule)
+ public void deleteProfilingRule(ProfilingRule rule)
throws ProfilerException
{
try
@@ -442,7 +424,7 @@
}
catch (Exception e)
{
- throw new ProfilerException("failed to remove: " + rule.getId(), e);
+ throw new ProfilerException("failed to delete: " + rule.getId(), e);
}
}
1.12 +5 -12
jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/profiler/Profiler.java
Index: Profiler.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/jetspeed-api/src/java/org/apache/jetspeed/profiler/Profiler.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Profiler.java 20 Oct 2004 16:29:18 -0000 1.11
+++ Profiler.java 20 Oct 2004 16:43:38 -0000 1.12
@@ -143,24 +143,17 @@
throws ProfilerException;
/*
- * Persist a new profiling rule to the persistent store.
+ * Persist a profiling rule to the persistent store.
*
*/
- void addProfilingRule(ProfilingRule rule)
- throws ProfilerException;
-
- /*
- * Persist an existing profiling rule to the persistent store.
- *
- */
- void updateProfilingRule(ProfilingRule rule)
+ void storeProfilingRule(ProfilingRule rule)
throws ProfilerException;
/*
- * Remove a profiling rule from the persistent store.
+ * Deletes a profiling rule from the persistent store.
*
*/
- void removeProfilingRule(ProfilingRule rule)
+ void deleteProfilingRule(ProfilingRule rule)
throws ProfilerException;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]