raphael     2003/08/03 07:18:52

  Modified:    portal/src/java/org/apache/jetspeed/services/registry
                        JetspeedPortletRegistry.java
  Added:       portal/src/java/org/apache/jetspeed/om/page Fragment.java
                        Page.java Property.java Reference.java package.html
               portal/src/java/org/apache/jetspeed/om/page/psml
                        AbstractBaseElement.java Defaults.java
                        FragmentImpl.java PageImpl.java PropertyImpl.java
                        ReferenceImpl.java
               portal/src/test/org/apache/jetspeed/om/page
                        TestPageObjectModel.java
  Log:
  Initial commit of an updated PSML/Page manipulation API
  
  Revision  Changes    Path
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/Fragment.java
  
  Index: Fragment.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.om.page;
  
  import java.util.Map;
  import java.util.List;
  import java.util.Set;
  
  /**
   * <p>A <code>Fragment</code> is the basic element handled by the aggregation
   * engine to compose the final portal page. It represents a reserved screen
   * area whose layout is managed by a specified component.</p>
   * <p>The component that is responsible for the layout policy of the fragment
   * is defined by two properties:<p>
   * <ul>
   *   <li><b>type</b>: defines the general class of layout component, enabling
   *       the engine to retrieve its exact defintion from its component
   *       repository.
   *   </li>
   *   <li><b>name</b>: this is the exact name of the component. This name must
   *       be unique within a portal instance for a specific component type.
   *   </li>
   * </ul>
   * <p>In addition to specifying the component responsible for the layout,
   * the fragment also stores contextual information used for rendering:</p>
   * <p>Finally the fragment also holds layout and rendering properties that
   *   may be used by a parent fragment to layout all its inner fragments in
   *   an appropriate fashion. These properties are always defined for a
   *   specific named component.</p>
   *
   * @version $Id: Fragment.java,v 1.1 2003/08/03 14:18:51 raphael Exp $
   */
  public interface Fragment extends Cloneable, java.io.Serializable
  {
      /**
       * A fragment of type PORTLET is considered to be a compliant portlet
       * in the sense of the JSR 168.
       */
       public String PORTLET = "portlet";
  
      /**
       * A fragment of type LAYOUT is a specific JSR 168 compliant portlet
       * that knows how to layout a Page and depends on the Jetspeed
       * layout service.
       */
       public String LAYOUT = "layout";
  
      /**
       * Returns a unique id number for this Fragment. This ID unique
       * number is guaranteed to be unique within the portal and can be
       * used as a unique key for this Fragment.
       *
       * @return the id of the fragment as a String.
       * This id may not be null.
       */
      public String getId();
  
      /**
       * Sets a new unique id for this Fragment. This id cannot be null and
       * must be unique within the portal.
       *
       * @param id the new id for this Fragment.
       */
      public void setId(String id);
  
      /**
       * Returns the name of an ACL that governs access to the Fragment
       * and some of the navigation/editing functionalities related to this
       * fragment.
       * The ACL should be a valid reference to a security policy in the
       * portal security repository. If it's invalid or null, the portal must
       * default to the parent fragment ACL, the page default ACL or the system
       * default.
       *
       * @return the name of an ACL in the security repository.
       */
      public String getAcl();
  
      /**
       * Returns the name of an ACL that governs access to the Fragment
       * and some of the navigation/editing functionalities related to this
       * fragment.
       * The ACL should be a valid reference to a security policy in the
       * portal security repository. If it's invalid or null, the portal must
       * default to the parent fragment ACL, the page default ACL or the system
       * default.
       *
       * @return the name of an ACL in the security repository.
       */
      public void setAcl(String aclName);
  
      /**
       * Returns the administrative name of this fragment. This name should map
       * to a component name in the component repository defined by the type
       * attribute.
       * If the name is not mapped to any component, the fragment is discarded
       * from the rendering process, as well as any inner fragment.
       *
       * @return the administrative name
       */
      public String getName();
  
      /**
       * Binds an administrative name to this fragment
       *
       * @param name the administrative name
       */
      public void setName(String name);
  
      /**
       * Defines the title for this fragment
       *
       * @param title the new fragment title
       */
      public void setTitle(String title);
  
      /**
       * Returns the title of this fragment
       */
      public String getTitle();
  
      /**
       * Returns the type of the class bound to this fragment
       */
      public String getType();
  
      /**
       * Binds a type to this fragment
       *
       * @param type the type
       */
      public void setType(String type);
  
      /**
       * Returns the name of the skin associated to this fragment
       */
      public String getSkin();
  
      /**
       * Defines the skin for this fragment. This skin should be
       * known by the portal.
       *
       * @param skinName the name of the new skin applied to this fragment
       */
      public void setSkin(String skinName);
  
      /**
       * Returns the name of the decorator bound to this fragment
       */
      public String getDecorator();
  
      /**
       * Defines the decorator for this fragment. This decorator should be
       * known by the portal.
       *
       * @param decoratorName the name of the decorator applied to this fragment
       */
      public void setDecorator(String decoratorName);
  
      /**
       * Returns the display state of this fragment. This state may have the
       * following values:
       * "Normal","Minimized","Maximized","Hidden".
       */
      public String getState();
  
      /**
       * Sets the display state of this fragment.
       * Valid states are: "Normal","Minimzed","Maximized","Hidden"
       *
       * @param decoratorName the name of the decorator applied to this fragment
       */
      public void setState(String state);
  
      /**
       * Returns all fragments used in this node. This may be
       * a page fragment or even directly a portlet fragment
       *
       * @return a collection containing Fragment objects
       */
      public List getFragments();
  
      /**
       * Returns all properties describing this fragment. Only the
       * implementation of the "classname" knows how to handle the
       * properties
       *
       * @return a collection containing Property objects
       */
      public Set getLayoutProperties();
  
      /**
       * Returns all properties describing this fragment. Only the
       * implementation of the "classname" knows how to handle the
       * properties
       *
       * @return a collection containing Property objects
       */
      public Map getProperties(String layoutName);
  
      /**
       * Test if this fragment is actually a reference to an external fragment.
       *
       * @return true is this element is a reference
       */
      public boolean isReference();
  
      /**
       * Creates a clone of this object
       */
      public Object clone()
          throws java.lang.CloneNotSupportedException;
  }
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/Page.java
  
  Index: Page.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.om.page;
  
  /**
   * This interface represents a complete page document used by Jetspeed
   * to layout a user-customizable portal page.
   *
   * @version $Id: Page.java,v 1.1 2003/08/03 14:18:51 raphael Exp $
   */
  public interface Page extends java.io.Serializable, Cloneable
  {
      /**
       * Returns the unique Id of this page. This id is guaranteed to be unique
       * from the complete portal and is suitable to be used as a unique key.
       *
       * @return the unique id of this page.
       */
      public String getId();
  
      /**
       * Modifies the id of this page. This id must not be null and must be unique
       * for the portal.
       *
       * @param id the new id for this page
       */
      public void setId(String id);
  
      /**
       * Return the name of this page. This name is a convenient handler
       * for the page that can be used to locate a page.
       * It's possible for several pages to have the same name.
       *
       * @return the name of this page
       */
      public String getName();
  
      /**
       * Sets a new name for this page. It must not be null and must not contain
       * any space or slash character.
       *
       * @param name the new document name
       */
      public void setName(String name);
  
      /**
       * Returns the Page title in the default Locale
       *
       * @return the page title
       */
      public String getTitle();
  
      /**
       * Sets the title for the default Locale
       *
       * @param title the new title
       */
      public void setTitle(String title);
  
      /**
       * Returns the name of the default ACL that applies to this
       * page. This name should reference an entry in the Securtiy
       * registry
       *
       * @return the page default acl
       */
      public String getAcl();
  
      /**
       * Modifies the default ACL for this page.
       * This new acl must reference an entry in the Security
       * registry.
       * Additionnally, replacing the default ACL will not affect any
       * children fragments with their own specific ACLs
       *
       * @param aclName the name of the new ACL for the page
       */
      public void setAcl(String aclName);
  
      /**
       * Returns the name of the default skin that applies to this
       * page. This name should reference an entry in the Skin
       * registry
       *
       * @return the page default skin name
       */
      public String getDefaultSkin();
  
      /**
       * Modifies the default skin for this page.
       * This new skin must reference an entry in the Skin
       * registry.
       * Additionnally, replacing the default skin will not affect any
       * children fragments with their own specific skins
       *
       * @param skinName the name of the new skin for the page
       */
      public void setDefaultSkin(String skinName);
  
      /**
       * Returns the name of the default decorator that applies in this page
       * to fragments of the specified type
       *
       * @param fragmentType the type of fragment considered
       * @return the decorator name for the selected type
       */
      public String getDefaultDecorator(String fragmentType);
  
      /**
       * Modifies the default decorator for the specified fragment type.
       *
       * @param decoratorName the name of the new decorator for the type
       * @param fragmentType the type of fragment considered
       */
      public void setDefaultDecorator(String decoratorName, String fragmentType);
  
      /**
       * Retrieves the top level fragment of this page. This Fragment should
       * never be null.
       *
       * @return the base Fragment object for this page.
       */
      public Fragment getRootFragment();
  
      /**
       * Retrieves the fragment contained within this page, with the
       * specified Id.
       *
       * @param id the fragment id to look for
       * @return the found Fragment object or null if not found
       */
      public Fragment getFragmentById(String id);
  
      /**
       * Create a clone of this object
       */
      public Object clone()
          throws java.lang.CloneNotSupportedException;
  }
  
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/Property.java
  
  Index: Property.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.om.page;
  
  /**
   * Simple interface for storing properties tied to Fragments in a page
   * description
   *
   * @version $Id: Property.java,v 1.1 2003/08/03 14:18:51 raphael Exp $
   */
  public interface Property extends Cloneable
  {
      /**
       * Return the name of the layout element concerned by this
       * property.
       * Other layouts will not be able to see this property.
       *
       * @return name the name of the layout
       */
      public String getLayout();
  
      /**
       * Sets the name of the layout concerned by this property
       *
       * @param layoutName the name of a layout as defined in the
       * layout component repository
       */
      public void setLayout(String layoutName);
  
      /**
       * Returns the name of the property
       *
       * @return the name of the property as String
       */
      public String getName();
  
      /**
       * Sets the name of this property
       *
       * @param name the property name
       */
      public void setName( String name );
  
      /**
       * Return the value of the property encoded as a String
       *
       * @return the string value of the property
       */
      public String getValue();
  
      /**
       * Sets the value of the property
       *
       * @param value the value of the property
       */
      public void setValue( String value );
  
      /**
       * Create a clone of this object
       */
      public Object clone()
          throws java.lang.CloneNotSupportedException;
  }
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/Reference.java
  
  Index: Reference.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.om.page;
  
  /**
   * Interface for fragment reference objects
   *
   * @version $Id: Reference.java,v 1.1 2003/08/03 14:18:51 raphael Exp $
   */
  public interface Reference
  {
      // There are no Reference specific methods defined yet
  }
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/package.html
  
  Index: package.html
  ===================================================================
  <body>
  <p>
  This package represents an Object Model for manipulating
  portal "pages" describing the layout process for a specific
  page to the aggregation engine.
  </p>
  <p>
  The use of these pages is optional in Jetspeed 2 since it's
  possible to include portlets directly within a JSp page
  through the portlet taglib.
  </p>
  <p>
  However, without a supporting page, Jetspeed does not provide
  any built-in support for page customization.
  </p>
  </body>
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/psml/AbstractBaseElement.java
  
  Index: AbstractBaseElement.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.om.page.psml;
  
  import org.apache.jetspeed.services.idgenerator.JetspeedIdGenerator;
  
  /**
   *
   * @version $Id: AbstractBaseElement.java,v 1.1 2003/08/03 14:18:52 raphael Exp $
   */
  public abstract class AbstractBaseElement implements java.io.Serializable
  {
  
      private String id = null;
  
      private String name = null;
  
      private String acl = null;
  
      private String title = null;
  
      public String getId()
      {
          if (this.id==null)
          {
              this.id = JetspeedIdGenerator.getNextPeid();
          }
          return this.id;
      }
  
      public void setId(String id)
      {
          this.id = id;
      }
  
      public String getName()
      {
          return this.name;
      }
  
      public void setName(String name)
      {
          this.name = name;
      }
  
      public String getAcl()
      {
          return this.acl;
      }
  
      public void setAcl(String aclName)
      {
          this.acl = aclName;
      }
  
      public String getTitle()
      {
          return this.title;
      }
  
      public void setTitle(String title)
      {
          this.title = title;
      }
  
      /**
       * Create a clone of this object
       */
      public Object clone()
          throws java.lang.CloneNotSupportedException
      {
          Object cloned = super.clone();
  
          // TBD
  
          return cloned;
  
      }   // clone
  }
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/psml/Defaults.java
  
  Index: Defaults.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.om.page.psml;
  
  // Java imports
  import java.util.Map;
  import java.util.HashMap;
  
  /**
   * @version $Id: Defaults.java,v 1.1 2003/08/03 14:18:52 raphael Exp $
   */
  public class Defaults
  {
  
      private String skin = null;
      private Map decoratorMap = new HashMap();
  
      public Defaults()
      {
      }
  
      public String getSkin()
      {
          return this.skin;
      }
  
      public void setSkin(String skin)
      {
          this.skin = skin;
      }
  
      public String getDecorator(String type)
      {
          return (String)decoratorMap.get(type);
      }
  
      public void setDecorator(String type, String decorator)
      {
          decoratorMap.put(type,decorator);
      }
  
      public String getFragmentDecorator()
      {
          return getDecorator("layout");
      }
  
      public void setFragmentDecorator(String decorator)
      {
          setDecorator("layout",decorator);
      }
  
      public String getPortletDecorator()
      {
          return getDecorator("portlet");
      }
  
      public void setPortletDecorator(String decorator)
      {
          setDecorator("portlet",decorator);
      }
  
  }
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java
  
  Index: FragmentImpl.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.om.page.psml;
  
  import java.util.Map;
  import java.util.List;
  import java.util.Set;
  import java.util.Hashtable;
  import java.util.ArrayList;
  import java.util.Vector;
  import java.util.Iterator;
  
  import org.apache.jetspeed.om.page.Fragment;
  import org.apache.jetspeed.om.page.Property;
  
  /**
   * @version $Id: FragmentImpl.java,v 1.1 2003/08/03 14:18:52 raphael Exp $
   */
  public class FragmentImpl extends AbstractBaseElement implements Fragment, 
