use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.
the class NifiRestTest method testCreateFeed1.
// @Test
public void testCreateFeed1() {
TemplateDTO templateDTO = restClient.getTemplateByName("New Data Ingest");
String inputType = "org.apache.nifi.processors.standard.GetFile";
NifiProcessorSchedule schedule = new NifiProcessorSchedule();
schedule.setSchedulingStrategy("TIMER_DRIVEN");
schedule.setSchedulingPeriod("10 sec");
String inputPortName = "From Data Ingest Feed";
String feedOutputPortName = "To Data Ingest";
FeedMetadata feedMetadata = new FeedMetadata();
feedMetadata.setCategory(new FeedCategory());
feedMetadata.getCategory().setSystemName("online");
feedMetadata.setSystemFeedName("Scotts Feed");
CreateFeedBuilder.newFeed(restClient, nifiFlowCache, feedMetadata, templateDTO.getId(), new PropertyExpressionResolver(), propertyDescriptorTransform, createFeedBuilderCache, templateConnectionUtil).inputProcessorType(inputType).feedSchedule(schedule).addInputOutputPort(new InputOutputPort(inputPortName, feedOutputPortName)).build();
}
use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.
the class TableSetupTest method test.
@Test
public void test() throws Exception {
ObjectMapper mapper = new ObjectMapper();
FeedMetadata feedMetadata = new FeedMetadata();
feedMetadata.setCategory(new FeedCategory());
feedMetadata.setTable(new TableSetup());
feedMetadata.getTable().setTableSchema(new DefaultTableSchema());
feedMetadata.getTable().getTableSchema().setName("test");
DefaultField f1 = new DefaultField();
f1.setName("field1");
feedMetadata.getTable().getTableSchema().getFields().add(f1);
String json = mapper.writeValueAsString(feedMetadata);
FeedMetadata feedMetadata2 = mapper.readValue(json, FeedMetadata.class);
assertEquals(feedMetadata2.getTable().getTableSchema().getName(), feedMetadata.getTable().getTableSchema().getName());
}
use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.
the class FeedManagerMetadataService method disableFeed.
public FeedSummary disableFeed(final String feedId) {
return metadataAccess.commit(() -> {
this.accessController.checkPermission(AccessController.SERVICES, FeedServicesAccessControl.EDIT_FEEDS);
FeedMetadata feedMetadata = feedProvider.getFeedById(feedId);
if (feedMetadata == null) {
throw new NotFoundException("Feed not found for id " + feedId);
}
if (!feedMetadata.getState().equals(Feed.State.DISABLED.name())) {
FeedSummary feedSummary = feedProvider.disableFeed(feedId);
boolean updatedNifi = updateNifiFeedRunningStatus(feedSummary, Feed.State.DISABLED);
if (!updatedNifi) {
// rollback
throw new RuntimeException("Unable to disable Feed " + feedId);
}
return feedSummary;
}
return new FeedSummary(feedMetadata);
});
}
use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.
the class FileObjectPersistence method getFeedsFromFile.
public Collection<FeedMetadata> getFeedsFromFile() {
ObjectMapper mapper = new ObjectMapper();
File file = new File(filePath + "/" + FEED_METADATA_FILENAME);
Collection<FeedMetadata> feeds = null;
if (file.exists()) {
try {
feeds = mapper.readValue(file, new TypeReference<List<FeedMetadata>>() {
});
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return feeds;
}
use of com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata in project kylo by Teradata.
the class DefaultFeedManagerFeedService method enableFeed.
private boolean enableFeed(final Feed.ID feedId) {
return metadataAccess.commit(() -> {
boolean enabled = feedProvider.enableFeed(feedId);
Feed domainFeed = feedProvider.findById(feedId);
if (domainFeed != null) {
domainFeed.setState(Feed.State.ENABLED);
feedProvider.update(domainFeed);
if (enabled) {
FeedMetadata feedMetadata = feedModelTransform.domainToFeedMetadata(domainFeed);
notifyFeedStateChange(feedMetadata, feedId, Feed.State.ENABLED, MetadataChange.ChangeType.UPDATE);
}
}
return enabled;
});
}
Aggregations