public GenericEnhancerUiResource(String chainName, EnhancementJobManager jobManager, EnhancementEngineManager engineManager, ChainManager chainManager, ContentItemFactory ciFactory, Serializer serializer, LayoutConfiguration layoutConfiguration, UriInfo uriInfo) { super(jobManager, engineManager, chainManager, ciFactory, layoutConfiguration, uriInfo); this.serializer = serializer; //this.queryEngine = queryEngine; if(chainName == null){ chain = chainManager.getDefault(); } else { this.chain = chainManager.getChain(chainName); } if(this.chain == null){ throw new WebApplicationException(Response.Status.NOT_FOUND); } }
public GenericEnhancerUiResource(String chainName, EnhancementJobManager jobManager, EnhancementEngineManager engineManager, ChainManager chainManager, ContentItemFactory ciFactory, Serializer serializer, LayoutConfiguration layoutConfiguration, UriInfo uriInfo) { super(jobManager, engineManager, chainManager, ciFactory, layoutConfiguration, uriInfo); this.serializer = serializer; //this.queryEngine = queryEngine; if(chainName == null){ chain = chainManager.getDefault(); } else { this.chain = chainManager.getChain(chainName); } if(this.chain == null){ throw new WebApplicationException(Response.Status.NOT_FOUND); } }
/** * Create the RDF data for the currently active Enhancement {@link Chain}s.<p> * Note the the parsed rootUrl MUST already consider offsets configured * for the Stanbol RESTful service. When called from within a * {@link BaseStanbolResource} the following code segment should be used:<p> * <code><pre> * String rootUrl = uriInfo.getBaseUriBuilder().path(getRootUrl()).build().toString(); * </pre></code> * @param chainManager the enhancement chain manager. * @param graph the RDF graph to add the triples * @param rootUrl the root URL used by the current request */ public static void addActiveChains(ChainManager chainManager, Graph graph, String rootUrl) { addActiveChains(buildChainsMap(chainManager).values(), chainManager.getDefault(), graph, rootUrl); } /**
/** * Create the RDF data for the currently active Enhancement {@link Chain}s.<p> * Note the the parsed rootUrl MUST already consider offsets configured * for the Stanbol RESTful service. When called from within a * {@link BaseStanbolResource} the following code segment should be used:<p> * <code><pre> * String rootUrl = uriInfo.getBaseUriBuilder().path(getRootUrl()).build().toString(); * </pre></code> * @param chainManager the enhancement chain manager. * @param graph the RDF graph to add the triples * @param rootUrl the root URL used by the current request */ public static void addActiveChains(ChainManager chainManager, Graph graph, String rootUrl) { addActiveChains(buildChainsMap(chainManager).values(), chainManager.getDefault(), graph, rootUrl); } /**
@Override public List<EnhancementEngine> getActiveEngines() { //This implementation return the list of active engined for the default //Chain in the order they would be executed Chain defaultChain = chainManager.getDefault(); if(defaultChain == null){ throw new IllegalStateException("Currently no enhancement chain is " + "active. Please configure a Chain or enable the default chain"); } ImmutableGraph ep; try { ep = defaultChain.getExecutionPlan(); } catch (ChainException e) { throw new IllegalStateException("Unable to get Execution Plan for " + "default enhancement chain (name: '"+defaultChain.getName()+ "'| class: '"+defaultChain.getClass()+"')!",e); } return ExecutionPlanHelper.getActiveEngines(engineManager,ep); }
@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); }
boolean isDefaultChain = chain.equals(chainManager.getDefault()); EnhancementJob job = new EnhancementJob(ci, chain.getName(), chain.getExecutionPlan(),isDefaultChain);