01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/entity/tags/sakai_2-4-1/entity-api/api/src/java/org/sakaiproject/entity/api/Entity.java $
03: * $Id: Entity.java 7040 2006-03-27 03:04:33Z ggolden@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.entity.api;
21:
22: import java.util.Stack;
23:
24: import org.w3c.dom.Document;
25: import org.w3c.dom.Element;
26:
27: /**
28: * <p>
29: * Entity is the generic interface for all information units modeled in Sakai.
30: * </p>
31: */
32: public interface Entity {
33: /** The character used to separate names in the region address path */
34: static final String SEPARATOR = "/";
35:
36: /**
37: * Access the URL which can be used to access the entity.
38: *
39: * @return The URL which can be used to access the entity.
40: */
41: String getUrl();
42:
43: /**
44: * Access the internal reference which can be used to access the entity from within the system.
45: *
46: * @return The the internal reference which can be used to access the entity from within the system.
47: */
48: String getReference();
49:
50: /**
51: * Access the alternate URL which can be used to access the entity.
52: *
53: * @param rootProperty
54: * The name of the entity property whose value controls which alternate reference URL is requested. If null, the native 'raw' URL is requested.
55: * @return The alternate URL which can be used to access the entity.
56: */
57: String getUrl(String rootProperty);
58:
59: /**
60: * Access the alternate internal reference which can be used to access the entity from within the system.
61: *
62: * @param rootProperty
63: * The name of the entity property whose value controls which alternate reference is requested. If null, the native 'raw' reference is requested.
64: * @return The the alternate internal reference which can be used to access the entity from within the system.
65: */
66: String getReference(String rootProperty);
67:
68: /**
69: * Access the id of the entity.
70: *
71: * @return The id.
72: */
73: String getId();
74:
75: /**
76: * Access the entity's properties.
77: *
78: * @return The entity's properties.
79: */
80: ResourceProperties getProperties();
81:
82: /**
83: * Serialize the entity into XML, adding an element to the doc under the top of the stack element.
84: *
85: * @param doc
86: * The DOM doc to contain the XML (or null for a string return).
87: * @param stack
88: * The DOM elements, the top of which is the containing element of the new "entity" element.
89: * @return The newly added element.
90: */
91: Element toXml(Document doc, Stack stack);
92: }
|