001: /******************************************************************************
002: * JBoss, a division of Red Hat *
003: * Copyright 2006, Red Hat Middleware, LLC, and individual *
004: * contributors as indicated by the @authors tag. See the *
005: * copyright.txt in the distribution for a full listing of *
006: * individual contributors. *
007: * *
008: * This is free software; you can redistribute it and/or modify it *
009: * under the terms of the GNU Lesser General Public License as *
010: * published by the Free Software Foundation; either version 2.1 of *
011: * the License, or (at your option) any later version. *
012: * *
013: * This software is distributed in the hope that it will be useful, *
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of *
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
016: * Lesser General Public License for more details. *
017: * *
018: * You should have received a copy of the GNU Lesser General Public *
019: * License along with this software; if not, write to the Free *
020: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
021: * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
022: ******************************************************************************/package org.jboss.portal.api.node;
023:
024: import org.jboss.portal.api.PortalRuntimeContext;
025:
026: import java.util.Collection;
027: import java.util.Locale;
028: import java.util.Map;
029:
030: /**
031: * Represents a portal node, a first class entity for the portal.
032: *
033: * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
034: * @version $Revision: 8785 $
035: */
036: public interface PortalNode {
037:
038: /** A node of type context. */
039: int TYPE_CONTEXT = 0;
040:
041: /** A node of type portal. */
042: int TYPE_PORTAL = 1;
043:
044: /** A node of type page. */
045: int TYPE_PAGE = 2;
046:
047: /** A node of type window. */
048: int TYPE_WINDOW = 3;
049:
050: /**
051: * Return the node type.
052: *
053: * @return the node type
054: */
055: int getType();
056:
057: /**
058: * Return the root node of this node.
059: *
060: * @return the root node
061: */
062: PortalNode getRoot();
063:
064: /**
065: * Return the parent node of this node.
066: *
067: * @return the parent node
068: */
069: PortalNode getParent();
070:
071: /**
072: * Return the node name which identifies the node in the context to its parent.
073: *
074: * @return the node name
075: */
076: String getName();
077:
078: /**
079: * Returns the best display name for specified locale.
080: *
081: * @return the display name
082: */
083: String getDisplayName(Locale locale);
084:
085: /**
086: * Return a child of this object.
087: *
088: * @param name the child name
089: * @return a named child
090: */
091: PortalNode getChild(String name);
092:
093: /**
094: * Return the children of this object.
095: *
096: * @return the children
097: */
098: Collection getChildren();
099:
100: /**
101: * Get a portal node relative to this object.
102: *
103: * @param relativePath the relative path
104: * @return the relative object
105: */
106: PortalNode resolve(String relativePath);
107:
108: /**
109: * Returns the node properties.
110: *
111: * @return the node properties
112: */
113: Map getProperties();
114:
115: /**
116: * Create a portal node url for this object.
117: *
118: * @param portalRuntimeContext the portal runtime context
119: * @return the portal node url
120: */
121: PortalNodeURL createURL(PortalRuntimeContext portalRuntimeContext);
122: }
|