1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.editor.fckeditor.receiver;
16  
17  import com.liferay.portal.kernel.util.InstancePool;
18  
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  /**
23   * <a href="CommandReceiverFactory.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Ivica Cardic
26   * @author Michael C. Han
27   */
28  public class CommandReceiverFactory {
29  
30      public static CommandReceiver getCommandReceiver(String type) {
31          CommandReceiver commandReceiver = _commandReceivers.get(type);
32  
33          if (commandReceiver == null) {
34              commandReceiver = (CommandReceiver)InstancePool.get(
35                  "com.liferay.portal.editor.fckeditor.receiver.impl." +
36                      type + "CommandReceiver");
37  
38              _commandReceivers.put(type, commandReceiver);
39          }
40  
41          return commandReceiver;
42      }
43  
44      public void setCommandReceiver(
45          String type, CommandReceiver commandReceiver) {
46  
47          _commandReceivers.put(type, commandReceiver);
48      }
49  
50      public void setCommandReceivers(
51          Map<String, CommandReceiver> commandReceivers) {
52  
53          _commandReceivers.putAll(commandReceivers);
54      }
55  
56      private static Map<String, CommandReceiver> _commandReceivers =
57          new HashMap<String, CommandReceiver>();
58  
59  }