001: /*
002: * Copyright (C) 2001, 2002 Robert MacGrogan
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: *
018: *
019: * $Archive: SourceJammer$
020: * $FileName: ExampleFileListenerPlugin.java$
021: * $FileID: 4656$
022: *
023: * Last change:
024: * $AuthorName: Rob MacGrogan$
025: * $Date: 5/7/03 6:23 PM$
026: * $Comment: Fix initPlugin() method signature.$
027: */
028: package examples;
029:
030: import java.util.Map;
031:
032: import org.sourcejammer.server.plugin.MissingParamException;
033: import org.sourcejammer.server.plugin.SJServerFileChangeAdapter;
034: import org.sourcejammer.server.plugin.SJServerFileEvent;
035: import org.sourcejammer.server.security.SecurityException;
036:
037: /**
038: * Title: $FileName: ExampleFileListenerPlugin.java$
039: * @version $VerNum: 4$
040: * @author $AuthorName: Rob MacGrogan$<br><br>
041: *
042: * $Description: $<br>
043: * $KeyWordsOff: $<br>
044: */
045: public class ExampleFileListenerPlugin extends
046: SJServerFileChangeAdapter {
047:
048: public ExampleFileListenerPlugin() {
049: }
050:
051: /**
052: * @see org.sourcejammer.server.plugin.SJServerPlugin#initPlugin(HashMap)
053: */
054: public void initPlugin(Map params) throws MissingParamException {
055: super .initPlugin(params);
056: System.out
057: .println("The ExampleFileListenerPlugin has been initialized!");
058: }
059:
060: /**
061: * @see org.sourcejammer.server.plugin.SJServerFileChangeListener#fileAdded(SJServerFileEvent)
062: */
063: public void fileAdded(SJServerFileEvent ev) {
064: try {
065: ev.getLog().println(
066: "[] Added file: "
067: + ev.getArchiveContext().getFile(
068: ev.getFileID()).getNodeName());
069: } catch (Exception ex) {
070: ex.printStackTrace(ev.getLog());
071: }
072: }
073:
074: /**
075: * @see org.sourcejammer.server.plugin.SJServerFileChangeListener#fileCheckedIn(SJServerFileEvent)
076: */
077: public void fileCheckedIn(SJServerFileEvent ev) {
078: try {
079: ev.getLog().println(
080: "[] Checked in file: "
081: + ev.getArchiveContext().getFile(
082: ev.getFileID()).getNodeName());
083: } catch (Exception ex) {
084: ex.printStackTrace(ev.getLog());
085: }
086: }
087:
088: /**
089: * @see org.sourcejammer.server.plugin.SJServerFileChangeListener#fileCheckedOut(SJServerFileEvent)
090: */
091: public void fileCheckedOut(SJServerFileEvent ev) {
092: try {
093: ev.getLog().println(
094: "[] Checked Out file: "
095: + ev.getArchiveContext().getFile(
096: ev.getFileID()).getNodeName());
097: } catch (Exception ex) {
098: ex.printStackTrace(ev.getLog());
099: }
100: }
101:
102: /**
103: * @see org.sourcejammer.server.plugin.SJServerFileChangeListener#latestVersionRequested(SJServerFileEvent)
104: */
105: public void latestVersionRequested(SJServerFileEvent ev) {
106: try {
107: ev.getLog().println(
108: "[] Got latest version of file: "
109: + ev.getArchiveContext().getFile(
110: ev.getFileID()).getNodeName());
111: } catch (Exception ex) {
112: ex.printStackTrace(ev.getLog());
113: }
114: }
115:
116: /**
117: * @see org.sourcejammer.server.plugin.SJServerFileChangeListener#specificVesionRequested(SJServerFileEvent)
118: */
119: public void specificVesionRequested(SJServerFileEvent ev) {
120: try {
121: ev.getLog().println(
122: "[] Got version "
123: + ev.getVersionNumber()
124: + " of file "
125: + ev.getArchiveContext().getFile(
126: ev.getFileID()).getNodeName());
127: } catch (Exception ex) {
128: ex.printStackTrace(ev.getLog());
129: }
130: }
131:
132: }
|