| CommandReceiverFactory.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
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 }