SJServerActionAdapter.java :  » Source-Control » sourcejammer » org » sourcejammer » server » plugin » Java Open Source

Java Open Source » Source Control » sourcejammer 
sourcejammer » org » sourcejammer » server » plugin » SJServerActionAdapter.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: SJServerActionAdapter.java$
 * $FileID: 4647$
 *
 * Last change:
 * $AuthorName: Rob MacGrogan$
 * $Date: 7/26/03 3:55 AM$
 * $Comment: Add work directory implementation.$
 */
package org.sourcejammer.server.plugin;

import java.util.Map;

import org.sourcejammer.project.view.SJRequest;
import org.sourcejammer.project.view.SJResponse;

/**
 * Title: $FileName: SJServerActionAdapter.java$
 * @version $VerNum: 4$
 * @author $AuthorName: Rob MacGrogan$<br><br>
 *
 * $Description: For convenience, this adapter is provided. It
 *              implements the SJServerAction interface.$<br>
 * $KeyWordsOff: $<br>
 */
public abstract class SJServerActionAdapter implements SJServerAction {

  private Map params = null;
  private java.io.File workDirectory = null;

  public final void setWorkDirectory(java.io.File workDirectory){
    this.workDirectory = workDirectory;
  }

  /**
   * Returns a pointer to the work directory for this plugin. The directory
   * will only be used by this plugin. A new directory will be created for each
   * Archive this plugin is added to. No files in this directory will be added, 
   * removed, or modified by SourceJammer or any other plugins.<br><br>
   * 
   * Please use common sense in dealing with this directory. Do not store files here
   * unless you really need them. Delete files when you are finished with them.<br><br>
   * 
   * For temp files, you are probably better off using SourceJammer's TempDirectoryManager
   * (in org.sourcejammer.util in the lib package). SJ periodically wipes the temp 
   * directory clean so you don't have to worry about that.
   */
  public java.io.File getWorkDirectory(){
    return workDirectory;
  }

  /**
   * Returns the requested parameter as a String.
   */
  protected String getParameter(String name){
    return (String)params.get(name);
  }

  /**
   * @see org.sourcejammer.server.plugin.SJServerAction#actionPerformed(SJRequest, SJResponse, ArchiveContext)
   */
  public abstract void actionPerformed(SJRequest request, SJResponse response, ArchiveContext arch);

  /**
   * Warning! If you override this method, be sure to call super.initPlugin().
   */
  public void initPlugin(Map params) throws MissingParamException {
    this.params = params;
  }

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