View Javadoc

1   /**
2    * Copyright (C) 2005-2009 Alfresco Software Limited.
3    *
4    * This file is part of the Spring Surf Extension project.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *  http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.springframework.extensions.webscripts.processor;
20  
21  import java.util.List;
22  
23  import org.springframework.extensions.surf.core.processor.Processor;
24  import org.springframework.extensions.surf.core.processor.ProcessorExtension;
25  
26  /**
27   * Abstract base class for a processor extension in the presentation tier.
28   * 
29   * {@link org.alfresco.repo.processor.BaseProcessorExtension}
30   */
31  public abstract class BaseProcessorExtension implements ProcessorExtension
32  {
33  	/** The list of processors */
34  	private List<Processor> processors = null;
35  	
36  	/** The name of the extension */
37  	private String extensionName;
38  	
39  	
40  	/**
41  	 * Sets the processor list.
42  	 * 
43  	 * @param processor		  The processor list
44  	 */
45  	public void setProcessors(List<Processor> processors)
46  	{
47  		this.processors = processors;
48  	}
49  	
50  	/**
51  	 * Spring bean init method - registers this extension with the appropriate processor.
52  	 */
53  	public void register()
54  	{
55  	    if (this.processors != null)
56  	    {
57  	        for (Processor processor : this.processors)
58  	        {
59  	            processor.registerProcessorExtension(this);
60  	        }
61  	    }
62  	}
63  	
64  	/**
65  	 * Sets the extension name.
66  	 * 
67  	 * @param extensionName the extension name
68  	 */
69  	public void setExtensionName(String extension)
70  	{
71  		this.extensionName = extension;
72  	}
73      
74      /**
75       * @see org.springframework.extensions.surf.core.processor.ProcessorExtension#getExtensionName()
76       */
77      public String getExtensionName()
78      {
79      	return this.extensionName;
80      }
81  }