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-2/commons/src/java/org/apache/jetspeed/services JetspeedPortletServices.java PortletServices.java
Date Sun, 06 Jun 2004 01:47:05 GMT
taylor      2004/06/05 18:47:05

  Modified:    commons/src/java/org/apache/jetspeed/container
                        JetspeedPortletContext.java
  Added:       commons/src/java/org/apache/jetspeed/services
                        JetspeedPortletServices.java PortletServices.java
  Log:
  PortletServices interface and JetspeedPortletServices component used by 'Jetspeed-specific'
portlets to access common services
  Implemented as a Pico component, although full integration is not currently possible thus
requiring a singleton to access the service component
  
  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.5       +9 -1      jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/container/JetspeedPortletContext.java
  
  Index: JetspeedPortletContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/container/JetspeedPortletContext.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JetspeedPortletContext.java	8 Mar 2004 00:41:26 -0000	1.4
  +++ JetspeedPortletContext.java	6 Jun 2004 01:47:05 -0000	1.5
  @@ -27,6 +27,8 @@
   
   import org.apache.jetspeed.dispatcher.JetspeedRequestDispatcher;
   import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
  +import org.apache.jetspeed.services.JetspeedPortletServices;
  +import org.apache.jetspeed.services.PortletServices;
   import org.apache.jetspeed.container.namespace.NamespaceMapper;
   import org.apache.pluto.om.portlet.PortletApplicationDefinition;
   
  @@ -108,6 +110,12 @@
   
       public java.lang.Object getAttribute(java.lang.String name)
       {
  +        if (name.startsWith("cps:"))
  +        {
  +            String serviceName = name.substring("cps:".length());
  +            PortletServices services = JetspeedPortletServices.getSingleton();
  +            return services.getService(serviceName);
  +        }
           String attributeName = NamespaceMapper.encode(application.getId().toString(), name);
           Object attribute = servletContext.getAttribute(attributeName);
   
  
  
  
  1.1                  jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/services/JetspeedPortletServices.java
  
  Index: JetspeedPortletServices.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.services;
  
  import java.util.HashMap;
  import java.util.Map;
  
  
  /**
   * JetspeedPortletServices
   *
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: JetspeedPortletServices.java,v 1.1 2004/06/06 01:47:05 taylor Exp $
   */
  public class JetspeedPortletServices implements PortletServices
  {
      private Map services = new HashMap();
      private static PortletServices singleton = null;
      
      /**
       * Necessary evil until we get a PA component framework 
       * @return
       */
      public static PortletServices getSingleton()
      {
          return singleton;
      }
      
      public JetspeedPortletServices()
      {
          singleton = this;
      }
      
      /* (non-Javadoc)
       * @see org.apache.jetspeed.components.PortletServices#addPortletService(java.lang.String,
java.lang.Object)
       */
      public void addPortletService(String serviceName, Object service)
      {
          services.put(serviceName, service);
      }
  
      /* (non-Javadoc)
       * @see org.apache.jetspeed.components.PortletServices#getService(java.lang.String)
       */
      public Object getService(String serviceName)
      {
          return services.get(serviceName);
      }
  
  }
  
  
  
  1.1                  jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/services/PortletServices.java
  
  Index: PortletServices.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.services;
  
  
  /**
   * PortletServices
   *
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: PortletServices.java,v 1.1 2004/06/06 01:47:05 taylor Exp $
   */
  public interface PortletServices
  {
      void addPortletService(String serviceName, Object service);
      
      Object getService(String serviceName);
  }
  
  
  

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