portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletregsitry PortletRegistryComponent.java PortletRegistryComponentImpl.java
Date Mon, 23 Feb 2004 13:13:17 GMT
weaver      2004/02/23 05:13:17

  Modified:    components/registry/src/java/org/apache/jetspeed/components/portletregsitry
                        PortletRegistryComponent.java
                        PortletRegistryComponentImpl.java
  Log:
  - Removed OM factory
  - added the use of  storeable delegate for portlets
  
  Revision  Changes    Path
  1.2       +21 -1     jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletregsitry/PortletRegistryComponent.java
  
  Index: PortletRegistryComponent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletregsitry/PortletRegistryComponent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortletRegistryComponent.java	22 Feb 2004 22:40:01 -0000	1.1
  +++ PortletRegistryComponent.java	23 Feb 2004 13:13:17 -0000	1.2
  @@ -113,6 +113,9 @@
       /**
        * Locates a portlet using it's unique <code>indentifier</code> 
        * field.
  +     * <br/>
  +     * This method automatically calls {@link getStoreableInstance(PortletDefinitionComposite
portlet)}
  +     * on the returned <code>PortletEntityInstance</code>
        * @param ident Unique id for this portlet
        * @return Portlet matching this unique id.
        */
  @@ -125,7 +128,9 @@
        * <strong>FORMAT: </strong> <i>application name</i>::<i>portlet
name</i>
        * <br/>
        * <strong>EXAMPLE: </strong> com.myapp.portletApp1::weather-portlet
  -     * 
  +     * <br/>
  +     * This methos automatically calls {@link getStoreableInstance(PortletDefinitionComposite
portlet)}
  +     * on the returned <code>PortletEntityInstance</code> 
        * @param name portlets unique name.  
        * @return Portlet that matches the unique name 
        */
  @@ -169,5 +174,20 @@
           * @param app
           */
       void updatePortletApplication(PortletApplicationDefinition app) throws RegistryException;
  +    
  +    /**
  +     * 
  +     * <p>
  +     * getStoreableInstance
  +     * </p>
  +     * Wraps the <code>PortletDefinitionComposite</code>
  +     * in an instance that correctly implements the 
  +     * <code>store()</code> method;
  +     * 
  +     * @param portlet
  +     * @return
  +     *
  +     */
  +	PortletDefinitionComposite getStoreableInstance(PortletDefinitionComposite portlet);
   
   }
  
  
  
  1.2       +26 -25    jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletregsitry/PortletRegistryComponentImpl.java
  
  Index: PortletRegistryComponentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletregsitry/PortletRegistryComponentImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortletRegistryComponentImpl.java	22 Feb 2004 22:40:01 -0000	1.1
  +++ PortletRegistryComponentImpl.java	23 Feb 2004 13:13:17 -0000	1.2
  @@ -62,6 +62,10 @@
   import org.apache.jetspeed.om.common.MutableLanguage;
   import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
   import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
  +import org.apache.jetspeed.om.impl.LanguageImpl;
  +import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
  +import org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl;
  +import org.apache.jetspeed.om.portlet.impl.StoreablePortletDefinitionDelegate;
   import org.apache.jetspeed.components.persistence.store.Filter;
   import org.apache.jetspeed.components.persistence.store.PersistenceStore;
   import org.apache.jetspeed.components.persistence.store.PersistenceStoreContainer;
  @@ -113,43 +117,27 @@
   
       protected static final String KEY_STORE_NAME = "persistence.store.name";
       private PersistenceStoreContainer storeContainer;
  -        private String jetspeedStoreName;
  +    private String jetspeedStoreName;
       private Class portletDefClass;
       private Class portletAppClass;
  -    private OMFactory omFactory;
   
       /**
        * 
        */
  -    public PortletRegistryComponentImpl(PersistenceStoreContainer storeContainer, String
keyStoreName, OMFactory omFactory)
  -        throws RegistryException
  +    public PortletRegistryComponentImpl(PersistenceStoreContainer storeContainer, String
keyStoreName) throws RegistryException
       {
           if (storeContainer == null)
           {
               throw new IllegalArgumentException("storeContainer cannot be null for PortletRegistryComponentImpl");
           }
   
  -
  -
  -        if (omFactory == null)
  -        {
  -            throw new IllegalArgumentException("omFactory cannot be null for PortletRegistryComponentImpl");
  -        }
  -
           this.storeContainer = storeContainer;
  -        
  -        this.omFactory = omFactory;
  +
           jetspeedStoreName = keyStoreName;
   
  -        try
  -        {
  -            portletDefClass = omFactory.getImplementation(PortletDefinition.class);
  -            portletAppClass = omFactory.getImplementation(PortletApplicationDefinition.class);
  -        }
  -        catch (ClassNotFoundException e)
  -        {
  -            throw new RegistryException("Unable to identify implementation classes " +
e.toString(), e);
  -        }
  +        portletDefClass = PortletDefinitionImpl.class;
  +        portletAppClass = PortletApplicationDefinitionImpl.class;
  +
       }
   
       /** 
  @@ -172,7 +160,7 @@
   
           try
           {
  -            MutableLanguage lc = (MutableLanguage) omFactory.newInstance(Language.class);
  +            MutableLanguage lc = new LanguageImpl();
               lc.setLocale(locale);
               lc.setTitle(title);
               lc.setShortTitle(shortTitle);
  @@ -303,7 +291,7 @@
           Filter filter = store.newFilter();
           filter.addEqualTo("portletIdentifier", ident);
           Object query = store.newQuery(portletDefClass, filter);
  -        return (PortletDefinitionComposite) store.getObjectByQuery(query);
  +        return getStoreableInstance((PortletDefinitionComposite) store.getObjectByQuery(query));
       }
   
       /** 
  @@ -338,7 +326,7 @@
           Object query = store.newQuery(portletDefClass, filter);
           PortletDefinitionComposite pdc = (PortletDefinitionComposite) store.getObjectByQuery(query);
   
  -        return pdc;
  +        return getStoreableInstance(pdc);
       }
   
       /** 
  @@ -459,6 +447,19 @@
           catch (LockFailedException e)
           {
               throw new RegistryException("Unable to lock PortletApplicaiton for update:
" + e.toString(), e);
  +        }
  +
  +    }
  +
  +    public PortletDefinitionComposite getStoreableInstance(PortletDefinitionComposite portlet)
  +    {
  +        if (portlet != null)
  +        {
  +            return new StoreablePortletDefinitionDelegate(portlet, getPersistenceStore());
  +        }
  +        else
  +        {
  +            return null;
           }
   
       }
  
  
  

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


Mime
View raw message