Search in sources :

Example 6 with HDFSFile

use of org.talend.designer.hdfsbrowse.model.HDFSFile in project tbd-studio-se by Talend.

the class ExtractHDFSSchemaManager method extractColumns.

public List<MetadataColumn> extractColumns(HDFSConnection connection, ClassLoader classLoader, IHDFSNode node) throws Exception {
    List<MetadataColumn> columns = new ArrayList<MetadataColumn>();
    if (connection == null || node == null || node.getType() != EHadoopFileTypes.FILE) {
        return columns;
    }
    HDFSFile file = (HDFSFile) node;
    HDFSConnectionBean connectionBean = HDFSModelUtil.convert2HDFSConnectionBean(connection);
    Object filePath = getHDFSFilePath(connectionBean, classLoader, file.getPath());
    IExtractSchemaService<HDFSConnection> service = ExtractHDFSMetaServiceFactory.getService(connectionBean, classLoader, filePath);
    return service.extractColumns(connection, node);
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) HDFSFile(org.talend.designer.hdfsbrowse.model.HDFSFile) HDFSConnectionBean(org.talend.designer.hdfsbrowse.model.HDFSConnectionBean) ArrayList(java.util.ArrayList) HDFSConnection(org.talend.repository.model.hdfs.HDFSConnection)

Example 7 with HDFSFile

use of org.talend.designer.hdfsbrowse.model.HDFSFile in project tbd-studio-se by Talend.

the class ExtractSequenceFileSchemaService method extractColumns.

/*
     * (non-Javadoc)
     *
     * @see
     * org.talend.repository.hadoopcluster.service.IExtractSchemaService#extractColumns(org.talend.repository.model.
     * hadoopcluster.HadoopSubConnection, org.talend.designer.hdfsbrowse.model.IHDFSNode)
     */
@Override
public List<MetadataColumn> extractColumns(HDFSConnection connection, IHDFSNode node) throws Exception {
    if (connection == null || node == null || node.getType() != EHadoopFileTypes.FILE) {
        return Collections.EMPTY_LIST;
    }
    HDFSFile file = (HDFSFile) node;
    file.setFileType(EHDFSFileTypes.SEQUENCE);
    return extractColumns(connection, file.getPath());
}
Also used : HDFSFile(org.talend.designer.hdfsbrowse.model.HDFSFile)

Aggregations

HDFSFile (org.talend.designer.hdfsbrowse.model.HDFSFile)7 ArrayList (java.util.ArrayList)3 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)3 InputStream (java.io.InputStream)2 URI (java.net.URI)1 HadoopServerException (org.talend.designer.hdfsbrowse.exceptions.HadoopServerException)1 EHadoopFileTypes (org.talend.designer.hdfsbrowse.model.EHadoopFileTypes)1 HDFSConnectionBean (org.talend.designer.hdfsbrowse.model.HDFSConnectionBean)1 HDFSFolder (org.talend.designer.hdfsbrowse.model.HDFSFolder)1 HDFSPath (org.talend.designer.hdfsbrowse.model.HDFSPath)1 IHDFSNode (org.talend.designer.hdfsbrowse.model.IHDFSNode)1 HDFSConnection (org.talend.repository.model.hdfs.HDFSConnection)1