ContextEvent.java :  » Content-Management-System » harmonise » org » openharmonise » vfs » context » Java Open Source

Java Open Source » Content Management System » harmonise 
harmonise » org » openharmonise » vfs » context » ContextEvent.java
/*
 * The contents of this file are subject to the 
 * Mozilla Public License Version 1.1 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
 * See the License for the specific language governing rights and 
 * limitations under the License.
 *
 * The Initial Developer of the Original Code is Simulacra Media Ltd.
 * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
 *
 * All Rights Reserved.
 *
 * Contributor(s):
 */
package org.openharmonise.vfs.context;

import org.openharmonise.vfs.*;

/**
 * The context event is the data exchange object for messages passed
 * through the context handler. Most events contain a virtual file system
 * and virtual file full path. The context event can also contain an object
 * which implements the context data marker interface, for more complex
 * context type specific information.
 * 
 * @author Matthew Large
 * @version $Revision: 1.1 $
 *
 */
public class ContextEvent {

  /**
   * Context type.
   */
  public ContextType CONTEXT_TYPE = null;
  
  /**
   * Virtual file system.
   */
  private AbstractVirtualFileSystem m_vfs = null;
  
  /**
   * Full path.
   */
  private String m_sPath = null;
  
  /**
   * General message.
   */
  private String m_sMessage = null;
  
  /**
   * Context type specific data.
   */
  private ContextData m_contextData = null;

  /**
   * Constructs a new context event.
   * 
   * @param contextType Context type
   */
  public ContextEvent(ContextType contextType) {
    super();
    this.CONTEXT_TYPE = contextType;
  }
  
  /**
   * Constructs a new context event.
   * 
   * @param contextType Context type
   * @param sMessage General message
   */
  public ContextEvent(ContextType contextType, String sMessage) {
    this(contextType);
    this.m_sMessage = sMessage;
  }
  
  /**
   * Constructs a new context event.
   * 
   * @param contextType Context type
   * @param sMessage General message
   * @param vfs Virtual file system
   * @param sPath Full path
   */
  public ContextEvent(ContextType contextType, String sMessage, AbstractVirtualFileSystem vfs, String sPath) {
    this(contextType, sMessage);
    this.m_vfs = vfs;
    this.m_sPath = sPath;
    
  }
  
  /**
   * Returns the virtual file system.
   * 
   * @return Virtual file system
   */
  public AbstractVirtualFileSystem getVFS() {
    return this.m_vfs;
  }
  
  /**
   * Returns the full path.
   * 
   * @return Full path
   */
  public String getPath() {
    return this.m_sPath;
  }
  
  /**
   * Returns the general message.
   * 
   * @return Message
   */
  public String getMessage() {
    return this.m_sMessage;
  }
  
  /**
   * Sets the context type specific data.
   * 
   * @param contextData Context data
   */
  public void setContextData(ContextData contextData) {
    this.m_contextData = contextData;
  }
  
  /**
   * Returns the context type specific data.
   * 
   * @return Context data
   */
  public ContextData getContextData() {
    return this.m_contextData;
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.