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:24:25 UTC

cvs commit: jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/registry JetspeedPortletRegistry.java PortletRegistryService.java

weaver      2004/02/04 13:24:25

  Modified:    services/registry/src/java/org/apache/jetspeed/registry
                        JetspeedPortletRegistry.java
                        PortletRegistryService.java
  Log:
  - added object implementation factory logic
  - removed class specific "new" methods
  - Add Tx associated methods like "makeDirty" and writeLock
  
  Revision  Changes    Path
  1.2       +36 -79    jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/registry/JetspeedPortletRegistry.java
  
  Index: JetspeedPortletRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/registry/JetspeedPortletRegistry.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JetspeedPortletRegistry.java	12 Jan 2004 06:19:51 -0000	1.1
  +++ JetspeedPortletRegistry.java	4 Feb 2004 21:24:25 -0000	1.2
  @@ -59,12 +59,10 @@
   
   import org.apache.jetspeed.cps.CommonPortletServices;
   import org.apache.jetspeed.exception.RegistryException;
  -import org.apache.jetspeed.om.common.MutableLanguage;
  -import org.apache.jetspeed.om.common.portlet.ContentTypeComposite;
   import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
   import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
  -import org.apache.jetspeed.om.common.preference.PreferenceComposite;
  -import org.apache.jetspeed.om.common.servlet.MutableWebApplication;
  +
  +import org.apache.jetspeed.persistence.LookupCriteria;
   import org.apache.jetspeed.persistence.TransactionStateException;
   
   import org.apache.pluto.om.common.Language;
  @@ -82,6 +80,16 @@
   public class JetspeedPortletRegistry
   {
   
  +	public static Object getNewObjectInstance(String interfaze, boolean persistent) throws RegistryException, TransactionStateException
  +	{
  +		return getService().getNewObjectInstance(interfaze, persistent);
  +	}
  +	
  +	public static Object getNewObjectInstance(Class interfaze, boolean persistent) throws RegistryException, TransactionStateException
  +	{
  +		return getService().getNewObjectInstance(interfaze, persistent);
  +	}
  +
       /**
        * @see org.apache.jetspeed.services.registry.PortletRegistryService#getAllPortletDefinitions()
        */
  @@ -120,22 +128,6 @@
       }
   
       /**
  -     * @see org.apache.jetspeed.services.registry.PortletRegistryService#newContentType()
  -     */
  -    public static ContentTypeComposite newContentType()
  -    {
  -        return getService().newContentType();
  -    }
  -
  -    /**
  -     * @see org.apache.jetspeed.services.registry.PortletRegistryService#newLanguage()
  -     */
  -    public static MutableLanguage newLanguage()
  -    {
  -        return getService().newLanguage();
  -    }
  -
  -    /**
        * @see org.apache.jetspeed.services.registry.PortletRegistryService#createLanguage(java.util.Locale, java.lang.String, java.lang.String, java.lang.String)
        */
       public static Language createLanguage(
  @@ -143,41 +135,12 @@
           String title,
           String shortTitle,
           String description,
  -        Collection keywords)
  +        Collection keywords) throws RegistryException
       {
           return getService().createLanguage(locale, title, shortTitle, description, keywords);
       }
   
       /**
  -     * @see org.apache.jetspeed.services.registry.PortletRegistryService#newPortletApplication()
  -     */
  -    public static MutablePortletApplication newPortletApplication()
  -    {
  -        return getService().newPortletApplication();
  -    }
  -
  -    /**
  -     * @see org.apache.jetspeed.services.registry.PortletRegistryService#newPortletDefinition()
  -     */
  -    public static PortletDefinitionComposite newPortletDefinition()
  -    {
  -        return getService().newPortletDefinition();
  -    }
  -
  -    /**
  -     * @see org.apache.jetspeed.services.registry.PortletRegistryService#newWebApplication()
  -     */
  -    public static MutableWebApplication newWebApplication()
  -    {
  -        return getService().newWebApplication();
  -    }
  -
  -    public static PreferenceComposite newPreference()
  -    {
  -        return getService().newPreference();
  -    }
  -
  -    /**
        * @see org.apache.jetspeed.services.registry.PortletRegistryService#registerPortletApplication(org.apache.pluto.om.portlet.PortletApplicationDefinition)
        */
       public static void registerPortletApplication(PortletApplicationDefinition newApp)
  @@ -188,16 +151,6 @@
       }
   
       /**
  -      * @see org.apache.jetspeed.services.registry.PortletRegistryService#registerPortletApplication(org.apache.pluto.om.portlet.PortletApplicationDefinition, java.lang.String)
  -      */
  -    public static void registerPortletApplication(PortletApplicationDefinition newApp, String system)
  -        throws RegistryException
  -    {
  -        getService().registerPortletApplication(newApp, system);
  -
  -    }
  -
  -    /**
        * @see org.apache.jetspeed.services.registry.PortletRegistryService#removeApplication(org.apache.pluto.om.portlet.PortletApplicationDefinition)
        */
       public static void removeApplication(PortletApplicationDefinition app) throws RegistryException, TransactionStateException
  @@ -253,30 +206,24 @@
       {
           return getService().portletDefinitionExists(portletName, app);
       }
  +    
  +    public static List getPortletInitParameters(LookupCriteria c)
  +    {
  +    	return getService().getPortletInitParameters(c);
  +    }
  +    
  +	public static void clearCache()
  +	{
  +		getService().clearCache();
  +	}
   
       private static final PortletRegistryService getService()
       {
           return (PortletRegistryService) CommonPortletServices.getPortalService(
               PortletRegistryService.SERVICE_NAME);
  -    }
  -
  -    /**
  -     * @see org.apache.jetspeed.services.registry.PortletRegistryService#setDeploymentSystem(java.lang.String, java.lang.String)
  -     *
  -     */
  -    public static void setDeploymentSystem(String system, String alias)
  -    {
  -        getService().setDeploymentSystem(system, alias);
  -    }
  -
  -    /**
  -     * @see org.apache.jetspeed.services.registry.PortletRegistryService#resetDeploymentSystem()
  -     */
  -    public static void resetDeploymentSystem()
  -    {
  -        getService().resetDeploymentSystem();
  -    }
  +    }  
       
  +
   	/**
   	 * @see org.apache.jetspeed.services.registry.PortletRegistryService#beginTransaction()
   	 */
  @@ -304,6 +251,16 @@
   	{
   		getService().rollbackTransaction();
   
  +	}
  +	
  +	public static void  writeLock(Object obj) throws TransactionStateException
  +	{
  +		getService().writeLock(obj); 
  +	}
  +	
  +	public static void  makeDirty(Object obj) throws TransactionStateException
  +	{
  +		getService().makeDirty(obj); 
   	}
   
   
  
  
  
  1.2       +49 -56    jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/registry/PortletRegistryService.java
  
  Index: PortletRegistryService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/services/registry/src/java/org/apache/jetspeed/registry/PortletRegistryService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortletRegistryService.java	12 Jan 2004 06:19:51 -0000	1.1
  +++ PortletRegistryService.java	4 Feb 2004 21:24:25 -0000	1.2
  @@ -60,12 +60,9 @@
   
   import org.apache.jetspeed.cps.CommonService;
   import org.apache.jetspeed.exception.RegistryException;
  -import org.apache.jetspeed.om.common.MutableLanguage;
  -import org.apache.jetspeed.om.common.portlet.ContentTypeComposite;
   import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
   import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
  -import org.apache.jetspeed.om.common.preference.PreferenceComposite;
  -import org.apache.jetspeed.om.common.servlet.MutableWebApplication;
  +import org.apache.jetspeed.persistence.LookupCriteria;
   import org.apache.jetspeed.persistence.TransactionStateException;
   import org.apache.pluto.om.common.Language;
   import org.apache.pluto.om.common.ObjectID;
  @@ -110,9 +107,9 @@
        * unique within it's parent application plus the parent application's
        * unique name within the portlet container using ":" as a delimiter. 
        * <br/>
  -     * <strong>FORMAT: </strong> <i>application name</i>:<i>portlet name</i>
  +     * <strong>FORMAT: </strong> <i>application name</i>::<i>portlet name</i>
        * <br/>
  -     * <strong>EXAMPLE: </strong> com.myapp.portletApp1:weather-portlet
  +     * <strong>EXAMPLE: </strong> com.myapp.portletApp1::weather-portlet
        * 
        * @param name portlets unique name.  
        * @return Portlet that matches the unique name 
  @@ -167,18 +164,6 @@
   
       List getAllPortletDefinitions();
   
  -    MutablePortletApplication newPortletApplication();
  -
  -    PortletDefinitionComposite newPortletDefinition();
  -
  -    MutableWebApplication newWebApplication();
  -
  -    PreferenceComposite newPreference();
  -
  -    ContentTypeComposite newContentType();
  -
  -    MutableLanguage newLanguage();
  -
       /**
           * Creates a new <code>PortletApplicationDefinition</code> 
           * within the Portal.          
  @@ -186,20 +171,6 @@
           */
       void registerPortletApplication(PortletApplicationDefinition newApp) throws RegistryException;
   
  -   /**
  -    * Creates a new <code>PortletApplicationDefinition</code> 
  -    * within the Portal to the system indicated.  For portals using
  -    * PersistentPortletRegistryService this is more than likely the
  -    * name of plugin other than the one the service uses by default
  -    * which in most cases points to a different RDBMS.
  -    * 
  -    * @param newApp PortletApplication to deploy
  -    * @param system "System" to deploy to.
  -    * @throws RegistryException
  -    */
  -    void registerPortletApplication(PortletApplicationDefinition newApp, String system)
  -        throws RegistryException;
  -
       /**
           * Makes any changes to the <code>PortletApplicationDefinition</code>
           * persistent.
  @@ -214,39 +185,61 @@
           String title,
           String shortTitle,
           String description,
  -        Collection keywords);
  +        Collection keywords)  throws RegistryException;
           
       /**
  -     * Changes the "system" the PortletRegistryService will use
  -     * to deploy and retreive information about the current portal and
  -     * it's portlets.  This is generally used by deployment tools needing
  -     * change system locations at run time based on specific user deployment
  -     * settings.  
  -     * <br/>
  -     * A "system" is mostly likley a peristence mechanism.  In Jetspeed's
  -     * standard operating mode, the system is actually the named of an
  -     * existing <code>PersistencePlugin</code>.  The <code>alias</code>
  -     * allows the client to change the location this plugin stores to.  For the
  -     * default Jetspeed system this is the database alias used by the peristence
  -     * plugin to make JDBC connections to.  The <code>alias</code> parameter
  -     * is optional and can be set to <code>null</code> keep the default alias.
  -     * 
  -     * @param system
  -     * @param alias
  -     */    
  -    void setDeploymentSystem(String system, String alias);
  +     * Lists  portlet init parameters within the system
  +     * @throws TransactionStateException
  +     */
  +    List getPortletInitParameters(LookupCriteria criteria);
       
       /**
  -     * Resets the deployment system to the original value it was
  -     * initialized with.
  +     * Clears the registry of any cached information.  Only
  +     * required of implementations that use caching on the
  +     * registry level.
        *
        */
  -    void resetDeploymentSystem();
  -    
  +    void clearCache();
       
       public void beginTransaction() throws TransactionStateException;
       
   	public void commitTransaction() throws TransactionStateException;
   	
   	public void rollbackTransaction() throws TransactionStateException;
  +	
  +	public void writeLock(Object object) throws TransactionStateException;
  +	
  +	public void makeDirty(Object object) throws TransactionStateException;
  +	
  +	/**
  +	 * <p>
  +	 * Creates a new instance of the <code>interfaze</code> name.  This may or may not be
  +	 * an ectual interface class, it may be a symbolic name.  The reason for this is that an
  +	 * interface may have multiple implementations that can be used concurrently.
  +	 * </p>
  +	 * <p>
  +	 *  Specifying <code>persistent</code> create the object and invoke the
  +	 *  <code>writeLock()</code> method on it.  This can only be done after
  +	 *  <code>beginTransaction()</code> has been called, otherwise a TransactionStateException
  +	 * will be thrown.
  +	 * </p>
  +	 * @param interfaze Interface FQN or a sysmbolic name. 
  +	 * @param persistent <code>true</code> will write lock the new object within the 
  +	 * existing transaction, <code>false</code> will not.
  +	 * @return a new object instance
  +	 * @throws RegistryException
  +	 * @throws TransactionStateException
  +	 */
  +	public Object getNewObjectInstance(String interfaze, boolean persistent) throws RegistryException, TransactionStateException;
  +    
  +    /**
  +     * Equivalent to calling: <code>getNewObjectInstance(interface.getName(), boolean)</code>
  +     * @param interfaze
  +     * @param persistent
  +     * @return
  +     * @throws RegistryException
  +     * @throws TransactionStateException
  +     */
  +	public Object getNewObjectInstance(Class interfaze, boolean persistent) throws RegistryException, TransactionStateException;
  +	
   }
  
  
  

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