001/** 002 * 003 * Copyright 2017 Paul Schaub 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smackx.jingle.transports; 018 019import org.jivesoftware.smack.AbstractConnectionListener; 020import org.jivesoftware.smack.XMPPConnection; 021import org.jivesoftware.smackx.jingle.JingleSession; 022import org.jivesoftware.smackx.jingle.element.JingleContentTransport; 023 024/** 025 * Manager for a JingleTransport method. 026 * @param <D> JingleContentTransport. 027 */ 028public abstract class JingleTransportManager<D extends JingleContentTransport> extends AbstractConnectionListener { 029 030 private final XMPPConnection connection; 031 032 public JingleTransportManager(XMPPConnection connection) { 033 this.connection = connection; 034 connection.addConnectionListener(this); 035 } 036 037 public XMPPConnection getConnection() { 038 return connection; 039 } 040 041 public abstract String getNamespace(); 042 043 public abstract JingleTransportSession<D> transportSession(JingleSession jingleSession); 044 045 046 @Override 047 public void connected(XMPPConnection connection) { 048 } 049 050 @Override 051 public void connectionClosed() { 052 053 } 054 055 @Override 056 public void connectionClosedOnError(Exception e) { 057 058 } 059 060}