java.io.Serializable
  {
  
      private String type = null;
  
      private String state = null;
  
      private String decorator = null;
  
      private String skin = null;
  
      private Map properties = new Hashtable();
  
      private List fragments = new ArrayList();
  
      private transient List psmlProperties = new Vector();
  
      public FragmentImpl()
      {}
  
      public String getType()
      {
          return this.type;
      }
  
      public void setType(String type)
      {
          this.type = type;
      }
  
      public String getState()
      {
          return this.state;
      }
  
      public void setState(String state)
      {
          this.state = state;
      }
  
      public String getDecorator()
      {
          return this.decorator;
      }
  
      public void setDecorator(String decoratorName)
      {
          this.decorator = decoratorName;
      }
  
      public String getSkin()
      {
          return this.skin;
      }
  
      public void setSkin(String skin)
      {
          this.skin = skin;
      }
  
      public boolean isReference()
      {
          return false;
      }
  
      public List getFragments()
      {
          return this.fragments;
      }
  
      public Set getLayoutProperties()
      {
          return this.properties.keySet();
      }
  
      public Map getProperties(String layoutName)
      {
          return (Map)this.properties.get(layoutName);
      }
  
      public List getProperties()
      {
          synchronized (properties)
          {
              this.psmlProperties.clear();
  
              Iterator i = this.properties.keySet().iterator();
  
              while(i.hasNext())
              {
                  String layout = (String)i.next();
                  Map lprop = (Map)this.properties.get(layout);
  
                  Iterator i2 = lprop.keySet().iterator();
  
                  while(i2.hasNext())
                  {
                      String name = (String)i.next();
                      String value = (String)lprop.get(name);
  
                      Property property = new PropertyImpl();
                      property.setLayout(layout);
                      property.setName(name);
                      property.setValue(value);
  
                      this.psmlProperties.add(property);
                  }
              }
          }
  
          return this.psmlProperties;
      }
  
      public void setProperties(List psmlProperties)
      {
          synchronized (properties)
          {
              this.psmlProperties = psmlProperties;
  
              Iterator i = this.psmlProperties.iterator();
  
              while(i.hasNext())
              {
                  Property prop = (Property)i.next();
  
                  String name = prop.getName();
                  String value = prop.getValue();
  
                  if ((name == null)||(value == null))
                  {
                      continue;
                  }
  
                  String layout = prop.getLayout();
                  if (layout == null)
                  {
                      layout = "";
                  }
  
                  Map lprop = (Map)this.properties.get(layout);
                  if (lprop == null)
                  {
                      lprop = new Hashtable();
                      this.properties.put(layout,lprop);
                  }
  
                  lprop.put(name,value);
              }
          }
      }
  
      public void setFragments(List fragements)
      {
          this.fragments = fragments;
      }
  
      public Object clone()
          throws java.lang.CloneNotSupportedException
      {
          Object cloned = super.clone();
  
          // TBD: copy the properties and fragment structures
  
          return cloned;
  
      }   // clone
  
  }
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/psml/PageImpl.java
  
  Index: PageImpl.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.om.page.psml;
  
  import org.apache.jetspeed.om.page.Page;
  import org.apache.jetspeed.om.page.Fragment;
  import java.util.Stack;
  import java.util.Iterator;
  
  /**
   * @version $Id: PageImpl.java,v 1.1 2003/08/03 14:18:52 raphael Exp $
   */
  public class PageImpl extends AbstractBaseElement implements Page
  {
      private Defaults defaults = new Defaults();
  
      private Fragment root = null;
  
      public PageImpl()
      {
          // empty constructor
      }
  
      public String getDefaultSkin()
      {
          return this.defaults.getSkin();
      }
  
      public void setDefaultSkin(String skinName)
      {
          this.defaults.setSkin(skinName);
      }
  
      public String getDefaultDecorator(String fragmentType)
      {
          return this.defaults.getDecorator(fragmentType);
      }
  
      public void setDefaultDecorator(String decoratorName, String fragmentType)
      {
          this.defaults.setDecorator(decoratorName,fragmentType);
      }
  
      public Fragment getRootFragment()
      {
          return this.root;
      }
  
      public void setRootFragment(Fragment root)
      {
          this.root=root;
      }
  
      public Fragment getFragmentById(String id)
      {
          Stack stack = new Stack();
          if (getRootFragment()!=null)
          {
              stack.push(getRootFragment());
          }
  
          Fragment f = (Fragment)stack.pop();
  
          while ((f!=null)&&(!(f.getId().equals(id))))
          {
              Iterator i = f.getFragments().iterator();
  
              while(i.hasNext())
              {
                  stack.push(i.next());
              }
  
              f = (Fragment)stack.pop();
          }
  
          return f;
      }
  
      public Defaults getDefaults()
      {
          return this.defaults;
      }
  
      public void setDefaults(Defaults defaults)
      {
          this.defaults = defaults;
      }
  
      public Object clone()
          throws java.lang.CloneNotSupportedException
      {
          Object cloned = super.clone();
  
          // TBD: clone the inner content
  
          return cloned;
      }
  }
  
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/psml/PropertyImpl.java
  
  Index: PropertyImpl.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.om.page.psml;
  
  import org.apache.jetspeed.om.page.Property;
  
  /**
   * Bean like implementation of the Parameter interface suitable for
   * Castor serialization.
   *
   * @see org.apache.jetspeed.om.registry.PsmlParameter
   * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
   * @version $Id: PropertyImpl.java,v 1.1 2003/08/03 14:18:52 raphael Exp $
   */
  public class PropertyImpl implements Property, java.io.Serializable
  {
  
      private String name;
      private String value;
      private String layout;
  
      public PropertyImpl()
      {
      }
  
      public String getLayout()
      {
          return this.layout;
      }
  
      public void setLayout(String layout)
      {
          this.layout = layout;
      }
  
      public String getName()
      {
          return this.name;
      }
  
      public void setName(String name)
      {
          this.name = name;
      }
  
      public String getValue()
      {
          return this.value;
      }
  
      public void setValue(String value)
      {
          this.value = value;
      }
  
      public Object clone()
          throws java.lang.CloneNotSupportedException
      {
          return super.clone();
      }
  }
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/om/page/psml/ReferenceImpl.java
  
  Index: ReferenceImpl.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.om.page.psml;
  
  import org.apache.jetspeed.om.page.Reference;
  
  /**
   * @version $Id: ReferenceImpl.java,v 1.1 2003/08/03 14:18:52 raphael Exp $
   */
  public class ReferenceImpl extends FragmentImpl implements Reference
  {
      public boolean isReference()
      {
          return true;
      }
  }
  
  
  
  
  1.2       +6 -6      
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/registry/JetspeedPortletRegistry.java
  
  Index: JetspeedPortletRegistry.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/services/registry/JetspeedPortletRegistry.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JetspeedPortletRegistry.java      28 Jul 2003 23:47:50 -0000      1.1
  +++ JetspeedPortletRegistry.java      3 Aug 2003 14:18:52 -0000       1.2
  @@ -185,7 +185,7 @@
           getService().registerPortletApplication(newApp);
   
       }
  -    
  +
       /**
         * @see 
org.apache.jetspeed.services.registry.PortletRegistryService#registerPortletApplication(org.apache.pluto.om.portlet.PortletApplicationDefinition,
 java.lang.String)
         */
  @@ -234,7 +234,7 @@
        */
       public static boolean portletApplicationExists(String appIentity)
       {
  -        return portletApplicationExists(appIentity);
  +        return getService().portletApplicationExists(appIentity);
       }
   
       /**
  @@ -242,7 +242,7 @@
        */
       public static boolean portletDefinitionExists(String portletIndentity)
       {
  -        return portletDefinitionExists(portletIndentity);
  +        return getService().portletDefinitionExists(portletIndentity);
       }
   
       /**
  @@ -258,10 +258,10 @@
           return (PortletRegistryService) ServiceUtil.getServiceByName(
               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)
       {
  
  
  
  1.1                  
jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/om/page/TestPageObjectModel.java
  
  Index: TestPageObjectModel.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.jetspeed.om.page;
  
  // Java imports
  import java.util.Iterator;
  
  import junit.framework.Test;
  import junit.framework.TestSuite;
  
  import org.apache.jetspeed.test.JetspeedTest;
  import org.apache.jetspeed.om.page.Page;
  import org.apache.jetspeed.om.page.Fragment;
  import org.apache.jetspeed.om.page.psml.FragmentImpl;
  import org.apache.jetspeed.om.page.psml.PageImpl;
  
  /**
   * TestMarshalPsml
   *
   * @author <a href="[EMAIL PROTECTED]">David Sean Taylor</a>
   * @version $Id: TestPageObjectModel.java,v 1.1 2003/08/03 14:18:52 raphael Exp $
   */
  public class TestPageObjectModel extends JetspeedTest
  {
  
      /**
       * Defines the testcase name for JUnit.
       *
       * @param name the testcase's name.
       */
      public TestPageObjectModel( String name )
      {
          super( name );
      }
  
      /**
       * Start the tests.
       *
       * @param args the arguments. Not used
       */
      public static void main(String args[])
      {
          junit.awtui.TestRunner.main( new String[] { 
TestPageObjectModel.class.getName() } );
      }
  
      public void setup()
      {
          System.out.println("Setup: Testing Page Object Model Implementation");
      }
  
      /**
       * Creates the test suite.
       *
       * @return a test suite (<code>TestSuite</code>) that includes all methods
       *         starting with "test"
       */
      public static Test suite()
      {
          // All methods starting with "test" will be executed in the test suite.
          return new TestSuite( TestPageObjectModel.class );
      }
  
      private Page buildBasePage()
      {
          PageImpl page = new PageImpl();
          page.setId("MyPageID");
          page.setName("Test");
  
          Fragment frag = new FragmentImpl();
          frag.setId("Frag1");
          frag.setType(Fragment.LAYOUT);
  
          page.setRootFragment(frag);
  
          return page;
      }
  
      public void testBasicPage() throws Exception
      {
          System.out.println("Testing simple Page creation");
  
          Page page = buildBasePage();
          assertTrue(page.getId().equals("MyPageID"));
          assertTrue(page.getName().equals("Test"));
          Fragment root = page.getRootFragment();
          assertNotNull(root);
          assertTrue(root.getId().equals("Frag1"));
          assertTrue(root.getType().equals(Fragment.LAYOUT));
          assertNull(root.getTitle());
      }
  
      public void tesFragmentManipulation() throws Exception
      {
          System.out.println("Testing Fragments manipulation");
  
          // Build a page with a few fragments
          Page page = buildBasePage();
          Fragment root = page.getRootFragment();
          assertNotNull(root.getFragments());
  
          Fragment frag1 = new FragmentImpl();
          frag1.setId("F1");
          frag1.setType(Fragment.PORTLET);
          frag1.setName("Portlet1");
          root.getFragments().add(frag1);
  
          Fragment frag2 = new FragmentImpl();
          frag2.setId("F2");
          frag2.setType(Fragment.LAYOUT);
          frag2.setName("TwoColumns");
          frag2.setDecorator("test");
          frag2.setAcl("private");
  
          Fragment frag3 = new FragmentImpl();
          frag3.setId("F3");
          frag3.setType(Fragment.PORTLET);
          frag3.setName("Portlet3");
          frag3.setDecorator("test");
          frag3.setState("minimized");
          frag2.getFragments().add(frag3);
          root.getFragments().add(frag2);
  
          //Check the construct
          assertTrue(root.getFragments().size()==2);
          Iterator i = root.getFragments().iterator();
          Fragment f = (Fragment)i.next();
          assertNotNull(f);
          assertTrue(f.getName().equals("Portlet1"));
          assertTrue(f.getType().equals(Fragment.PORTLET));
          assertTrue(f.getId().equals("F1"));
          assertNull(f.getTitle());
          assertNull(f.getAcl());
          assertNull(f.getDecorator());
          assertNull(f.getState());
          assertTrue(f.getFragments().size()==0);
          f = (Fragment)i.next();
          assertNotNull(f);
          assertTrue(f.getName().equals("TwoColumns"));
          assertTrue(f.getType().equals(Fragment.LAYOUT));
          assertTrue(f.getFragments().size()==1);
          assertTrue(f.getDecorator().equals("test"));
          assertTrue(f.getAcl().equals("private"));
          assertTrue(f.getFragments().size()==1);
          i = f.getFragments().iterator();
          frag1 = (Fragment)i.next();
          assertNotNull(frag1);
          assertTrue(frag1.getName().equals("Portlet3"));
          assertTrue(frag1.getType().equals(Fragment.PORTLET));
  
          //Now change the inner child to a new portlet
          frag2 = new FragmentImpl();
          frag2.setId("FR4");
          frag2.setType(Fragment.PORTLET);
          frag2.setName("P4");
  
          frag3 = page.getFragmentById("Portlet3");
          assertNotNull(frag3);
          f.getFragments().remove(frag3);
          frag3 = page.getFragmentById("Portlet3");
          assertNull(frag3);
          f.getFragments().add(frag2);
          assertTrue(f.getFragments().size()==1);
          f = (Fragment)f.getFragments().get(0);
          assertNotNull(f);
          assertTrue(f.getName().equals("P4"));
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to