Save This Page
Home » j2ssh-0.2.9-src » com.sshtools.daemon.session » [javadoc | source]
    1   /*
    2    *  SSHTools - Java SSH2 API
    3    *
    4    *  Copyright (C) 2002-2003 Lee David Painter and Contributors.
    5    *
    6    *  Contributions made by:
    7    *
    8    *  Brett Smith
    9    *  Richard Pernavas
   10    *  Erwin Bolwidt
   11    *
   12    *  This program is free software; you can redistribute it and/or
   13    *  modify it under the terms of the GNU General Public License
   14    *  as published by the Free Software Foundation; either version 2
   15    *  of the License, or (at your option) any later version.
   16    *
   17    *  This program is distributed in the hope that it will be useful,
   18    *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   19    *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   20    *  GNU General Public License for more details.
   21    *
   22    *  You should have received a copy of the GNU General Public License
   23    *  along with this program; if not, write to the Free Software
   24    *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
   25    */
   26   package com.sshtools.daemon.session;
   27   
   28   import com.sshtools.j2ssh.configuration;
   29   import com.sshtools.j2ssh.connection;
   30   
   31   
   32   /**
   33    *
   34    *
   35    * @author $author$
   36    * @version $Revision: 1.12 $
   37    */
   38   public class SessionChannelFactory implements ChannelFactory {
   39       /**  */
   40       public final static String SESSION_CHANNEL = "session";
   41       Class sessionChannelImpl;
   42   
   43       /**
   44    * Creates a new SessionChannelFactory object.
   45    *
   46    * @throws ConfigurationException
   47    */
   48       public SessionChannelFactory() throws ConfigurationException {
   49           sessionChannelImpl = SessionChannelServer.class;
   50   
   51           /*ServerConfiguration server = ConfigurationLoader.getServerConfiguration();
   52   sessionChannelImpl = ConfigurationLoader.getServerConfiguration().getSessionChannelImpl();*/
   53       }
   54   
   55       /*public List getChannelType() {
   56    List list = new ArrayList();
   57    list.add(SessionChannelServer.SESSION_CHANNEL_TYPE);
   58    return list;
   59     }*/
   60       public Channel createChannel(String channelType, byte[] requestData)
   61           throws InvalidChannelException {
   62           try {
   63               if (channelType.equals("session")) {
   64                   return (Channel) sessionChannelImpl.newInstance();
   65               } else {
   66                   throw new InvalidChannelException(
   67                       "Only session channels can be opened by this factory");
   68               }
   69           } catch (Exception e) {
   70               throw new InvalidChannelException(
   71                   "Failed to create session channel implemented by " +
   72                   sessionChannelImpl.getName());
   73           }
   74       }
   75   
   76       /*public void setSessionChannelImpl(Class sessionChannelImpl)
   77    throws InvalidChannelException {
   78    try {
   79        Channel channel = (Channel) sessionChannelImpl.newInstance();
   80        if (!(channel instanceof AbstractSessionChannelServer)) {
   81       throw new InvalidChannelException(
   82           "Class does not extend AbstractSessionChannelServer");
   83        }
   84    } catch (Exception e) {
   85        throw new InvalidChannelException(
   86       "Cannot set session channel implementation");
   87    }
   88     }*/
   89   }

Save This Page
Home » j2ssh-0.2.9-src » com.sshtools.daemon.session » [javadoc | source]