KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > vfs > context > ContextEvent


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * See the License for the specific language governing rights and
10  * limitations under the License.
11  *
12  * The Initial Developer of the Original Code is Simulacra Media Ltd.
13  * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14  *
15  * All Rights Reserved.
16  *
17  * Contributor(s):
18  */

19 package org.openharmonise.vfs.context;
20
21 import org.openharmonise.vfs.*;
22
23 /**
24  * The context event is the data exchange object for messages passed
25  * through the context handler. Most events contain a virtual file system
26  * and virtual file full path. The context event can also contain an object
27  * which implements the context data marker interface, for more complex
28  * context type specific information.
29  *
30  * @author Matthew Large
31  * @version $Revision: 1.1 $
32  *
33  */

34 public class ContextEvent {
35
36     /**
37      * Context type.
38      */

39     public ContextType CONTEXT_TYPE = null;
40     
41     /**
42      * Virtual file system.
43      */

44     private AbstractVirtualFileSystem m_vfs = null;
45     
46     /**
47      * Full path.
48      */

49     private String JavaDoc m_sPath = null;
50     
51     /**
52      * General message.
53      */

54     private String JavaDoc m_sMessage = null;
55     
56     /**
57      * Context type specific data.
58      */

59     private ContextData m_contextData = null;
60
61     /**
62      * Constructs a new context event.
63      *
64      * @param contextType Context type
65      */

66     public ContextEvent(ContextType contextType) {
67         super();
68         this.CONTEXT_TYPE = contextType;
69     }
70     
71     /**
72      * Constructs a new context event.
73      *
74      * @param contextType Context type
75      * @param sMessage General message
76      */

77     public ContextEvent(ContextType contextType, String JavaDoc sMessage) {
78         this(contextType);
79         this.m_sMessage = sMessage;
80     }
81     
82     /**
83      * Constructs a new context event.
84      *
85      * @param contextType Context type
86      * @param sMessage General message
87      * @param vfs Virtual file system
88      * @param sPath Full path
89      */

90     public ContextEvent(ContextType contextType, String JavaDoc sMessage, AbstractVirtualFileSystem vfs, String JavaDoc sPath) {
91         this(contextType, sMessage);
92         this.m_vfs = vfs;
93         this.m_sPath = sPath;
94         
95     }
96     
97     /**
98      * Returns the virtual file system.
99      *
100      * @return Virtual file system
101      */

102     public AbstractVirtualFileSystem getVFS() {
103         return this.m_vfs;
104     }
105     
106     /**
107      * Returns the full path.
108      *
109      * @return Full path
110      */

111     public String JavaDoc getPath() {
112         return this.m_sPath;
113     }
114     
115     /**
116      * Returns the general message.
117      *
118      * @return Message
119      */

120     public String JavaDoc getMessage() {
121         return this.m_sMessage;
122     }
123     
124     /**
125      * Sets the context type specific data.
126      *
127      * @param contextData Context data
128      */

129     public void setContextData(ContextData contextData) {
130         this.m_contextData = contextData;
131     }
132     
133     /**
134      * Returns the context type specific data.
135      *
136      * @return Context data
137      */

138     public ContextData getContextData() {
139         return this.m_contextData;
140     }
141
142 }
143
Popular Tags