use of org.bimserver.plugins.services.ProgressHandler in project BIMserver by opensourceBIM.
the class BimServerClient method checkin.
public SLongCheckinActionState checkin(long poid, String comment, long deserializerOid, long fileSize, String filename, InputStream inputStream, CheckinProgressHandler progressHandler) throws ServerException, UserException, PublicInterfaceNotFoundException {
long topicId = getServiceInterface().initiateCheckin(poid, deserializerOid);
ProgressHandler progressHandlerWrapper = new ProgressHandler() {
@Override
public void progress(SLongActionState state) {
progressHandler.progress(state.getTitle(), state.getProgress());
}
};
getNotificationsManager().registerProgressHandler(topicId, progressHandlerWrapper);
return channel.checkinSync(baseAddress, token, poid, comment, deserializerOid, false, fileSize, filename, inputStream, topicId);
}
use of org.bimserver.plugins.services.ProgressHandler in project BIMserver by opensourceBIM.
the class BimServerClient method checkin.
public SLongCheckinActionState checkin(long poid, String comment, long deserializerOid, URL url, CheckinProgressHandler progressHandler) throws ServerException, UserException, PublicInterfaceNotFoundException {
long topicId = getServiceInterface().initiateCheckin(poid, deserializerOid);
ProgressHandler progressHandlerWrapper = new ProgressHandler() {
@Override
public void progress(SLongActionState state) {
progressHandler.progress(state.getTitle(), state.getProgress());
}
};
getNotificationsManager().registerProgressHandler(topicId, progressHandlerWrapper);
try {
InputStream openStream = url.openStream();
try {
channel.checkinAsync(baseAddress, token, poid, comment, deserializerOid, false, -1, url.toString(), openStream, topicId);
} finally {
openStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
getNotificationsManager().unregisterProgressHandler(topicId, progressHandlerWrapper);
return (SLongCheckinActionState) getRegistry().getProgress(topicId);
}
use of org.bimserver.plugins.services.ProgressHandler in project BIMserver by opensourceBIM.
the class BimServerClient method checkinSync.
public SLongCheckinActionState checkinSync(long poid, String comment, long deserializerOid, Path file, CheckinProgressHandler progressHandler) throws ServerException, UserException, PublicInterfaceNotFoundException {
long topicId = getServiceInterface().initiateCheckin(poid, deserializerOid);
ProgressHandler progressHandlerWrapper = new ProgressHandler() {
@Override
public void progress(SLongActionState state) {
progressHandler.progress(state.getTitle(), state.getProgress());
}
};
getNotificationsManager().registerProgressHandler(topicId, progressHandlerWrapper);
try (InputStream newInputStream = Files.newInputStream(file)) {
SLongCheckinActionState checkinSync = channel.checkinSync(baseAddress, token, poid, comment, deserializerOid, false, Files.size(file), file.getFileName().toString(), newInputStream, topicId);
getNotificationsManager().unregisterProgressHandler(topicId, progressHandlerWrapper);
return checkinSync;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
Aggregations