KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > task > Task


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 /* $Id: Task.java 42598 2004-03-01 16:18:28Z gregor $ */
19
20 package org.apache.lenya.cms.task;
21
22 import org.apache.avalon.framework.parameters.Parameterizable;
23
24 /**
25  * A Task is a command that can be executed. <br/
26  * > When a Task is executed from a TaskAction or initialized from a TaskJob, the default
27  * parameters are provided. <strong>This is not a contract!</strong>
28  */

29 public interface Task extends Parameterizable {
30     
31     String JavaDoc NAMESPACE = "http://apache.org/cocoon/lenya/task/1.0";
32     String JavaDoc DEFAULT_PREFIX = "task";
33     int SUCCESS = 0;
34     int FAILURE = 1;
35
36     /**
37      * The path of the servlet
38      * context:<br/><code>/home/user_id/build/jakarta-tomcat/webapps/lenyacms</code>
39      */

40     String JavaDoc PARAMETER_SERVLET_CONTEXT = "servlet-context";
41
42     /**
43      * The server
44      * URI:<br/><code><strong>http://www.yourhost.com</strong>:8080/lenya/publication/index.html</code>
45      */

46     String JavaDoc PARAMETER_SERVER_URI = "server-uri";
47
48     /**
49      * The server
50      * port:<br/><code>http://www.yourhost.com:<strong>8080</strong>/lenya/publication/index.html</code>
51      */

52     String JavaDoc PARAMETER_SERVER_PORT = "server-port";
53
54     /**
55      * The part of the URI that precedes the publication
56      * ID:<br/><code>http://www.yourhost.com:8080<strong>/lenya</strong>/publication/index.html</code>
57      */

58     String JavaDoc PARAMETER_CONTEXT_PREFIX = "context-prefix";
59
60     /**
61      * The publication
62      * ID:<br/><code>http://www.yourhost.com:8080/lenya/<strong>publication</strong>/index.html</code>
63      */

64     String JavaDoc PARAMETER_PUBLICATION_ID = "publication-id";
65
66     /**
67      * Execute the task. All parameters must have been set with parameterize().
68      *
69      * @param servletContextPath the servlet-context
70      *
71      * @throws ExecutionException if the execution fails
72      */

73     void execute(String JavaDoc servletContextPath) throws ExecutionException;
74
75     /**
76      * Set the label that is used to identify the task.
77      *
78      * @param label the label
79      */

80     void setLabel(String JavaDoc label);
81     
82     /**
83      * Returns the result of the task ({@link #SUCCESS}, {@link FAILURE}).
84      * @return
85      */

86     int getResult();
87 }
88
Popular Tags