You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by we...@apache.org on 2004/02/04 22:22:21 UTC

cvs commit: jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/om/servlet/impl WebApplicationDefinitionImpl.java

weaver      2004/02/04 13:22:21

  Modified:    services/registry/src/java/org/apache/jetspeed/om/servlet/impl
                        WebApplicationDefinitionImpl.java
  Log:
  - refactored to support the new non-OJB collections
  
  Revision  Changes    Path
  1.2       +52 -14    jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/om/servlet/impl/WebApplicationDefinitionImpl.java
  
  Index: WebApplicationDefinitionImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/om/servlet/impl/WebApplicationDefinitionImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WebApplicationDefinitionImpl.java	12 Jan 2004 06:19:51 -0000	1.1
  +++ WebApplicationDefinitionImpl.java	4 Feb 2004 21:22:21 -0000	1.2
  @@ -54,19 +54,21 @@
   package org.apache.jetspeed.om.servlet.impl;
   
   import java.io.Serializable;
  +import java.util.ArrayList;
  +import java.util.Collection;
   import java.util.Locale;
   
   import javax.servlet.ServletContext;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.jetspeed.om.common.MutableDescription;
  -import org.apache.jetspeed.om.common.MutableDescriptionSet;
   import org.apache.jetspeed.om.common.MutableDisplayName;
  -import org.apache.jetspeed.om.common.MutableDisplayNameSet;
   import org.apache.jetspeed.om.common.servlet.MutableWebApplication;
   import org.apache.jetspeed.om.impl.DescriptionImpl;
   import org.apache.jetspeed.om.impl.DescriptionSetImpl;
  -import org.apache.jetspeed.om.impl.DisplayNameImpl;
   import org.apache.jetspeed.om.impl.DisplayNameSetImpl;
  +import org.apache.jetspeed.registry.JetspeedPortletRegistry;
   import org.apache.jetspeed.util.JetspeedObjectID;
   import org.apache.pluto.om.common.Description;
   import org.apache.pluto.om.common.DescriptionSet;
  @@ -88,11 +90,17 @@
   {
   
       private int id;
  -    private MutableDisplayNameSet displayNames;
  -    private MutableDescriptionSet descriptions;
  +    private Collection displayNames = new ArrayList();
  +    private DisplayNameSetImpl DNCollWrapper = new DisplayNameSetImpl();
  +
  +    private Collection descriptions = new ArrayList();
  +    private DescriptionSetImpl descCollWrapper = new DescriptionSetImpl(DescriptionImpl.TYPE_WEB_APP);
  +
       private String contextRoot;
       private ParameterSet initParameters;
   
  +    private static final Log log = LogFactory.getLog(WebApplicationDefinitionImpl.class);
  +
       /**
        * @see org.apache.pluto.om.servlet.WebApplicationDefinition#getId()
        */
  @@ -109,7 +117,8 @@
   
           if (displayNames != null)
           {
  -            return displayNames.get(locale);
  +            DNCollWrapper.setInnerCollection(displayNames);
  +            return DNCollWrapper.get(locale);
           }
           return null;
   
  @@ -122,7 +131,8 @@
       {
           if (descriptions != null)
           {
  -            return descriptions.get(locale);
  +            descCollWrapper.setInnerCollection(descriptions);
  +            return descCollWrapper.get(locale);
           }
           return null;
   
  @@ -175,7 +185,7 @@
        */
       public void setDisplayNameSet(DisplayNameSet displayNames)
       {
  -        this.displayNames = (MutableDisplayNameSet) displayNames;
  +        this.displayNames = ((DisplayNameSetImpl) displayNames).getInnerCollection();
       }
   
       /**
  @@ -193,9 +203,23 @@
       {
           if (descriptions == null)
           {
  -            descriptions = new DescriptionSetImpl(MutableDescription.TYPE_WEB_APP);
  +            descriptions = new ArrayList();
  +        }
  +        descCollWrapper.setInnerCollection(descriptions);
  +        try
  +        {
  +            MutableDescription descObj =
  +                (MutableDescription) JetspeedPortletRegistry.getNewObjectInstance(MutableDescription.TYPE_WEB_APP, true);
  +            descObj.setLocale(locale);
  +            descObj.setDescription(description);
  +            descCollWrapper.addDescription(descObj);
  +        }
  +        catch (Exception e)
  +        {
  +            String msg = "Unable to instantiate Description implementor, " + e.toString();
  +            log.error(msg, e);
  +            throw new IllegalStateException(msg);
           }
  -        descriptions.addDescription(new DescriptionImpl(locale, description, MutableDescription.TYPE_WEB_APP));
       }
   
       /**
  @@ -205,9 +229,23 @@
       {
           if (displayNames == null)
           {
  -            displayNames = new DisplayNameSetImpl(MutableDisplayName.TYPE_WEB_APP);
  +            displayNames = new ArrayList();
  +        }
  +        DNCollWrapper.setInnerCollection(displayNames);
  +        try
  +        {
  +            MutableDisplayName dn =
  +                (MutableDisplayName) JetspeedPortletRegistry.getNewObjectInstance(MutableDisplayName.TYPE_WEB_APP, false);
  +            dn.setLocale(locale);
  +            dn.setDisplayName(name);
  +            DNCollWrapper.addDisplayName(dn);
  +        }
  +        catch (Exception e)
  +        {
  +            String msg = "Unable to instantiate DisplayName implementor, " + e.toString();
  +            log.error(msg, e);
  +            throw new IllegalStateException(msg);
           }
  -        displayNames.addDisplayName(new DisplayNameImpl(locale, name, MutableDisplayName.TYPE_WEB_APP));
   
       }
   
  @@ -216,7 +254,7 @@
        */
       public void setDescriptionSet(DescriptionSet descriptions)
       {
  -        this.descriptions = (MutableDescriptionSet) descriptions;
  +        this.descriptions = ((DescriptionSetImpl) descriptions).getInnerCollection();
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org