本文整理匯總了Java中at.punkt.lodms.spi.extract.Extractor類的典型用法代碼示例。如果您正苦於以下問題:Java Extractor類的具體用法?Java Extractor怎麽用?Java Extractor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Extractor類屬於at.punkt.lodms.spi.extract包,在下文中一共展示了Extractor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testRunCompletedEventProperties
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
@Test
public void testRunCompletedEventProperties() throws InterruptedException {
MockApplicationEventPublisher eventPublisher = new MockApplicationEventPublisher();
ETLPipelineImpl instance = new ETLPipelineImpl(id, eventPublisher, repository);
Extractor delayingExtractor = new Extractor() {
@Override
public void extract(RDFHandler handler, ExtractContext context) throws ExtractException {
try {
Thread.sleep(10);
} catch (InterruptedException ex) {
throw new ExtractException(ex);
}
}
};
instance.setExtractors(Arrays.asList(delayingExtractor));
instance.run();
PipelineCompletedEvent completedEvent = eventPublisher.getPublishedEventsOfType(PipelineCompletedEvent.class).get(0);
Assert.assertEquals(instance, completedEvent.getPipeline());
Assert.assertNotNull(completedEvent.getId());
Assert.assertTrue(completedEvent.getDuration() > 0);
}
示例2: testRunExtractFailedEventFired
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
@Test
public void testRunExtractFailedEventFired() {
MockApplicationEventPublisher eventPublisher = new MockApplicationEventPublisher();
ETLPipelineImpl instance = new ETLPipelineImpl(id, eventPublisher, repository);
Extractor extractor = new MockExtractor() {
@Override
public void extract(RDFHandler handler, ExtractContext context) throws ExtractException {
throw new ExtractException("Test");
}
};
instance.setExtractors(Arrays.asList(extractor));
instance.run();
ExtractFailedEvent failedEvent = eventPublisher.getPublishedEventsOfType(ExtractFailedEvent.class).get(0);
Assert.assertEquals(extractor, failedEvent.getExtractor());
Assert.assertNotNull(failedEvent.getException());
}
示例3: testRunExtractorAbortedEventFired
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
@Test
public void testRunExtractorAbortedEventFired() {
MockApplicationEventPublisher eventPublisher = new MockApplicationEventPublisher();
ETLPipelineImpl instance = new ETLPipelineImpl(id, eventPublisher, repository);
Extractor extractor = new MockExtractor() {
@Override
public void extract(RDFHandler handler, ExtractContext context) throws ExtractException {
context.cancelPipeline("Test");
}
};
instance.setExtractors(Arrays.asList(extractor));
instance.run();
PipelineAbortedEvent abortedEvent = eventPublisher.getPublishedEventsOfType(PipelineAbortedEvent.class).get(0);
Assert.assertEquals(instance, abortedEvent.getPipeline());
Assert.assertEquals("Test", abortedEvent.getMessage());
}
示例4: testRunExtractorSkippedAfterAbortedEvent
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
@Test
public void testRunExtractorSkippedAfterAbortedEvent() {
MockApplicationEventPublisher eventPublisher = new MockApplicationEventPublisher();
ETLPipelineImpl instance = new ETLPipelineImpl(id, eventPublisher, repository);
Extractor extractor = new MockExtractor() {
@Override
public void extract(RDFHandler handler, ExtractContext context) throws ExtractException {
context.cancelPipeline("Test");
}
};
MockExtractor skippedExtractor = new MockExtractor();
instance.setExtractors(Arrays.asList(extractor, skippedExtractor));
instance.run();
Assert.assertEquals(false, skippedExtractor.executed);
}
示例5: init
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
public void init() {
TabSheet tabsheet = new TabSheet();
tabsheet.setWidth("100%");
selectedExtractors = new BeanItemContainer<Extractor>(Extractor.class, job.getPipeline().getExtractors());
selectedTransformers = new BeanItemContainer<Transformer>(Transformer.class, job.getPipeline().getTransformers());
selectedLoaders = new BeanItemContainer<Loader>(Loader.class, job.getPipeline().getLoaders());
initGenericDialog(Extractor.class, extractorDialog, provider.getAvailableExtractors(), job.getPipeline().getExtractors(), selectedExtractors);
initGenericDialog(Loader.class, loaderDialog, provider.getAvailableLoaders(), job.getPipeline().getLoaders(), selectedLoaders);
initGenericDialog(Transformer.class, transformerDialog, provider.getAvailableTransformers(), job.getPipeline().getTransformers(), selectedTransformers);
initJobDialog(job);
addComponent(jobDialog);
tabsheet.addTab(extractorDialog, "Extractors", null, 0);
tabsheet.addTab(transformerDialog, "Transformers", null, 1);
tabsheet.addTab(loaderDialog, "Loaders", null, 2);
tabsheet.setSizeFull();
addComponent(tabsheet);
setExpandRatio(tabsheet, 0.75f);
setSizeFull();
}
示例6: runExtractors
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
private void runExtractors(String runId, URI namedGraph, Map<String, Object> customData) throws RepositoryException, RDFHandlerException {
RepositoryConnection con = repository.getConnection();
con.setAutoCommit(false);
RDFInserter inserter = new RDFInserter(con);
inserter.enforceContext(namedGraph);
NoStartEndWrapper wrapper = new NoStartEndWrapper(inserter);
try {
for (Extractor extractor : extractors) {
if (extractor instanceof Disableable && ((Disableable) extractor).isDisabled()) {
continue;
}
ExtractContext context = new ExtractContext(runId, customData);
context.setPipeline(this);
TripleCountingWrapper tripleCounter = new TripleCountingWrapper(wrapper);
try {
long start = System.currentTimeMillis();
extractor.extract(tripleCounter, context);
con.commit();
context.setDuration(System.currentTimeMillis() - start);
context.setTriplesExtracted(tripleCounter.getTriples());
eventPublisher.publishEvent(new ExtractCompletedEvent(extractor, context, this));
} catch (ExtractException ex) {
con.rollback();
eventPublisher.publishEvent(new ExtractFailedEvent(ex, extractor, context, this));
}
if (cancelAllowed && context.isCancelPipeline()) {
eventPublisher.publishEvent(new PipelineAbortedEvent(context.getCancelMessage(), this, runId, extractor));
return;
}
}
inserter.endRDF();
} finally {
con.commit();
con.close();
}
}
示例7: testSetAndGetExtractors
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
@Test
public void testSetAndGetExtractors() {
List<Extractor> extractors = new ArrayList<Extractor>();
extractors.add(new MockExtractor());
ETLPipelineImpl instance = new ETLPipelineImpl();
instance.setExtractors(extractors);
assertEquals(extractors, instance.getExtractors());
}
示例8: testRunExecuteExtractors
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
@Test
public void testRunExecuteExtractors() {
ETLPipelineImpl instance = new ETLPipelineImpl(id, new MockApplicationEventPublisher(), repository);
instance.setExtractors(getMockExtractors(2));
instance.run();
for (Extractor extractor : instance.getExtractors()) {
assertTrue(((MockExtractor) extractor).executed);
}
}
示例9: testRunExtractCompletedEventFired
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
@Test
public void testRunExtractCompletedEventFired() {
MockApplicationEventPublisher eventPublisher = new MockApplicationEventPublisher();
ETLPipelineImpl instance = new ETLPipelineImpl(id, eventPublisher, repository);
Extractor extractor = new MockExtractor();
instance.setExtractors(Arrays.asList(extractor));
instance.run();
ExtractCompletedEvent completedEvent = eventPublisher.getPublishedEventsOfType(ExtractCompletedEvent.class).get(0);
Assert.assertEquals(extractor, completedEvent.getExtractor());
}
示例10: getMockExtractors
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
private List<Extractor> getMockExtractors(int i) {
List<Extractor> extractors = new ArrayList<Extractor>(i);
for (int j = 0; j < i; j++) {
extractors.add(new MockExtractor());
}
return extractors;
}
示例11: getExtractors
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
@Override
public List<Extractor> getExtractors() {
return extractors;
}
示例12: setExtractors
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
@Override
public void setExtractors(List<Extractor> extractors) {
this.extractors = extractors;
}
示例13: getExtractors
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
public List<ComponentBlueprint<Extractor>> getExtractors() {
return extractors;
}
示例14: setExtractors
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
public void setExtractors(List<ComponentBlueprint<Extractor>> extractors) {
this.extractors = extractors;
}
示例15: getExtractor
import at.punkt.lodms.spi.extract.Extractor; //導入依賴的package包/類
public Extractor getExtractor() {
return extractor;
}