@Override public long getContentLength() { if(_blob == null){ //do not dereference for calls on getContentLength return -1; } else { return _blob.getContentLength(); } } public Blob getLazy() {
/** * Getter for the lock used to synchronise read/write to this enhancement job. This returns the lock * provided by {@link ContentItem#getLock()} * * @return the read/write lock for this enhancement job */ public final ReadWriteLock getLock() { return contentItem.getLock(); }
@Override public int canEnhance(ContentItem ci) throws EngineException { /* * Being a post-processing engine, the Refactor can enhance only content items that are previously * enhanced by other enhancement engines. */ return ci.getMetadata() == null ? CANNOT_ENHANCE : ENHANCE_SYNCHRONOUS; }
@Override public void enhanceContent(ContentItem ci) throws EnhancementException { Chain defaultChain = chainManager.getDefault(); if(defaultChain == null){ throw new ChainException("Unable to enhance ContentItem '"+ci.getUri()+ "' because currently no enhancement chain is active. Please" + "configure a Chain or enable the default chain"); } enhanceContent(ci, defaultChain); }
@Override public String toString() { return "EnhancementJob for ContentItem "+contentItem.getUri(); }
/** * @throws EngineException */ private void checkRESTfulNlpAnalysisService() throws EngineException { if(!initRESTfulNlpAnalysisService()){ throw new EngineException("The configured RESTful NLP Analysis Service is " + "currently not available (url: '"+analysisServiceUrl+"')"); } } /**
@Test public void testContentSinkDefaultMimeType() throws IOException { String DEFAULT = "application/octet-stream"; ContentSink cs = contentItemFactory.createContentSink(null); assertNotNull(cs); assertNotNull(cs.getBlob()); assertNotNull(cs.getBlob().getMimeType()); //get MimeType MUST return the simple mime type assertEquals(DEFAULT, cs.getBlob().getMimeType()); assertNull(cs.getBlob().getParameter().get("charset")); }
@Test(expected=IllegalArgumentException.class) public void missingCiPrefix() throws IOException{ contentItemFactory.createContentItem((String)null,TEST_CS); } @Test(expected=IllegalArgumentException.class)
public EnhancementEngine getEngine() { return engineManager.getEngine(engineName); }
@Override public ImmutableGraph getExecutionPlan() throws ChainException { return internalChain.getExecutionPlan(); }
@Override protected State consume(String line) throws IOException { if(ctx.currentBenchmark.getChain() == null){ Chain chain = chainManager.getChain(line); if(chain != null){ ctx.currentBenchmark.setChain(chain); } //defined chain not active } //do not override return this; }
@Override public Set<String> getEngines() throws ChainException { return internalChain.getEngines(); }
public boolean isEngineActive() { return engineManager.isEngine(engineName); }
@Test public void testContentSinkDefaultMimeType() throws IOException { String DEFAULT = "application/octet-stream"; ContentSink cs = contentItemFactory.createContentSink(null); assertNotNull(cs); assertNotNull(cs.getBlob()); assertNotNull(cs.getBlob().getMimeType()); //get MimeType MUST return the simple mime type assertEquals(DEFAULT, cs.getBlob().getMimeType()); assertNull(cs.getBlob().getParameter().get("charset")); }
@Test(expected=IllegalArgumentException.class) public void missingCiContentReference() throws IOException{ contentItemFactory.createContentItem((ContentReference)null); } @Test(expected=IllegalArgumentException.class)
@Override public long getContentLength() { if(_blob == null){ //do not dereference for calls on getContentLength return -1; } else { return _blob.getContentLength(); } } public Blob getLazy() {
public EnhancementEngine getEngine() { return engineManager.getEngine(engineName); }
public boolean isEngineActive(String name) { return engineManager.isEngine(name); }
public boolean isEngineActive(String name) { return engineManager.isEngine(name); }
public boolean isEngineActive() { return engineManager.isEngine(engineName); }