You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2005/03/14 10:31:17 UTC
svn commit: r157415 - in lenya/trunk/src/webapp: WEB-INF/cocoon-xconf.xsl
lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Publish.java
Author: andreas
Date: Mon Mar 14 01:31:16 2005
New Revision: 157415
URL: http://svn.apache.org/viewcvs?view=rev&rev=157415
Log:
introduced UsecaseScheduler
Modified:
lenya/trunk/src/webapp/WEB-INF/cocoon-xconf.xsl
lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Publish.java
Modified: lenya/trunk/src/webapp/WEB-INF/cocoon-xconf.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/WEB-INF/cocoon-xconf.xsl?view=diff&r1=157414&r2=157415
==============================================================================
--- lenya/trunk/src/webapp/WEB-INF/cocoon-xconf.xsl (original)
+++ lenya/trunk/src/webapp/WEB-INF/cocoon-xconf.xsl Mon Mar 14 01:31:16 2005
@@ -279,7 +279,7 @@
</usecases>
<component role="org.apache.cocoon.components.cron.CronJob/usecase"
- class="org.apache.lenya.cms.usecase.UsecaseCronJob"
+ class="org.apache.lenya.cms.usecase.scheduling.UsecaseCronJob"
logger="cron.usecase"/>
</xsl:copy>
Modified: lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Publish.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Publish.java?view=diff&r1=157414&r2=157415
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Publish.java (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/usecases/Publish.java Mon Mar 14 01:31:16 2005
@@ -32,6 +32,7 @@
import org.apache.lenya.cms.publication.util.OrderedDocumentSet;
import org.apache.lenya.cms.site.SiteManager;
import org.apache.lenya.cms.usecase.DocumentUsecase;
+import org.apache.lenya.cms.usecase.scheduling.UsecaseScheduler;
import org.apache.lenya.cms.workflow.WorkflowManager;
import org.apache.lenya.workflow.WorkflowException;
@@ -60,8 +61,8 @@
}
/**
- * Checks if the workflow event is supported and the parent of the document
- * exists in the live area.
+ * Checks if the workflow event is supported and the parent of the document exists in the live
+ * area.
*
* @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
*/
@@ -125,11 +126,22 @@
deleteParameter(SCHEDULE);
String dateString = getParameterAsString(SCHEDULE_TIME);
DateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
+ UsecaseScheduler scheduler = null;
try {
- Date date = format.parse(dateString);
- schedule(date);
- } catch (ParseException e) {
- addErrorMessage("The scheduler date must be of the form 'yyyy-MM-dd hh:mm:ss'.");
+ Date date = null;
+ try {
+ date = format.parse(dateString);
+ } catch (ParseException e) {
+ addErrorMessage("The scheduler date must be of the form 'yyyy-MM-dd hh:mm:ss'.");
+ }
+ if (date != null) {
+ scheduler = (UsecaseScheduler) this.manager.lookup(UsecaseScheduler.ROLE);
+ scheduler.schedule(this, date);
+ }
+ } finally {
+ if (scheduler != null) {
+ this.manager.release(scheduler);
+ }
}
} else {
super.doExecute();
@@ -169,8 +181,7 @@
}
/**
- * Publishes a document or the subtree below a document, based on the
- * parameter SUBTREE.
+ * Publishes a document or the subtree below a document, based on the parameter SUBTREE.
* @param document The document.
*/
protected void publishAll(Document document) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org