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