1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.om.registry.base;
18
19 import org.apache.jetspeed.om.registry.RegistryEntry;
20 import org.apache.jetspeed.om.registry.InvalidEntryException;
21 import org.apache.jetspeed.om.registry.RegistryException;
22 import org.apache.jetspeed.services.Registry;
23 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
24 import org.apache.jetspeed.services.logging.JetspeedLogger;
25
26 /***
27 * Extends BaseRegistry implementation to override object creation
28 * method and ensure Registry object is synchronized with its
29 * persistence backend by delegating actual addition/deletion of objects
30 * to the registry service.
31 * <p>To avoid loops, a RegistryService implementation using this class
32 * nees to call the addLocalEntry/removeLocalEntry methods to modify
33 * the in memory state of this Registry</p>
34 *
35 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
36 * @version $Id: BasePortletControllerRegistry.java,v 1.4 2004/02/23 03:08:26 jford Exp $
37 */
38 public class BasePortletControllerRegistry extends BaseRegistry
39 {
40
41 /***
42 * Static initialization of the logger for this class
43 */
44 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(BasePortletControllerRegistry.class.getName());
45
46 /***
47 @see Registry#setEntry
48 */
49 public void setEntry( RegistryEntry entry ) throws InvalidEntryException
50 {
51
52
53
54 try
55 {
56 Registry.addEntry(Registry.PORTLET_CONTROLLER, entry);
57 }
58 catch (RegistryException e)
59 {
60 logger.error("Exception", e);
61 }
62 }
63
64 /***
65 @see Registry#addEntry
66 */
67 public void addEntry( RegistryEntry entry ) throws InvalidEntryException
68 {
69
70
71
72 try
73 {
74 Registry.addEntry(Registry.PORTLET_CONTROLLER, entry);
75 }
76 catch (RegistryException e)
77 {
78 logger.error("Exception", e);
79 }
80 }
81
82 /***
83 @see Registry#removeEntry
84 */
85 public void removeEntry( String name )
86 {
87
88
89
90 Registry.removeEntry(Registry.PORTLET_CONTROLLER, name);
91 }
92
93 /***
94 @see Registry#removeEntry
95 */
96 public void removeEntry( RegistryEntry entry )
97 {
98
99
100
101 if (entry != null)
102 {
103 Registry.removeEntry(Registry.PORTLET_CONTROLLER, entry.getName());
104 }
105 }
106
107 /***
108 * Creates a new RegistryEntry instance compatible with the current
109 * Registry instance implementation
110 *
111 * @return the newly created RegistryEntry
112 */
113 public RegistryEntry createEntry()
114 {
115 return new BasePortletControllerEntry();
116 }
117 }