use of org.talend.repository.model.hdfs.HDFSConnectionItem in project tbd-studio-se by Talend.
the class HDFSConnectionTestUtils method createHDFSItem.
public static HDFSConnectionItem createHDFSItem(String id, String name) {
HDFSConnection connection = HDFSFactory.eINSTANCE.createHDFSConnection();
// $NON-NLS-1$
connection.setRowSeparator("\\n");
// $NON-NLS-1$
connection.setFieldSeparator(";");
// $NON-NLS-1$
connection.setHeaderValue("2");
Property connectionProperty = PropertiesFactory.eINSTANCE.createProperty();
connectionProperty.setAuthor(((RepositoryContext) CoreRuntimePlugin.getInstance().getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
connectionProperty.setVersion(VersionUtils.DEFAULT_VERSION);
// $NON-NLS-1$
connectionProperty.setStatusCode("");
connectionProperty.setId(id);
connectionProperty.setLabel(name);
HDFSConnectionItem connectionItem = HDFSFactory.eINSTANCE.createHDFSConnectionItem();
connectionItem.setProperty(connectionProperty);
connectionItem.setConnection(connection);
return connectionItem;
}
use of org.talend.repository.model.hdfs.HDFSConnectionItem in project tbd-studio-se by Talend.
the class HDFSDragAndDropHandler method filterNeededComponents.
@Override
public List<IComponent> filterNeededComponents(Item item, RepositoryNode seletetedNode, ERepositoryObjectType type) {
List<IComponent> neededComponents = new ArrayList<IComponent>();
if (!(item instanceof HDFSConnectionItem)) {
return neededComponents;
}
IComponentsService service = (IComponentsService) GlobalServiceRegister.getDefault().getService(IComponentsService.class);
Collection<IComponent> components = service.getComponentsFactory().readComponents();
for (IComponent component : components) {
if (isValid(item, type, seletetedNode, component, HDFS) && !neededComponents.contains(component)) {
neededComponents.add(component);
}
}
return neededComponents;
}
use of org.talend.repository.model.hdfs.HDFSConnectionItem in project tbd-studio-se by Talend.
the class HDFSRepositoryContentHandler method create.
@Override
public Resource create(IProject project, Item item, int classifierID, IPath path) throws PersistenceException {
Resource itemResource = null;
if (item.eClass() == HDFSPackage.Literals.HDFS_CONNECTION_ITEM) {
ERepositoryObjectType type = HDFSRepositoryNodeType.HDFS;
itemResource = create(project, (HDFSConnectionItem) item, path, type);
}
return itemResource;
}
use of org.talend.repository.model.hdfs.HDFSConnectionItem in project tbd-studio-se by Talend.
the class HDFSDragAndDropHandler method getCorrespondingComponentName.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public IComponentName getCorrespondingComponentName(Item item, ERepositoryObjectType type) {
RepositoryComponentSetting setting = null;
if (item instanceof HDFSConnectionItem) {
setting = new RepositoryComponentSetting();
setting.setName(HDFS);
setting.setRepositoryType(HDFS);
setting.setWithSchema(true);
setting.setInputComponent(INPUT);
setting.setOutputComponent(OUTPUT);
List<Class<Item>> list = new ArrayList<Class<Item>>();
Class clazz = null;
try {
clazz = Class.forName(HDFSConnectionItem.class.getName());
} catch (ClassNotFoundException e) {
ExceptionHandler.process(e);
}
list.add(clazz);
setting.setClasses(list.toArray(new Class[0]));
}
return setting;
}
use of org.talend.repository.model.hdfs.HDFSConnectionItem in project tbd-studio-se by Talend.
the class CreateHDFSSchemaAction method doRun.
@Override
protected void doRun() {
if (repositoryNode == null) {
repositoryNode = getCurrentRepositoryNode();
}
HDFSConnection connection = null;
MetadataTable metadataTable = null;
boolean creation = false;
if (repositoryNode.getType() == ENodeType.REPOSITORY_ELEMENT) {
ERepositoryObjectType nodeType = (ERepositoryObjectType) repositoryNode.getProperties(EProperties.CONTENT_TYPE);
String metadataTableLabel = (String) repositoryNode.getProperties(EProperties.LABEL);
HDFSConnectionItem item = null;
if (nodeType == ERepositoryObjectType.METADATA_CON_TABLE) {
item = (HDFSConnectionItem) repositoryNode.getObject().getProperty().getItem();
connection = (HDFSConnection) item.getConnection();
metadataTable = TableHelper.findByLabel(connection, metadataTableLabel);
creation = false;
} else if (nodeType == HDFSRepositoryNodeType.HDFS) {
item = (HDFSConnectionItem) repositoryNode.getObject().getProperty().getItem();
connection = (HDFSConnection) item.getConnection();
creation = true;
} else {
return;
}
boolean isOK = true;
if (creation) {
isOK = checkHDFSConnection((HDFSConnection) item.getConnection());
}
if (isOK) {
openHDFSSchemaWizard(item, metadataTable, false, creation);
}
}
}
Aggregations