mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 20:42:06 +01:00
Refactoring
This commit is contained in:
parent
5895ca8b07
commit
28674a4620
17 changed files with 205 additions and 306 deletions
|
@ -32,11 +32,11 @@ import org.jivesoftware.smack.XMPPException;
|
|||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
import org.jivesoftware.smackx.jft.adapter.JingleFileTransferAdapter;
|
||||
import org.jivesoftware.smackx.jft.component.JingleFileTransfer;
|
||||
import org.jivesoftware.smackx.jft.component.JingleFileTransferFile;
|
||||
import org.jivesoftware.smackx.jft.component.JingleIncomingFileOffer;
|
||||
import org.jivesoftware.smackx.jft.component.JingleIncomingFileRequest;
|
||||
import org.jivesoftware.smackx.jft.component.JingleOutgoingFileOffer;
|
||||
import org.jivesoftware.smackx.jft.component.JingleOutgoingFileRequest;
|
||||
import org.jivesoftware.smackx.jft.component.file.RemoteFile;
|
||||
import org.jivesoftware.smackx.jft.controller.OutgoingFileOfferController;
|
||||
import org.jivesoftware.smackx.jft.controller.OutgoingFileRequestController;
|
||||
import org.jivesoftware.smackx.jft.listener.IncomingFileOfferListener;
|
||||
|
@ -132,7 +132,7 @@ public final class JingleFileTransferManager extends Manager implements JingleDe
|
|||
return null;
|
||||
}
|
||||
|
||||
public OutgoingFileRequestController requestFile(RemoteFile file, FullJid from) {
|
||||
public OutgoingFileRequestController requestFile(JingleFileTransferFile.RemoteFile file, FullJid from) {
|
||||
JingleOutgoingFileRequest request = new JingleOutgoingFileRequest(file);
|
||||
|
||||
//TODO at some point.
|
||||
|
|
|
@ -16,12 +16,10 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.jft.component;
|
||||
|
||||
import org.jivesoftware.smackx.jft.component.file.AbstractJingleFileTransferFile;
|
||||
|
||||
/**
|
||||
* Created by vanitas on 22.07.17.
|
||||
*/
|
||||
public abstract class AbstractJingleFileOffer<D extends AbstractJingleFileTransferFile> extends JingleFileTransfer {
|
||||
public abstract class AbstractJingleFileOffer<D extends JingleFileTransferFile> extends JingleFileTransfer {
|
||||
|
||||
public AbstractJingleFileOffer(D fileTransferFile) {
|
||||
super(fileTransferFile);
|
||||
|
|
|
@ -16,12 +16,10 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.jft.component;
|
||||
|
||||
import org.jivesoftware.smackx.jft.component.file.AbstractJingleFileTransferFile;
|
||||
|
||||
/**
|
||||
* Created by vanitas on 22.07.17.
|
||||
*/
|
||||
public abstract class AbstractJingleFileRequest<D extends AbstractJingleFileTransferFile> extends JingleFileTransfer {
|
||||
public abstract class AbstractJingleFileRequest<D extends JingleFileTransferFile> extends JingleFileTransfer {
|
||||
|
||||
public AbstractJingleFileRequest(D fileTransferFile) {
|
||||
super(fileTransferFile);
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smackx.jft.component.file.AbstractJingleFileTransferFile;
|
||||
import org.jivesoftware.smackx.jft.controller.JingleFileTransferController;
|
||||
import org.jivesoftware.smackx.jft.element.JingleFileTransferElement;
|
||||
import org.jivesoftware.smackx.jft.listener.ProgressListener;
|
||||
|
@ -38,11 +37,11 @@ public abstract class JingleFileTransfer extends JingleDescription<JingleFileTra
|
|||
public abstract boolean isRequest();
|
||||
|
||||
protected State state;
|
||||
protected AbstractJingleFileTransferFile file;
|
||||
protected JingleFileTransferFile file;
|
||||
|
||||
protected final List<ProgressListener> progressListeners = Collections.synchronizedList(new ArrayList<ProgressListener>());
|
||||
|
||||
public JingleFileTransfer(AbstractJingleFileTransferFile file) {
|
||||
public JingleFileTransfer(JingleFileTransferFile file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,178 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2017 Paul Schaub
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smackx.jft.component;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
|
||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||
import org.jivesoftware.smackx.jft.element.JingleFileTransferChildElement;
|
||||
|
||||
/**
|
||||
* Represent a file sent in a file transfer.
|
||||
* This can be both LocalFile (available to the client), or RemoteFile (file not yet available).
|
||||
*/
|
||||
public abstract class JingleFileTransferFile {
|
||||
|
||||
public JingleFileTransferFile() {
|
||||
|
||||
}
|
||||
|
||||
public JingleFileTransferChildElement getElement() {
|
||||
JingleFileTransferChildElement.Builder builder = JingleFileTransferChildElement.getBuilder();
|
||||
builder.setDate(getDate());
|
||||
builder.setSize(getSize());
|
||||
builder.setName(getName());
|
||||
builder.setDescription(getDescription());
|
||||
builder.setMediaType(getMediaType());
|
||||
builder.setHash(getHashElement());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public abstract Date getDate();
|
||||
|
||||
public abstract long getSize();
|
||||
|
||||
public abstract String getName();
|
||||
|
||||
public abstract String getDescription();
|
||||
|
||||
public abstract String getMediaType();
|
||||
|
||||
public abstract HashElement getHashElement();
|
||||
|
||||
public static class LocalFile extends JingleFileTransferFile {
|
||||
|
||||
private File file;
|
||||
private String name;
|
||||
private String description;
|
||||
private String mediaType;
|
||||
private HashElement hashElement;
|
||||
|
||||
public LocalFile(File file) {
|
||||
this(file, null, null);
|
||||
}
|
||||
|
||||
public LocalFile(File file, String description) {
|
||||
this(file, description, null);
|
||||
}
|
||||
|
||||
public LocalFile(File file, String description, String mediaType) {
|
||||
super();
|
||||
this.file = file;
|
||||
String path = file.getAbsolutePath();
|
||||
name = path.substring(path.lastIndexOf(File.separator) + 1);
|
||||
this.description = description;
|
||||
this.mediaType = mediaType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getDate() {
|
||||
return new Date(file.lastModified());
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return file.length();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMediaType() {
|
||||
return mediaType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashElement getHashElement() {
|
||||
return hashElement;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setMediaType(String mediaType) {
|
||||
this.mediaType = mediaType;
|
||||
}
|
||||
|
||||
public void setHashElement(HashElement hashElement) {
|
||||
this.hashElement = hashElement;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
public static class RemoteFile extends JingleFileTransferFile {
|
||||
|
||||
private JingleFileTransferChildElement file;
|
||||
|
||||
public RemoteFile(JingleFileTransferChildElement file) {
|
||||
super();
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return file.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMediaType() {
|
||||
return file.getMediaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashElement getHashElement() {
|
||||
return file.getHash();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getDate() {
|
||||
return file.getDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return file.getSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return file.getName();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -29,7 +29,6 @@ import org.jivesoftware.smack.SmackException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
||||
import org.jivesoftware.smackx.jft.component.file.RemoteFile;
|
||||
import org.jivesoftware.smackx.jft.controller.IncomingFileOfferController;
|
||||
import org.jivesoftware.smackx.jft.element.JingleFileTransferChildElement;
|
||||
import org.jivesoftware.smackx.jingle.component.JingleSession;
|
||||
|
@ -40,14 +39,14 @@ import org.jivesoftware.smackx.jingle.element.JingleElement;
|
|||
* Behind the scenes logic of an incoming Jingle file offer.
|
||||
* Created by vanitas on 26.07.17.
|
||||
*/
|
||||
public class JingleIncomingFileOffer extends AbstractJingleFileOffer<RemoteFile> implements IncomingFileOfferController {
|
||||
public class JingleIncomingFileOffer extends AbstractJingleFileOffer<JingleFileTransferFile.RemoteFile> implements IncomingFileOfferController {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(JingleIncomingFileOffer.class.getName());
|
||||
|
||||
private File target;
|
||||
|
||||
public JingleIncomingFileOffer(JingleFileTransferChildElement offer) {
|
||||
super(new RemoteFile(offer));
|
||||
super(new JingleFileTransferFile.RemoteFile(offer));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -133,7 +132,7 @@ public class JingleIncomingFileOffer extends AbstractJingleFileOffer<RemoteFile>
|
|||
}
|
||||
|
||||
@Override
|
||||
public RemoteFile getFile() {
|
||||
return (RemoteFile) this.file;
|
||||
public JingleFileTransferFile.RemoteFile getFile() {
|
||||
return (JingleFileTransferFile.RemoteFile) this.file;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.jivesoftware.smackx.jft.component;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
||||
import org.jivesoftware.smackx.jft.component.file.RemoteFile;
|
||||
import org.jivesoftware.smackx.jft.controller.IncomingFileRequestController;
|
||||
import org.jivesoftware.smackx.jft.element.JingleFileTransferChildElement;
|
||||
import org.jivesoftware.smackx.jft.element.JingleFileTransferElement;
|
||||
|
@ -28,10 +27,10 @@ import org.jivesoftware.smackx.jingle.element.JingleElement;
|
|||
* Created by vanitas on 27.07.17.
|
||||
* TODO: RemoteFile????
|
||||
*/
|
||||
public class JingleIncomingFileRequest extends AbstractJingleFileRequest<RemoteFile> implements IncomingFileRequestController {
|
||||
public class JingleIncomingFileRequest extends AbstractJingleFileRequest<JingleFileTransferFile.RemoteFile> implements IncomingFileRequestController {
|
||||
|
||||
public JingleIncomingFileRequest(JingleFileTransferChildElement request) {
|
||||
super(new RemoteFile(request));
|
||||
super(new JingleFileTransferFile.RemoteFile(request));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,7 +59,7 @@ public class JingleIncomingFileRequest extends AbstractJingleFileRequest<RemoteF
|
|||
}
|
||||
|
||||
@Override
|
||||
public RemoteFile getFile() {
|
||||
return (RemoteFile) file;
|
||||
public JingleFileTransferFile.RemoteFile getFile() {
|
||||
return (JingleFileTransferFile.RemoteFile) file;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
||||
import org.jivesoftware.smackx.jft.component.file.LocalFile;
|
||||
import org.jivesoftware.smackx.jft.controller.OutgoingFileOfferController;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionInfoElement;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleElement;
|
||||
|
@ -33,11 +32,11 @@ import org.jivesoftware.smackx.jingle.element.JingleElement;
|
|||
/**
|
||||
* Created by vanitas on 26.07.17.
|
||||
*/
|
||||
public class JingleOutgoingFileOffer extends AbstractJingleFileOffer<LocalFile> implements OutgoingFileOfferController {
|
||||
public class JingleOutgoingFileOffer extends AbstractJingleFileOffer<JingleFileTransferFile.LocalFile> implements OutgoingFileOfferController {
|
||||
private static final Logger LOGGER = Logger.getLogger(JingleOutgoingFileOffer.class.getName());
|
||||
|
||||
public JingleOutgoingFileOffer(File file) {
|
||||
super(new LocalFile(file));
|
||||
super(new JingleFileTransferFile.LocalFile(file));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +46,7 @@ public class JingleOutgoingFileOffer extends AbstractJingleFileOffer<LocalFile>
|
|||
|
||||
@Override
|
||||
public void onBytestreamReady(BytestreamSession bytestreamSession) {
|
||||
File mFile = ((LocalFile) file).getFile();
|
||||
File mFile = ((JingleFileTransferFile.LocalFile) file).getFile();
|
||||
OutputStream outputStream = null;
|
||||
InputStream inputStream = null;
|
||||
|
||||
|
@ -89,7 +88,7 @@ public class JingleOutgoingFileOffer extends AbstractJingleFileOffer<LocalFile>
|
|||
}
|
||||
|
||||
@Override
|
||||
public LocalFile getFile() {
|
||||
return (LocalFile) file;
|
||||
public JingleFileTransferFile.LocalFile getFile() {
|
||||
return (JingleFileTransferFile.LocalFile) file;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.jivesoftware.smackx.jft.component;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
||||
import org.jivesoftware.smackx.jft.component.file.RemoteFile;
|
||||
import org.jivesoftware.smackx.jft.controller.OutgoingFileRequestController;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleContentDescriptionInfoElement;
|
||||
import org.jivesoftware.smackx.jingle.element.JingleElement;
|
||||
|
@ -25,15 +24,15 @@ import org.jivesoftware.smackx.jingle.element.JingleElement;
|
|||
/**
|
||||
* Created by vanitas on 27.07.17.
|
||||
*/
|
||||
public class JingleOutgoingFileRequest extends AbstractJingleFileRequest<RemoteFile> implements OutgoingFileRequestController {
|
||||
public class JingleOutgoingFileRequest extends AbstractJingleFileRequest<JingleFileTransferFile.RemoteFile> implements OutgoingFileRequestController {
|
||||
|
||||
public JingleOutgoingFileRequest(RemoteFile file) {
|
||||
public JingleOutgoingFileRequest(JingleFileTransferFile.RemoteFile file) {
|
||||
super(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RemoteFile getFile() {
|
||||
return (RemoteFile) file;
|
||||
public JingleFileTransferFile.RemoteFile getFile() {
|
||||
return (JingleFileTransferFile.RemoteFile) file;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2017 Paul Schaub
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smackx.jft.component.file;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||
import org.jivesoftware.smackx.jft.element.JingleFileTransferChildElement;
|
||||
|
||||
/**
|
||||
* Created by vanitas on 26.07.17.
|
||||
*/
|
||||
public abstract class AbstractJingleFileTransferFile {
|
||||
|
||||
public AbstractJingleFileTransferFile() {
|
||||
|
||||
}
|
||||
|
||||
public JingleFileTransferChildElement getElement() {
|
||||
JingleFileTransferChildElement.Builder builder = JingleFileTransferChildElement.getBuilder();
|
||||
builder.setDate(getDate());
|
||||
builder.setSize(getSize());
|
||||
builder.setName(getName());
|
||||
builder.setDescription(getDescription());
|
||||
builder.setMediaType(getMediaType());
|
||||
builder.setHash(getHashElement());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public abstract Date getDate();
|
||||
|
||||
public abstract long getSize();
|
||||
|
||||
public abstract String getName();
|
||||
|
||||
public abstract String getDescription();
|
||||
|
||||
public abstract String getMediaType();
|
||||
|
||||
public abstract HashElement getHashElement();
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2017 Paul Schaub
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smackx.jft.component.file;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
|
||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||
|
||||
/**
|
||||
* Created by vanitas on 26.07.17.
|
||||
*/
|
||||
public class LocalFile extends AbstractJingleFileTransferFile {
|
||||
|
||||
private File file;
|
||||
private String name;
|
||||
private String description;
|
||||
private String mediaType;
|
||||
private HashElement hashElement;
|
||||
|
||||
public LocalFile(File file) {
|
||||
this(file, null, null);
|
||||
}
|
||||
|
||||
public LocalFile(File file, String description) {
|
||||
this(file, description, null);
|
||||
}
|
||||
|
||||
public LocalFile(File file, String description, String mediaType) {
|
||||
super();
|
||||
this.file = file;
|
||||
String path = file.getAbsolutePath();
|
||||
name = path.substring(path.lastIndexOf(File.separator) + 1);
|
||||
this.description = description;
|
||||
this.mediaType = mediaType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getDate() {
|
||||
return new Date(file.lastModified());
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return file.length();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMediaType() {
|
||||
return mediaType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashElement getHashElement() {
|
||||
return hashElement;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setMediaType(String mediaType) {
|
||||
this.mediaType = mediaType;
|
||||
}
|
||||
|
||||
public void setHashElement(HashElement hashElement) {
|
||||
this.hashElement = hashElement;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2017 Paul Schaub
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smackx.jft.component.file;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||
import org.jivesoftware.smackx.jft.element.JingleFileTransferChildElement;
|
||||
|
||||
/**
|
||||
* Created by vanitas on 26.07.17.
|
||||
*/
|
||||
public class RemoteFile extends AbstractJingleFileTransferFile {
|
||||
|
||||
private JingleFileTransferChildElement file;
|
||||
|
||||
public RemoteFile(JingleFileTransferChildElement file) {
|
||||
super();
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return file.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMediaType() {
|
||||
return file.getMediaType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashElement getHashElement() {
|
||||
return file.getHash();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getDate() {
|
||||
return file.getDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return file.getSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return file.getName();
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2017 Paul Schaub
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Smack's API for <a href="https://xmpp.org/extensions/xep-0234.html">XEP-0234: Jingle File Transfer</a>.
|
||||
* Classes that may represent files.
|
||||
*/
|
||||
package org.jivesoftware.smackx.jft.component.file;
|
|
@ -16,12 +16,12 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.jft.controller;
|
||||
|
||||
import org.jivesoftware.smackx.jft.component.file.AbstractJingleFileTransferFile;
|
||||
import org.jivesoftware.smackx.jft.component.JingleFileTransferFile;
|
||||
import org.jivesoftware.smackx.jft.listener.ProgressListener;
|
||||
import org.jivesoftware.smackx.jingle.JingleDescriptionController;
|
||||
|
||||
/**
|
||||
* Created by vanitas on 27.07.17.
|
||||
* User interface for Jingle file transfers.
|
||||
*/
|
||||
public interface JingleFileTransferController extends JingleDescriptionController {
|
||||
|
||||
|
@ -29,5 +29,5 @@ public interface JingleFileTransferController extends JingleDescriptionControlle
|
|||
|
||||
void removeProgressListener(ProgressListener listener);
|
||||
|
||||
AbstractJingleFileTransferFile getFile();
|
||||
JingleFileTransferFile getFile();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.SmackFuture;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
||||
|
@ -32,7 +31,7 @@ import org.jivesoftware.smackx.jingle.element.JingleElement;
|
|||
/**
|
||||
* Class that represents a contents transport component.
|
||||
*/
|
||||
public abstract class JingleTransport<D extends JingleContentTransportElement> extends SmackFuture<BytestreamSession> {
|
||||
public abstract class JingleTransport<D extends JingleContentTransportElement> {
|
||||
|
||||
private JingleContent parent;
|
||||
private final ArrayList<JingleTransportCandidate<?>> ourCandidates = new ArrayList<>();
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.jivesoftware.smack.SmackException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
||||
import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamListener;
|
||||
|
@ -148,14 +147,4 @@ public class JingleIBBTransport extends JingleTransport<JingleIBBTransportElemen
|
|||
public IQ handleTransportInfo(JingleContentTransportInfoElement info, JingleElement wrapping) {
|
||||
return IQ.createResultIQ(wrapping);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isNonFatalException(Exception exception) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleStanza(Stanza stanza) throws SmackException.NotConnectedException, InterruptedException {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.jivesoftware.smack.SmackException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.util.Async;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5BytestreamSession;
|
||||
import org.jivesoftware.smackx.bytestreams.socks5.Socks5Proxy;
|
||||
|
@ -464,14 +463,4 @@ public class JingleS5BTransport extends JingleTransport<JingleS5BTransportElemen
|
|||
* Kinda depressing, isn't it?
|
||||
*/
|
||||
private final static JingleS5BTransportCandidate CANDIDATE_FAILURE = new JingleS5BTransportCandidate(null, null, -1, null);
|
||||
|
||||
@Override
|
||||
protected boolean isNonFatalException(Exception exception) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleStanza(Stanza stanza) throws SmackException.NotConnectedException, InterruptedException {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue