ExampleFileListenerPlugin.java :  » Source-Control » sourcejammer » examples » Java Open Source

Java Open Source » Source Control » sourcejammer 
sourcejammer » examples » ExampleFileListenerPlugin.java
/*
 *  Copyright (C) 2001, 2002 Robert MacGrogan
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 *
 * $Archive: SourceJammer$
 * $FileName: ExampleFileListenerPlugin.java$
 * $FileID: 4656$
 *
 * Last change:
 * $AuthorName: Rob MacGrogan$
 * $Date: 5/7/03 6:23 PM$
 * $Comment: Fix initPlugin() method signature.$
 */
package examples;

import java.util.Map;

import org.sourcejammer.server.plugin.MissingParamException;
import org.sourcejammer.server.plugin.SJServerFileChangeAdapter;
import org.sourcejammer.server.plugin.SJServerFileEvent;
import org.sourcejammer.server.security.SecurityException;

/**
 * Title: $FileName: ExampleFileListenerPlugin.java$
 * @version $VerNum: 4$
 * @author $AuthorName: Rob MacGrogan$<br><br>
 * 
 * $Description: $<br>
 * $KeyWordsOff: $<br>
 */
public class ExampleFileListenerPlugin extends SJServerFileChangeAdapter {

  public ExampleFileListenerPlugin(){
  }
  
  /**
   * @see org.sourcejammer.server.plugin.SJServerPlugin#initPlugin(HashMap)
   */
  public void initPlugin(Map params) throws MissingParamException{
    super.initPlugin(params);
    System.out.println("The ExampleFileListenerPlugin has been initialized!");
  }

  /**
   * @see org.sourcejammer.server.plugin.SJServerFileChangeListener#fileAdded(SJServerFileEvent)
   */
  public void fileAdded(SJServerFileEvent ev) {
    try{
      ev.getLog().println("[] Added file: " + ev.getArchiveContext().getFile(ev.getFileID()).getNodeName());
    }
    catch(Exception ex){
      ex.printStackTrace(ev.getLog());
    }
  }

  /**
   * @see org.sourcejammer.server.plugin.SJServerFileChangeListener#fileCheckedIn(SJServerFileEvent)
   */
  public void fileCheckedIn(SJServerFileEvent ev) {
    try{
      ev.getLog().println("[] Checked in file: " + ev.getArchiveContext().getFile(ev.getFileID()).getNodeName());
    }
    catch(Exception ex){
      ex.printStackTrace(ev.getLog());
    }
  }

  /**
   * @see org.sourcejammer.server.plugin.SJServerFileChangeListener#fileCheckedOut(SJServerFileEvent)
   */
  public void fileCheckedOut(SJServerFileEvent ev) {
    try{
      ev.getLog().println("[] Checked Out file: " + ev.getArchiveContext().getFile(ev.getFileID()).getNodeName());
    }
    catch(Exception ex){
      ex.printStackTrace(ev.getLog());
    }
  }

  /**
   * @see org.sourcejammer.server.plugin.SJServerFileChangeListener#latestVersionRequested(SJServerFileEvent)
   */
  public void latestVersionRequested(SJServerFileEvent ev) {
    try{
      ev.getLog().println("[] Got latest version of file: " + ev.getArchiveContext().getFile(ev.getFileID()).getNodeName());
    }
    catch(Exception ex){
      ex.printStackTrace(ev.getLog());
    }
  }

  /**
   * @see org.sourcejammer.server.plugin.SJServerFileChangeListener#specificVesionRequested(SJServerFileEvent)
   */
  public void specificVesionRequested(SJServerFileEvent ev) {
    try{
      ev.getLog().println("[] Got version " + ev.getVersionNumber() + " of file "  + ev.getArchiveContext().getFile(ev.getFileID()).getNodeName());
    }
    catch(Exception ex){
      ex.printStackTrace(ev.getLog());
    }
  }

}
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.