KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > transformation > helpers > PreemptiveLoaderAction


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 package org.apache.cocoon.transformation.helpers;
17
18 import java.util.Map JavaDoc;
19
20 import org.apache.avalon.framework.parameters.Parameters;
21 import org.apache.avalon.framework.thread.ThreadSafe;
22 import org.apache.cocoon.acting.ServiceableAction;
23 import org.apache.cocoon.environment.Redirector;
24 import org.apache.cocoon.environment.SourceResolver;
25
26 /**
27  * This action starts the preemptive loader and runs forever.
28  *
29  * @author <a HREF="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
30  * @version CVS $Id: PreemptiveLoaderAction.java 30932 2004-07-29 17:35:38Z vgritsenko $
31  * @since 2.1
32  */

33 public class PreemptiveLoaderAction
34     extends ServiceableAction
35     implements ThreadSafe {
36
37     /**
38      * This action starts the preemptive loading
39      * It runs forever and is stopped by the {@link DefaultIncludeCacheManager}.
40      * @see org.apache.cocoon.acting.Action#act(Redirector, SourceResolver, Map, String, Parameters)
41      */

42     public Map JavaDoc act(Redirector redirector,
43                     SourceResolver resolver,
44                     Map JavaDoc objectModel,
45                     String JavaDoc source,
46                     Parameters parameters)
47     throws Exception JavaDoc {
48         PreemptiveLoader loader = PreemptiveLoader.getInstance();
49         if (!loader.alive) {
50             loader.process(this.manager, resolver, this.getLogger());
51             return EMPTY_MAP;
52         }
53         return null;
54     }
55 }
56
Popular Tags