001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: */
018:
019: /* $Id: Task.java 473861 2006-11-12 03:51:14Z gregor $ */
020:
021: package org.apache.lenya.cms.task;
022:
023: import org.apache.avalon.framework.parameters.Parameterizable;
024: import org.apache.avalon.framework.service.ServiceManager;
025:
026: /**
027: * A Task is a command that can be executed. <br/>
028: * When a Task is executed from a TaskAction or initialized from a TaskJob, the default
029: * parameters are provided. <strong>This is not a contract!</strong>
030: *
031: * @deprecated Use the usecase framework instead.
032: */
033: public interface Task extends Parameterizable {
034:
035: /**
036: * <code>NAMESPACE</code> The task namespace
037: */
038: public final static String NAMESPACE = "http://apache.org/cocoon/lenya/task/1.0";
039: /**
040: * <code>DEFAULT_PREFIX</code> The task namespace prefix
041: */
042: public final static String DEFAULT_PREFIX = "task";
043: /**
044: * <code>SUCCESS</code> Success
045: */
046: public final static int SUCCESS = 0;
047: /**
048: * <code>FAILURE</code> Failure
049: */
050: public final static int FAILURE = 1;
051:
052: /**
053: * The path of the servlet
054: * context:<br/><code>/home/user_id/build/jakarta-tomcat/webapps/lenyacms</code>
055: */
056: String PARAMETER_SERVLET_CONTEXT = "servlet-context";
057:
058: /**
059: * The server
060: * URI:<br/><code><strong>http://www.yourhost.com</strong>:8080/lenya/publication/index.html</code>
061: */
062: String PARAMETER_SERVER_URI = "server-uri";
063:
064: /**
065: * The server
066: * port:<br/><code>http://www.yourhost.com:<strong>8080</strong>/lenya/publication/index.html</code>
067: */
068: String PARAMETER_SERVER_PORT = "server-port";
069:
070: /**
071: * The part of the URI that precedes the publication
072: * ID:<br/><code>http://www.yourhost.com:8080<strong>/lenya</strong>/publication/index.html</code>
073: */
074: String PARAMETER_CONTEXT_PREFIX = "context-prefix";
075:
076: /**
077: * The publication
078: * ID:<br/><code>http://www.yourhost.com:8080/lenya/<strong>publication</strong>/index.html</code>
079: */
080: String PARAMETER_PUBLICATION_ID = "publication-id";
081:
082: /**
083: * Execute the task. All parameters must have been set with parameterize().
084: * @param servletContextPath the servlet-context
085: * @throws ExecutionException if the execution fails
086: */
087: void execute(String servletContextPath) throws ExecutionException;
088:
089: /**
090: * Set the label that is used to identify the task.
091: * @param label the label
092: */
093: void setLabel(String label);
094:
095: /**
096: * Returns the result of the task ({@link #SUCCESS}, {@link #FAILURE}).
097: * @return #SUCCESS for success, #FAILURE for failure
098: */
099: int getResult();
100:
101: /**
102: * Passes the service manager to the task.
103: * @param manager The service manager.
104: */
105: void service(ServiceManager manager);
106: }
|