portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/modules/actions/portlets RegisterPortletApplicationAction.java
Date Thu, 05 Aug 2004 19:58:45 GMT
taylor      2004/08/05 12:58:45

  Modified:    fusion/src/java/org/apache/jetspeed/fusion/modules/actions/portlets
                        RegisterPortletApplicationAction.java
  Log:
  added support for re-registration of PAs
  
  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.4       +33 -10    jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/modules/actions/portlets/RegisterPortletApplicationAction.java
  
  Index: RegisterPortletApplicationAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/modules/actions/portlets/RegisterPortletApplicationAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RegisterPortletApplicationAction.java	3 Aug 2004 05:06:16 -0000	1.3
  +++ RegisterPortletApplicationAction.java	5 Aug 2004 19:58:44 -0000	1.4
  @@ -167,6 +167,18 @@
       public void doInsert(RunData rundata, Context context)
           throws Exception
       {
  +        processRegistration(rundata, context, true);
  +    }
  +    
  +    public void doUpdate(RunData rundata, Context context)
  +    throws Exception
  +    {
  +        processRegistration(rundata, context, false);
  +    }
  +    
  +    private void processRegistration(RunData rundata, Context context, boolean insert)
  +        throws Exception
  +    {
           PortletApplicationViewBean bean = null;
           String name = rundata.getParameters().getString("name");
           String pacontext = rundata.getParameters().getString("context");           
  @@ -184,16 +196,26 @@
           }
   
           PortletApplicationViewBean dup = this.getPortletApplication(name);
  -        if (dup != null)
  +        if (insert)
           {
  -            redirect(rundata, SecurityConstants.MID_ENTITY_ALREADY_EXISTS);
  -            storeBean(rundata, new PortletApplicationViewBean(name, pacontext));
  -            return;               
  +            if (dup != null)
  +            {
  +                redirect(rundata, SecurityConstants.MID_ENTITY_ALREADY_EXISTS);
  +                storeBean(rundata, new PortletApplicationViewBean(name, pacontext));
  +                return;               
  +            }
  +        }
  +        else
  +        {
  +            if (dup == null)
  +            {
  +                redirect(rundata, SecurityConstants.MID_INVALID_ENTITY_NAME);
  +                storeBean(rundata, new PortletApplicationViewBean(name, pacontext));
  +                return;                               
  +            }
           }
           
           bean = new PortletApplicationViewBean(name, pacontext);
  -        System.out.println("Adding PA here: name    = " + name);
  -        System.out.println("Adding PA here: context = " + pacontext);
   
           ServletContext webContext = rundata.getServletContext().getContext(pacontext);
           InputStream portletXml = null;
  @@ -244,9 +266,12 @@
           {
               webXml.close();
           }
  -        System.out.println("Registering " + name);
           try
           {
  +            if (false == insert) // update mode
  +            {
  +                ((Registration)getRegistrationComponent()).unregister(name);
  +            }
               getRegistrationComponent().registerPortletApplication(name, pacontext, webContext);
           }
           catch (Throwable t)
  @@ -254,9 +279,7 @@
               redirect(rundata, SecurityConstants.MID_FAILED_REGISTER_PA);
               storeBean(rundata, bean);
           }
  -        System.out.println("Done registering ");
       }
  -
   
       /**
        * Database Delete Action for Security Groups. Performs deletes into security database.
  
  
  

---------------------------------------------------------------------
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