001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify
008: * it under the terms of the GNU General Public License as published by
009: * the Free Software Foundation; either version 2 of the License, or
010: * (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307
020: * USA
021: *
022: * $Id: IMDLDocument.java 6044 2007-03-18 03:55:52Z mpreston $
023: *
024: */
025: package com.bostechcorp.cbesb.common.mdl;
026:
027: import javax.xml.namespace.QName;
028: import java.io.OutputStream;
029:
030: /**
031: * Provides methods to manipulate an MDL document. Some of the functionality provided:
032: * 1. Add/Remove document references (includes and imports)
033: * 2. Add/Remove Message Definitions
034: * 3. Add/Remove Element Definitions
035: * 4. Add/Remove Datatype Definitions
036: * 5. Serialize to MDL formatted XML file
037: * 6. Convert to XML Schema that can validate the XML representation of the messages.
038: *
039: */
040: public interface IMDLDocument {
041:
042: /**
043: * The qualified is the value of the elementFormDefault attribute.
044: */
045: public static final byte ELEMENT_FORM_DEFAULT_QUALIFIED = 0;
046:
047: /**
048: * The unqualified is the value of the elementFormDefault attribute.
049: */
050: public static final byte ELEMENT_FORM_DEFAULT_UNQUALIFIED = 1;
051:
052: /**
053: * Get targetNamespace attribute of MDL document.
054: *
055: * @return Returns the targetNamespace.
056: */
057: public String getTargetNamespace();
058:
059: /**
060: * Set targetNamespace attribute of MDL document.
061: *
062: * @param targetNamespace The targetNamespace to set.
063: */
064: public void setTargetNamespace(String targetNamespace);
065:
066: /**
067: * Get elementFormDefault attribute of MDL document.
068: *
069: * @return Returns the elementFormDefault.
070: */
071: public byte getElementFormDefault();
072:
073: /**
074: * Set the elementFormDefault attribute of MDL document.
075: *
076: * @param elementFormDefault The elementFormDefault to set.
077: */
078: public void setElementFormDefault(byte elementFormDefault);
079:
080: /**
081: * Adds a prefix-URI namespace mapping that can be used
082: * later to resolve the URI from a prefix.
083: * @param prefix
084: * @param URI
085: */
086: public void setNamespaceMapping(String prefix, String URI);
087:
088: /**
089: * Returns the namespace URI for the provided prefix
090: * using the namespaces defined in this MDL document.
091: * @param prefix
092: * @return
093: */
094: public String resolveNamespacePrefix(String prefix);
095:
096: /**
097: * Resolves an object reference (like an element reference,
098: * or property reference) that contains only a local name,
099: * or a namespace prefix and local name.
100: * @param reference
101: * @return String array containing 2 entries:
102: * 1 - Namespace URL, empty string if no namespace is used
103: * 2 - local name.
104: */
105: public QName getQNameFromReference(String reference);
106:
107: /**
108: * Get all docReference attributes of MDLDocument.
109: *
110: * @return MDLDocReference[]
111: */
112: public IMDLDocReference[] getAllMDLDocReferences();
113:
114: /**
115: * Add document references (includes and imports).
116: *
117: * @param docReference IMDLDocReference
118: */
119: public void addMDLDocReference(IMDLDocReference docReference);
120:
121: /**
122: * Remove document references (includes and imports).
123: *
124: * @param docReference
125: */
126: public void removeMDLDocReference(IMDLDocReference docReference);
127:
128: /**
129: * Get the specificed Messagedefinition of MDL document.
130: *
131: * @param namespaceURI String
132: * @param localName String
133: * @return MessageDefinition
134: */
135: public IMessageDefinition getMessageDefinition(String namespaceURI,
136: String localName);
137:
138: /**
139: * Get all of the MessageDefinitions of MDL document.
140: *
141: * @return MessageDefinition[]
142: */
143: public IMessageDefinition[] getAllMessageDefinitions();
144:
145: /**
146: * Get all of the visible MessageDefinitions of MDL document that include the import and include files.
147: *
148: * @return MessageDefinition[]
149: */
150: public IMessageDefinition[] getAllVisibleMessageDefinitions();
151:
152: /**
153: * Add Message Definitions for the MDL document.
154: *
155: * @param messageDef IMessageDefinition
156: */
157: public void addMessageDefinition(IMessageDefinition messageDef);
158:
159: /**
160: * Remove the specificed MessageDefinitions
161: *
162: * @param namespaceURI String
163: * @param localName String
164: */
165: public void removeMessageDefinition(String namespaceURI,
166: String localName);
167:
168: /**
169: * Get the specificed ElementDefinition in the MDL document.
170: *
171: * @param namespaceURI String
172: * @param localName String
173: * @return ElementDefinition
174: */
175: public IElementDefinition getElementDefinition(String namespaceURI,
176: String localName);
177:
178: /**
179: * Get all of the ElementDefinitions of MDL document.
180: *
181: * @return ElementDefinition[]
182: */
183: public IElementDefinition[] getAllElementDefinitions();
184:
185: /**
186: * Get all of the visible ElementDefinitions of MDL document that include the import and include files.
187: *
188: * @return ElementDefinition[]
189: */
190: public IElementDefinition[] getAllVisibleElementDefinitions();
191:
192: /**
193: * Add Element Definitions for the MDL document.
194: *
195: * @param elementDefinition IElementDefinition
196: */
197: public void addElementDefinition(
198: IElementDefinition elementDefinition);
199:
200: /**
201: * Remove specificed Element Definition.
202: *
203: * @param namespaceURI String
204: * @param localName String
205: */
206: public void removeElementDefinition(String namespaceURI,
207: String localName);
208:
209: /**
210: * Get the specificed DatatypeDefinition of MDL document.
211: *
212: * @param namespaceURI String
213: * @param localName String
214: * @return DatatypeDefinition
215: */
216: public IDatatypeDefinition getDatatypeDefinition(
217: String namespaceURI, String localName);
218:
219: /**
220: * Get all of the DatatypeDefinitions of MDL document.
221: *
222: * @return DatatypeDefinition[]
223: */
224: public IDatatypeDefinition[] getAllDatatypeDefinitions();
225:
226: /**
227: * @return DatatypeDefinition[]
228: */
229: public IDatatypeDefinition[] getAllVisibleDatatypeDefinitions();
230:
231: /**
232: * Add Datatype Definitions
233: *
234: * @param datatypeDef
235: */
236: public void addDatatypeDefinition(IDatatypeDefinition datatypeDef);
237:
238: /**
239: * Remove Datatype Definitions
240: *
241: * @param namespaceURI
242: * @param localName
243: */
244: public void removeDatatypeDefinition(String namespaceURI,
245: String localName);
246:
247: /**
248: * Serialize to MDL formatted XML file
249: *
250: * @param outputStream
251: */
252: public void serialize(OutputStream outputStream);
253:
254: /**
255: * Convert to XML Schema that can validate the XML representation of the messages.
256: *
257: * @param outputStream
258: */
259: public void toSchema(OutputStream outputStream);
260:
261: /**
262: * Add global property definition for the MDL document.
263: *
264: * @param name The value of name attribute.
265: * @param value The value of value attribute.
266: */
267: public void addProperty(IProperty property);
268:
269: /**
270: * Get the specificed Property of MDL document.
271: *
272: * @param name the value of name attribute.
273: * @return IProperty
274: */
275: public IProperty getProperty(String namespaceURI, String localName);
276:
277: /**
278: * Get all of the Properties of MDL document.
279: *
280: * @return IProperty[]
281: */
282: public IProperty[] getAllProperties();
283:
284: /**
285: * Get all of the visible Properties of MDL document that include the import and include files.
286: *
287: * @return
288: */
289: public IProperty[] getAllVisibleProperties();
290:
291: /**
292: * Remove specificed global property definition.
293: *
294: * @param name the value of name attribute.
295: */
296: public void removeProperty(String namespaceURI, String localName);
297: }
|