Package org.apache.jetspeed.portal

Examples of org.apache.jetspeed.portal.PortletException


        PortletConfig config = this.getPortletConfig();
       
        provider = config.getInitParameter( PROVIDER_NAME_KEY );
       
        if ( provider == null ) {
            throw new PortletException( "You need to specify " + PROVIDER_NAME_KEY );
        }

        //NOTE:  There are no HARD keys here in JetspeedResources.  If you change
        //this format of this it will break at runtime.  CAREFULL!
       
        this.url = JetspeedResources.getString( "content.provider." + provider + ".url" );
       
        this.stylesheet = JetspeedResources.getString( "content.provider." + provider + ".stylesheet.url" );
       
        String title = JetspeedResources.getString( "content.provider." + provider + ".title" );

        String description = JetspeedResources.getString( "content.provider." + provider + ".description" );

        this.setTitle( title );
        this.setDescription( description );
      
        this.setContent( this.parse( url ) );
           
        //now make sure all the above 4 values are define within JetspeedResources
        if ( url == null ||
             stylesheet == null ||
             title == null ||
             description == null ) {
            throw new PortletException( "Not all properties defined in JetspeedResources.  See JetspeedResources.properties notes." );
        }
       
        this.getPortletConfig().setURL( url );
       
        //set the last modification date for this file so that if it is
View Full Code Here


        this.stylesheet = JetspeedDiskCache.getInstance()
            .getEntry( this.stylesheet ).getURL();
        } catch (IOException e) {
            logger.error( "Couldn't transform content.", e );
            throw new PortletException( "Couldn't transform content.  Please see error log" );
        }

       
        try {
           
            return new JetspeedClearElement( SimpleTransform.transform( url, stylesheet ) );
           
        } catch (SAXException e) {
            logger.error( "Couldn't transform content.", e );
            throw new PortletException( "Couldn't transform content.  Please see error log" );
        }

      
    }
View Full Code Here

            }

            //if it is still null something is wrong
            if ( screen == null )
            {
                throw new PortletException( "You need to specify a " + SCREEN + " parameter for this portlet" );
            }

            /* Save the parameters if any */
            String param = null;
            String value = null;
            java.util.Map dict = pc.getInitParameters();
            Iterator en = dict.keySet().iterator();
            int index = -1;
            String tParam = screen + ".param";
            String newParam = null;
            paramSet = new Hashtable();
            while ( en.hasNext() )
            {
                param = ( String ) en.next();
                index = param.indexOf( tParam );
                if ( index != -1 )
                {
                    value = ( String ) dict.get( param );
                    if ( value == null )
                    {
                        throw new PortletException( "Could not retrieve value for " + param );
                    }
                    newParam = param.substring( index + tParam.length() + 1 );
                    paramSet.put( newParam, value );
                }
            }
View Full Code Here

            String message = "RSSPortlet:  Couldn't parse out XML document -> " +
                              url;

            logger.error( message, t );
            throw new PortletException( t.getMessage() );

        }

        //SGP giving NullPointer
        try {
            //now that we have the document set the items for this

            this.setItems( this.parseItems( document ) );

            String title = null;
            String description = null;

            //this a hack until DOM2 namespace support becomes better in Xerces.
            Node root = document.getFirstChild();
            //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();
            }

            Node dn = getNode( channel, "description" );

            if ( dn != null ) {
                description = dn.getFirstChild().getNodeValue();
            }

            this.setTitle( title );
            this.setDescription( description );


            //now that we have the DOM we should be able to do a transform here.

            String stylesheet = this.getPortletConfig().getInitParameter( "stylesheet" );

            if ( stylesheet == null ) {
                throw new PortletException( "The 'stylesheet' parameter was not defined." );
        }

            try {
                //Set encoding for the document to utf-8...
                String content = SimpleTransform.transform( document,
                                                            stylesheet,
                                                            this.getPortletConfig().getInitParameters() );

                this.setContent( new JetspeedClearElement( content ) );


            } catch ( SAXException e ) {
                logger.error("Exception",  e);
                throw new PortletException( e.getMessage() );
            }
        } catch (Throwable t) {
            String message = "RSSPortlet:  Couldn't set items for XML document -> " +
                url;


            logger.error( message, t );
            throw new PortletException( t.getMessage() );
        }


    }
View Full Code Here

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

        catch (Throwable t)
        {

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

    }
View Full Code Here

            String message = "RSSPortlet:  Couldn't parse out XML document -> " +
                              url;

            logger.error( message, t );
            throw new PortletException( t.getMessage() );
        }


    }
View Full Code Here

        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
        {
            Node fc = tn.getFirstChild();
            if (fc != null)
View Full Code Here

        Node channel = null;
        NodeList list = this.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
        {
            Node fc = tn.getFirstChild();
            if (fc != null)
View Full Code Here

        }
        catch (Exception e)
        {
            logger.error("Exception in init()", e);
            throw new PortletException(e.getMessage());
        }
    }
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.