001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019: package org.netbeans.modules.wsdlextensions.file.model.impl;
020:
021: import org.netbeans.modules.xml.wsdl.model.WSDLModel;
022: import org.w3c.dom.Element;
023:
024: import org.netbeans.modules.wsdlextensions.file.model.FileComponent;
025: import org.netbeans.modules.wsdlextensions.file.model.FileMessage;
026: import org.netbeans.modules.wsdlextensions.file.model.FileQName;
027:
028: /**
029: * @author sweng
030: */
031: public class FileMessageImpl extends FileComponentImpl implements
032: FileMessage {
033:
034: public FileMessageImpl(WSDLModel model, Element e) {
035: super (model, e);
036: }
037:
038: public FileMessageImpl(WSDLModel model) {
039: this (model, createPrefixedElement(FileQName.MESSAGE.getQName(),
040: model));
041: }
042:
043: public void accept(FileComponent.Visitor visitor) {
044: visitor.visit(this );
045: }
046:
047: public void setFileType(String val) {
048: setAttribute(ATTR_FILE_TYPE,
049: FileAttribute.FILE_MESSAGE_FILETYPE_PROPERTY, val);
050: }
051:
052: public String getFileType() {
053: return getAttribute(FileAttribute.FILE_MESSAGE_FILETYPE_PROPERTY);
054: }
055:
056: public void setFileUseType(String val) {
057: setAttribute(ATTR_FILE_USE,
058: FileAttribute.FILE_MESSAGE_USE_PROPERTY, val);
059: }
060:
061: public String getFileUseType() {
062: return getAttribute(FileAttribute.FILE_MESSAGE_USE_PROPERTY);
063: }
064:
065: public void setFileEncodingStyle(String val) {
066: setAttribute(ATTR_FILE_ENCODING_STYLE,
067: FileAttribute.FILE_MESSAGE_ENCODINGSTYLE_PROPERTY, val);
068: }
069:
070: public String getFileEncodingStyle() {
071: return getAttribute(FileAttribute.FILE_MESSAGE_ENCODINGSTYLE_PROPERTY);
072: }
073:
074: public void setFileName(String val) {
075: setAttribute(ATTR_FILE_NAME,
076: FileAttribute.FILE_MESSAGE_FILENAME_PROPERTY, val);
077: }
078:
079: public String getFileName() {
080: return getAttribute(FileAttribute.FILE_MESSAGE_FILENAME_PROPERTY);
081: }
082:
083: public void setFileNameIsPattern(boolean val) {
084: setAttribute(ATTR_FILE_NAME_IS_PATTERN,
085: FileAttribute.FILE_MESSAGE_FILENAMEISPATTERN_PROPERTY,
086: val ? "true" : "false");
087: }
088:
089: public boolean getFileNameIsPattern() {
090: String s = getAttribute(FileAttribute.FILE_MESSAGE_FILENAMEISPATTERN_PROPERTY);
091: return s != null && s.equals("true");
092: }
093:
094: public void setPollingInterval(long val) {
095: setAttribute(ATTR_POLLING_INTERVAL,
096: FileAttribute.FILE_MESSAGE_POLLINTERVAL_PROPERTY, ""
097: + val);
098: }
099:
100: public Long getPollingInterval() {
101: Long longVal = null;
102: String val = getAttribute(FileAttribute.FILE_MESSAGE_POLLINTERVAL_PROPERTY);
103: if (val == null) {
104: return null;
105: }
106: try {
107: longVal = Long.parseLong(val);
108: } catch (Exception e) {
109: // should never get here
110: }
111: return longVal;
112: }
113:
114: public void setMaxBytesPerRecord(long val) {
115: setAttribute(ATTR_MAX_BYTES_PER_RECORD,
116: FileAttribute.FILE_MESSAGE_MAXBYTESPERRECORD_PROPERTY,
117: "" + val);
118: }
119:
120: public Long getMaxBytesPerRecord() {
121: Long longVal = null;
122: String val = getAttribute(FileAttribute.FILE_MESSAGE_MAXBYTESPERRECORD_PROPERTY);
123: if (val == null) {
124: return null;
125: }
126: try {
127: longVal = new Long(val);
128: } catch (Exception e) {
129: // should never get here.
130: }
131:
132: return longVal;
133: }
134:
135: public void setRecordDelimiter(String val) {
136: setAttribute(ATTR_RECORD_DELIM,
137: FileAttribute.FILE_MESSAGE_RECORDDELIMITER_PROPERTY, ""
138: + val);
139: }
140:
141: public String getRecordDelimiter() {
142: return getAttribute(FileAttribute.FILE_MESSAGE_RECORDDELIMITER_PROPERTY);
143: }
144:
145: public void setAddEOL(boolean val) {
146: setAttribute(ATTR_ADD_EOL,
147: FileAttribute.FILE_MESSAGE_ADDEOL_PROPERTY,
148: val ? "true" : "false");
149: }
150:
151: public boolean getAddEOL() {
152: String s = getAttribute(FileAttribute.FILE_MESSAGE_ADDEOL_PROPERTY);
153: return s != null && s.equals("true");
154: }
155:
156: public void setRemoveEOL(boolean val) {
157: setAttribute(ATTR_REMOVE_EOL,
158: FileAttribute.FILE_MESSAGE_REMOVEOL_PROPERTY,
159: val ? "true" : "false");
160: }
161:
162: public boolean getRemoveEOL() {
163: String s = getAttribute(FileAttribute.FILE_MESSAGE_REMOVEOL_PROPERTY);
164: return s != null && s.equals("true");
165: }
166:
167: public void setMultipleRecordsPerFile(boolean val) {
168: setAttribute(
169: ATTR_MULTIPLE_RECORDS_PER_FILE,
170: FileAttribute.FILE_MESSAGE_MULTIPLERECORDSPERFILE_MESSAGE__PROPERTY,
171: val ? "true" : "false");
172: }
173:
174: public boolean getMultipleRecordsPerFile() {
175: String s = getAttribute(FileAttribute.FILE_MESSAGE_MULTIPLERECORDSPERFILE_MESSAGE__PROPERTY);
176: return s != null && s.equals("true");
177: }
178:
179: public void setPart(String val) {
180: setAttribute(ATTR_PART,
181: FileAttribute.FILE_MESSAGE_PART_PROPERTY, val);
182: }
183:
184: public String getPart() {
185: return getAttribute(FileAttribute.FILE_MESSAGE_PART_PROPERTY);
186: }
187:
188: public boolean getArchiveEnabled() {
189: String s = getAttribute(FileAttribute.FILE_MESSAGE_ARCHIVE_PROPERTY);
190: return s != null && s.equals("true");
191: }
192:
193: public void setArchiveEnabled(boolean b) {
194: setAttribute(ATTR_ARCHIVE_ENABLED,
195: FileAttribute.FILE_MESSAGE_ARCHIVE_PROPERTY, b ? "true"
196: : "false");
197: }
198:
199: public boolean getProtectEnabled() {
200: String s = getAttribute(FileAttribute.FILE_MESSAGE_PROTECT_PROPERTY);
201: return s != null && s.equals("true");
202: }
203:
204: public void setProtectEnabled(boolean b) {
205: setAttribute(ATTR_PROTECT_ENABLED,
206: FileAttribute.FILE_MESSAGE_PROTECT_PROPERTY, b ? "true"
207: : "false");
208: }
209:
210: public boolean getStagingEnabled() {
211: String s = getAttribute(FileAttribute.FILE_MESSAGE_STAGE_PROPERTY);
212: return s != null && s.equals("true");
213: }
214:
215: public void setStagingEnabled(boolean b) {
216: setAttribute(ATTR_STAGING_ENABLED,
217: FileAttribute.FILE_MESSAGE_STAGE_PROPERTY, b ? "true"
218: : "false");
219: }
220:
221: public String getArchiveDirectory() {
222: return getAttribute(FileAttribute.FILE_MESSAGE_ARCHIVE_DIR_PROPERTY);
223: }
224:
225: public void setArchiveDirectory(String s) {
226: setAttribute(ATTR_ARCHIVE_DIR,
227: FileAttribute.FILE_MESSAGE_ARCHIVE_DIR_PROPERTY, s);
228: }
229:
230: public String getProtectDirectory() {
231: return getAttribute(FileAttribute.FILE_MESSAGE_PROTECT_DIR_PROPERTY);
232: }
233:
234: public void setProtectDirectory(String s) {
235: setAttribute(ATTR_PROTECT_DIR,
236: FileAttribute.FILE_MESSAGE_PROTECT_DIR_PROPERTY, s);
237: }
238:
239: public String getStagingDirectory() {
240: return getAttribute(FileAttribute.FILE_MESSAGE_STAGE_DIR_PROPERTY);
241: }
242:
243: public void setStagingDirectory(String s) {
244: setAttribute(ATTR_STAGING_DIR,
245: FileAttribute.FILE_MESSAGE_STAGE_DIR_PROPERTY, s);
246: }
247:
248: public boolean getArchiveDirIsRelative() {
249: String s = getAttribute(FileAttribute.FILE_MESSAGE_ARCHIVE_DIR_IS_RELATIVE);
250: return s != null && s.equals("true");
251: }
252:
253: public void setArchiveDirIsRelative(boolean b) {
254: setAttribute(ATTR_ARCHIVE_DIR_IS_RELATIVE,
255: FileAttribute.FILE_MESSAGE_ARCHIVE_DIR_IS_RELATIVE,
256: b ? "true" : "false");
257: }
258:
259: public boolean getProtectDirIsRelative() {
260: String s = getAttribute(FileAttribute.FILE_MESSAGE_PROTECT_DIR_IS_RELATIVE);
261: return s != null && s.equals("true");
262: }
263:
264: public void setProtectDirIsRelative(boolean b) {
265: setAttribute(ATTR_PROTECT_DIR_IS_RELATIVE,
266: FileAttribute.FILE_MESSAGE_PROTECT_DIR_IS_RELATIVE,
267: b ? "true" : "false");
268: }
269:
270: public boolean getStagingDirIsRelative() {
271: String s = getAttribute(FileAttribute.FILE_MESSAGE_STAGE_DIR_IS_RELATIVE);
272: return s != null && s.equals("true");
273: }
274:
275: public void setStagingDirIsRelative(boolean b) {
276: setAttribute(ATTR_STAGING_DIR_IS_RELATIVE,
277: FileAttribute.FILE_MESSAGE_STAGE_DIR_IS_RELATIVE,
278: b ? "true" : "false");
279: }
280:
281: }
|