01: // Copyright 2004, 2005 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.hivemind.schema;
16:
17: import org.apache.hivemind.internal.Module;
18:
19: /**
20: * Object used when processing the elements contributed in an
21: * {@link org.apache.hivemind.internal.Contribution}.
22: *
23: * @author Howard Lewis Ship
24: */
25: public interface SchemaProcessor {
26: /**
27: * The SchemaProcessor is always the bottom (deepest) object on the stack. Top level objects
28: * (contained by a schema, not another element) can use an
29: * {@link org.apache.hivemind.schema.rules.InvokeParentRule} to add themselves to the list
30: * of elements for the {@link org.apache.hivemind.internal.ConfigurationPoint} being
31: * constructed.
32: */
33: public void addElement(Object element);
34:
35: /**
36: * Pushes an object onto the processor's stack.
37: */
38: public void push(Object object);
39:
40: /**
41: * Pops the top object off the stack and returns it.
42: */
43:
44: public Object pop();
45:
46: /**
47: * Peeks at the top object on the stack.
48: */
49:
50: public Object peek();
51:
52: /**
53: * Peeks at an object within the stack at the indicated depth.
54: */
55:
56: public Object peek(int depth);
57:
58: /**
59: * Returns the module which contributed the current elements being processed.
60: */
61:
62: public Module getContributingModule();
63:
64: /**
65: * Return the module which defined the schema.
66: *
67: * @since 1.1
68: */
69:
70: public Module getDefiningModule();
71:
72: /**
73: * Returns the path to the current element in the form a sequence of element names separated
74: * with slashes. This is most often used in error messages, to help identify the position of an
75: * error.
76: */
77:
78: public String getElementPath();
79:
80: /**
81: * Returns a {@link org.apache.hivemind.schema.Translator} used to convert the content of the
82: * current element. Will not return null.
83: */
84:
85: public Translator getContentTranslator();
86:
87: /**
88: * Returns the {@link org.apache.hivemind.schema.Translator} for a particular attribute of the
89: * current element. Will not return null.
90: */
91:
92: public Translator getAttributeTranslator(String attributeName);
93:
94: /**
95: * Returns the named {@link org.apache.hivemind.schema.Translator}.
96: */
97:
98: public Translator getTranslator(String translator);
99: }
|