use of org.talend.repository.model.hcatalog.HCatalogConnectionItem in project tbd-studio-se by Talend.
the class HCatalogRepositoryContentHandler method create.
@Override
public Resource create(IProject project, Item item, int classifierID, IPath path) throws PersistenceException {
if (item.eClass() == HCatalogPackage.Literals.HCATALOG_CONNECTION_ITEM) {
Resource itemResource = null;
ERepositoryObjectType type;
type = HCatalogRepositoryNodeType.HCATALOG;
itemResource = create(project, (HCatalogConnectionItem) item, path, type);
return itemResource;
}
return null;
}
use of org.talend.repository.model.hcatalog.HCatalogConnectionItem in project tbd-studio-se by Talend.
the class HCatalogDragAndDropHandler method getCorrespondingComponentName.
@Override
public IComponentName getCorrespondingComponentName(Item item, ERepositoryObjectType type) {
RepositoryComponentSetting setting = null;
if (item instanceof HCatalogConnectionItem) {
setting = new RepositoryComponentSetting();
setting.setName(HCATALOG);
setting.setRepositoryType(HCATALOG);
setting.setWithSchema(true);
setting.setInputComponent(INPUT);
setting.setOutputComponent(OUTPUT);
List<Class<Item>> list = new ArrayList<Class<Item>>();
Class clazz = null;
try {
clazz = Class.forName(HCatalogConnectionItem.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.hcatalog.HCatalogConnectionItem in project tbd-studio-se by Talend.
the class CreateHCatalogSchemaAction method doRun.
@Override
protected void doRun() {
if (repositoryNode == null) {
repositoryNode = getCurrentRepositoryNode();
}
HCatalogConnection 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);
HCatalogConnectionItem item = null;
if (nodeType == ERepositoryObjectType.METADATA_CON_TABLE) {
item = (HCatalogConnectionItem) repositoryNode.getObject().getProperty().getItem();
connection = (HCatalogConnection) item.getConnection();
metadataTable = TableHelper.findByLabel(connection, metadataTableLabel);
creation = false;
} else if (nodeType == HCatalogRepositoryNodeType.HCATALOG) {
item = (HCatalogConnectionItem) repositoryNode.getObject().getProperty().getItem();
connection = (HCatalogConnection) item.getConnection();
creation = true;
} else {
return;
}
boolean isOK = true;
if (creation) {
isOK = checkHCatalogConnection((HCatalogConnection) item.getConnection());
}
if (isOK) {
openHCatalogSchemaWizard(item, metadataTable, false, creation);
}
}
}
use of org.talend.repository.model.hcatalog.HCatalogConnectionItem in project tbd-studio-se by Talend.
the class HCatalogRepositoryContentHandler method save.
@Override
public Resource save(Item item) throws PersistenceException {
if (item.eClass() == HCatalogPackage.Literals.HCATALOG_CONNECTION_ITEM) {
Resource itemResource = null;
itemResource = save((HCatalogConnectionItem) item);
return itemResource;
}
return null;
}
use of org.talend.repository.model.hcatalog.HCatalogConnectionItem in project tbd-studio-se by Talend.
the class HCatalogDragAndDropHandler method filterNeededComponents.
@Override
public List<IComponent> filterNeededComponents(Item item, RepositoryNode seletetedNode, ERepositoryObjectType type) {
List<IComponent> neededComponents = new ArrayList<IComponent>();
if (!(item instanceof HCatalogConnectionItem)) {
return neededComponents;
}
IComponentsService service = GlobalServiceRegister.getDefault().getService(IComponentsService.class);
Collection<IComponent> components = service.getComponentsFactory().readComponents();
for (IComponent component : components) {
if (isValid(item, type, seletetedNode, component, HCATALOG) && !neededComponents.contains(component)) {
neededComponents.add(component);
}
}
return neededComponents;
}
Aggregations