Search in sources :

Example 1 with FileStoreProxy

use of org.knime.core.data.filestore.internal.FileStoreProxy in project knime-core by knime.

the class FileStorePortObject method retrieveFileStoreHandlerFrom.

/**
 * @noreference This method is not intended to be referenced by clients.
 */
final void retrieveFileStoreHandlerFrom(final List<FileStoreKey> keys, final FileStoreHandlerRepository fileStoreHandlerRepository) throws IOException {
    assert m_fileStoreProxies.isEmpty() : "FileStore list expected to be empty after construction: " + ConvenienceMethods.getShortStringFrom(m_fileStoreProxies, 3);
    for (FileStoreKey key : keys) {
        FileStoreProxy proxy = new FileStoreProxy();
        proxy.retrieveFileStoreHandlerFrom(key, fileStoreHandlerRepository);
        m_fileStoreProxies.add(proxy);
    }
    m_fileStoreProxies.trimToSize();
    postConstruct();
}
Also used : FileStoreProxy(org.knime.core.data.filestore.internal.FileStoreProxy)

Example 2 with FileStoreProxy

use of org.knime.core.data.filestore.internal.FileStoreProxy in project knime-core by knime.

the class FileStoreUtil method retrieveFileStoreHandlers.

/**
 * @noreference This method is not intended to be referenced by clients.
 */
public static void retrieveFileStoreHandlers(final FileStorePortObject sourceFSObj, final FileStorePortObject resultFSObj, final IWriteFileStoreHandler newHandler) throws IOException {
    List<FileStoreProxy> sourceFSProxies = sourceFSObj.getFileStoreProxies();
    List<FileStoreKey> sourceFSKeys = new ArrayList<FileStoreKey>(sourceFSProxies.size());
    FileStoreHandlerRepository commonFSHandlerRepo = null;
    for (FileStoreProxy proxy : sourceFSProxies) {
        FileStoreKey newKey;
        if (newHandler != null) {
            newKey = newHandler.translateToLocal(proxy.getFileStore(), resultFSObj);
        } else {
            newKey = proxy.getFileStoreKey();
        }
        sourceFSKeys.add(newKey);
        FileStoreHandlerRepository fsHandlerRepo = proxy.getFileStoreHandler().getFileStoreHandlerRepository();
        if (commonFSHandlerRepo == null) {
            commonFSHandlerRepo = fsHandlerRepo;
        } else {
            assert commonFSHandlerRepo == fsHandlerRepo : "File Stores in port object have different file " + "store handler repositories: " + commonFSHandlerRepo + " vs. " + fsHandlerRepo;
        }
    }
    FileStoreHandlerRepository resultRepos = newHandler != null ? newHandler.getFileStoreHandlerRepository() : commonFSHandlerRepo;
    resultFSObj.retrieveFileStoreHandlerFrom(sourceFSKeys, resultRepos);
}
Also used : FileStoreHandlerRepository(org.knime.core.data.filestore.internal.FileStoreHandlerRepository) ArrayList(java.util.ArrayList) FileStoreProxy(org.knime.core.data.filestore.internal.FileStoreProxy)

Aggregations

FileStoreProxy (org.knime.core.data.filestore.internal.FileStoreProxy)2 ArrayList (java.util.ArrayList)1 FileStoreHandlerRepository (org.knime.core.data.filestore.internal.FileStoreHandlerRepository)1