Package org.apache.jetspeed.portal

Examples of org.apache.jetspeed.portal.PortletException


           
            contentStale = true;
            initDone = true;
        } catch (Exception e) {
            logger.info("Exception occurred:" + e.toString(), e);
            throw new PortletException( e.toString() );
        }
    }
View Full Code Here


    }
    catch (Exception e)
    {
      logger.info("Exception occurred:" + e.toString());
      e.printStackTrace();
      throw new PortletException(e.toString());
    }
  }
View Full Code Here

            contentStale = true;
            initDone = true;
        } catch (Exception e) {
            Log.info("Exception occurred:" + e.toString());
            e.printStackTrace();
            throw new PortletException( e.toString() );
        }
    }
View Full Code Here

    {
        PortletEntry regEntry = (PortletEntry)Registry.getEntry(Registry.PORTLET,
                                                                entry.getParent() );
        if (regEntry == null)
        {
            throw new PortletException("PortletFactory: unknown portlet entry in Registry: "+entry.getParent());
        }
       
        if (PortletEntry.TYPE_ABSTRACT.equals(regEntry.getType()))
        {
            throw new PortletException("PortletFactory: can't instanciate abstract registry entry: "+regEntry.getName());
        }
           
        PortletConfig pc = getPortletConfig(regEntry, entry.getId());

        // Set portlet config with values from PSML Entry
View Full Code Here

    {
        PortletEntry regEntry = (PortletEntry)Registry.getEntry(Registry.PORTLET, name );

        if (regEntry == null)
        {
            throw new PortletException("PortletFactory: unknown portlet entry in Registry: "+name);
        }
       
        if (PortletEntry.TYPE_ABSTRACT.equals(regEntry.getType()))
        {
            throw new PortletException("PortletFactory: can't instanciate abstract registry entry: "+name);
        }
           
        PortletConfig pc = getPortletConfig(regEntry, id);
       
        return getPortlet( getClassname(regEntry), pc, null );
View Full Code Here

        {
            portletClass = Class.forName(classname);
        }
        catch (Exception e)
        {
            throw new PortletException( "PortletFactory: Unable to load class " + classname );
        }
       
        if (enableCache)
        {
            try
            {
                // try to invoke a static getHandle() for this class
                Class[] signatureParams = { Object.class };
                Object[] methodParams = { pc };
                handle = (String)portletClass.getMethod("getHandle",signatureParams)
                                             .invoke(null,methodParams);
                // make sure the handle is differenciated by class
                handle = String.valueOf(classname.hashCode())+handle;
            }
            catch (NoSuchMethodException e)
            {
                // ignore, this simply means the portlet is not cacheable
            }
            catch (Exception e)
            {
                // invocation failed or security exception, in both case
                // log the error and treat the class as non cacheable
                Log.error("PortletFactory: failed to get cache handle",e);
            }
        }
       
        try {

            if (enableCache && (handle != null))
            {
                portlet = (Portlet)PortletCache.getCacheable( handle );

                //portlet in cache but expired, remove it from cache
                if ((portlet!=null) && ((Cacheable)portlet).getExpire().isExpired() )
                {
                    Log.info( "The portlet (" + handle + ") is expired" );
                    PortletCache.removeCacheable(handle);
                    Log.debug( "After removal of object(" + handle + ")." );
                    portlet = null;
                }
            }

            // we found a portlet in the cache
            if ( (portlet != null)
                 && ( portlet instanceof Cacheable )
                 && (! ((Cacheable)portlet).getExpire().isExpired()) )
            {
                // update the config for the portlet to the current one
                // Note: this is what was used to find the cached portlet.
                // Note: the init params may have changed in the psml since caching,
                //       this will update the portlet to use them.
                portlet.setPortletConfig( pc );
                portlet.setID( id );
                portlet.setName( pc.getName() );

                //FIXME: we now avoid to override metainfo when nothing is set
                //in the markup, so that cached portlets can keep their metainfo
                //This may lead to an incorrect metainfo retrieved if the first
                //instance of the portlet, which is put in the cache, has some
                //special metainfo defined in the markup

                MetaData meta = pc.getMetainfo();
               
                if ( meta != null)
                {

                    if (! MetaData.DEFAULT_TITLE.equals( meta.getTitle() ) )
                    {
                        portlet.setTitle( meta.getTitle() );
                    }
   
                    if (! MetaData.DEFAULT_DESCRIPTION.equals( meta.getDescription() ) )
                    {
                        portlet.setDescription( meta.getDescription() );
                    }
                }

                //FIXME: Notice here we are putting the portlet without wrapper
                //in the cache, and we must wrap it on return.
                //Security implications: the portletcache should not be
                //publicly accessible.
                //Alternative: we could wrap the portlet before putting
                //it in the cache.

                //now compute the time it took to instantate and log it...
                // time in millis, sugested by Thomas Schaeck (schaeck@de.ibm.com)
                long milliseconds = ( System.currentTimeMillis() - begin );
       
                if (Log.getLogger().isDebugEnabled())
                    Log.debug( "PortletFactory.getPortlet(): found in cache in "
                        + milliseconds + " ms - handle: " + handle );

                return PortletWrapper.wrap( portlet );
            }

            // if not found in the cache, instanciate a new Portlet
            portlet = (Portlet)portletClass.newInstance();

        }
        catch ( Throwable t )
        {
            Log.error( t );
            throw new PortletException( t.getMessage() );
        }

        // save the current meta-info
        String title = null;
        String description = null;
View Full Code Here

            contentStale = true;
            initDone = true;
        } catch (Exception e) {
            Log.info("Exception occurred:" + e.toString());
            e.printStackTrace();
            throw new PortletException( e.toString() );
        }
    }
View Full Code Here

            }

        }
        catch (Exception e)
        {
            throw new PortletException(e.getMessage());
        }
    }
View Full Code Here

        catch (Throwable t)
          {

            String message = "RSSPortlet:  Couldn't parse out XML document -> " + url;
            Log.error(message, t);
            throw new PortletException(t.getMessage());
          }

        //Determine title and description for this portlet
        String title = null;
        String description = null;

        //now find the channel node.
        Node channel = null;
        NodeList list = document.getElementsByTagName("channel");

        if (list.getLength() != 1)
          {
            throw new PortletException(ERROR_NOT_VALID);
          }

        channel = list.item(0);

        Node tn = getNode(channel, "title");

        if (tn == null)
          {
            throw new PortletException(ERROR_NOT_VALID);
          }
        else
          {
            title = tn.getFirstChild().getNodeValue();
          }
View Full Code Here

    }
    catch (Exception e)
    {
      logger.info("Exception occurred:" + e.toString());
      e.printStackTrace();
      throw new PortletException(e.toString());
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.portal.PortletException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.