taylor      2004/07/19 21:09:54

  Modified:    src/java/org/apache/jetspeed/services/registry
                        HybridRegistryService.java
  Log:
  adding support for portlet registry
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.7       +50 -15    
jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry/HybridRegistryService.java
  
  Index: HybridRegistryService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/registry/HybridRegistryService.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HybridRegistryService.java        19 Jul 2004 04:25:09 -0000      1.6
  +++ HybridRegistryService.java        20 Jul 2004 04:09:54 -0000      1.7
  @@ -24,7 +24,9 @@
   
   import javax.servlet.ServletConfig;
   
  +import org.apache.jetspeed.om.dbregistry.PortletDbEntryPeer;
   import org.apache.jetspeed.om.dbregistry.SecurityDbEntryPeer;
  +import org.apache.jetspeed.om.registry.PortletEntry;
   import org.apache.jetspeed.om.registry.Registry;
   import org.apache.jetspeed.om.registry.RegistryEntry;
   import org.apache.jetspeed.om.registry.RegistryException;
  @@ -85,7 +87,7 @@
           }
           catch (Throwable t)
           {
  -            throw new InitializationException("Unable to initialize 
HybridRegistryService, missing config keys");
  +            throw new InitializationException("Unable to initialize 
HybridRegistryService: " + t.toString());
           }
           setInit(true);        
       }
  @@ -110,6 +112,15 @@
                       local.addLocalEntry((RegistryEntry)se);                    
                   }
               }
  +            else if 
(registryName.equals(org.apache.jetspeed.services.Registry.PORTLET))
  +            {
  +                Iterator extent = PortletDbEntryPeer.fetchExtent().iterator();      
          
  +                while (extent.hasNext())
  +                {
  +                    PortletEntry pe = (PortletEntry)extent.next();
  +                    local.addLocalEntry((RegistryEntry)pe);                    
  +                }                
  +            }
           }
           catch (Throwable t)
           {
  @@ -209,22 +220,26 @@
               if (registryName.equals(org.apache.jetspeed.services.Registry.SECURITY))
               {                                         
                   entry = 
(RegistryEntry)SecurityDbEntryPeer.lookupSecurityEntry(entryName);
  -                if (entry != null)
  +            }
  +            else if 
(registryName.equals(org.apache.jetspeed.services.Registry.PORTLET))
  +            {                                         
  +                entry = 
(RegistryEntry)PortletDbEntryPeer.lookupPortletEntry(entryName);
  +            }
  +            if (entry != null)
  +            {
  +                LocalRegistry local = (LocalRegistry)registry;
  +                try
                   {
  -                    LocalRegistry local = (LocalRegistry)registry;
  -                    try
  -                    {
  -                        local.addEntry(entry);
  -                    }
  -                    catch (RegistryException e)
  +                    local.addEntry(entry);
  +                }
  +                catch (RegistryException e)
  +                {
  +                    if (logger.isInfoEnabled())
                       {
  -                        if (logger.isInfoEnabled())
  -                        {
  -                            logger.info("HybridRegistryService: Failed to add to 
local cache " + entryName + " from " + registryName);
  -                        }                                    
  -                    }
  +                        logger.info("HybridRegistryService: Failed to add to local 
cache " + entryName + " from " + registryName);
  +                    }                                    
                   }
  -            }
  +            }                
           }
           else
           {
  @@ -274,6 +289,11 @@
                       SecurityDbEntryPeer.removeSecurityEntry(entryName);        
                       registry.removeLocalEntry(entryName);
               }
  +            else if 
(registryName.equals(org.apache.jetspeed.services.Registry.SECURITY))
  +            {
  +                PortletDbEntryPeer.removePortletEntry(entryName);        
  +                registry.removeLocalEntry(entryName);                
  +            }
           }
           catch (RegistryException e)
           {
  @@ -315,6 +335,21 @@
               {
                   registry.addLocalEntry((RegistryEntry)se);
               }
  +        }
  +        else if (entry instanceof PortletEntry)
  +        {
  +            PortletEntry pe = (PortletEntry)entry;
  +            
  +            PortletDbEntryPeer.storePortletEntry(pe);
  +            pe = PortletDbEntryPeer.lookupPortletEntry(pe.getName());        
  +            if (registry.hasEntry(entry.getName()))
  +            {
  +                registry.setLocalEntry((RegistryEntry)pe);
  +            }
  +            else
  +            {
  +                registry.addLocalEntry((RegistryEntry)pe);
  +            }            
           }
           
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to