001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019: package org.openharmonise.vfs.context;
020:
021: import org.openharmonise.vfs.*;
022:
023: /**
024: * The context event is the data exchange object for messages passed
025: * through the context handler. Most events contain a virtual file system
026: * and virtual file full path. The context event can also contain an object
027: * which implements the context data marker interface, for more complex
028: * context type specific information.
029: *
030: * @author Matthew Large
031: * @version $Revision: 1.1 $
032: *
033: */
034: public class ContextEvent {
035:
036: /**
037: * Context type.
038: */
039: public ContextType CONTEXT_TYPE = null;
040:
041: /**
042: * Virtual file system.
043: */
044: private AbstractVirtualFileSystem m_vfs = null;
045:
046: /**
047: * Full path.
048: */
049: private String m_sPath = null;
050:
051: /**
052: * General message.
053: */
054: private String m_sMessage = null;
055:
056: /**
057: * Context type specific data.
058: */
059: private ContextData m_contextData = null;
060:
061: /**
062: * Constructs a new context event.
063: *
064: * @param contextType Context type
065: */
066: public ContextEvent(ContextType contextType) {
067: super ();
068: this .CONTEXT_TYPE = contextType;
069: }
070:
071: /**
072: * Constructs a new context event.
073: *
074: * @param contextType Context type
075: * @param sMessage General message
076: */
077: public ContextEvent(ContextType contextType, String sMessage) {
078: this (contextType);
079: this .m_sMessage = sMessage;
080: }
081:
082: /**
083: * Constructs a new context event.
084: *
085: * @param contextType Context type
086: * @param sMessage General message
087: * @param vfs Virtual file system
088: * @param sPath Full path
089: */
090: public ContextEvent(ContextType contextType, String sMessage,
091: AbstractVirtualFileSystem vfs, String sPath) {
092: this (contextType, sMessage);
093: this .m_vfs = vfs;
094: this .m_sPath = sPath;
095:
096: }
097:
098: /**
099: * Returns the virtual file system.
100: *
101: * @return Virtual file system
102: */
103: public AbstractVirtualFileSystem getVFS() {
104: return this .m_vfs;
105: }
106:
107: /**
108: * Returns the full path.
109: *
110: * @return Full path
111: */
112: public String getPath() {
113: return this .m_sPath;
114: }
115:
116: /**
117: * Returns the general message.
118: *
119: * @return Message
120: */
121: public String getMessage() {
122: return this .m_sMessage;
123: }
124:
125: /**
126: * Sets the context type specific data.
127: *
128: * @param contextData Context data
129: */
130: public void setContextData(ContextData contextData) {
131: this .m_contextData = contextData;
132: }
133:
134: /**
135: * Returns the context type specific data.
136: *
137: * @return Context data
138: */
139: public ContextData getContextData() {
140: return this.m_contextData;
141: }
142:
143: }
|