/** * Simulate instantiating a graph. * @return The simulated graph. */ public DAGNode<Component,Dependency> simulate() throws RecommenderBuildException { try { return replaceShareableNodes(NodeProcessors.simulateInstantiation()); } catch (InjectionException e) { throw new RecommenderBuildException("Simulated instantiation failed", e); } }
/** * Instantiate the recommender graph. This requires the graph to have been resolved with a real * DAO instance, not just a class, if anything references the DAO. Use {@link * LenskitConfiguration#buildGraph()} to get such a graph. The result of instantiating a graph * is that all shareable nodes will be instantiated. * * @return A new recommender graph with all shareable nodes pre-instantiated. * @throws RecommenderBuildException If there is an error instantiating the graph. */ public DAGNode<Component,Dependency> instantiate() throws RecommenderBuildException { try (LifecycleManager lm = new LifecycleManager()) { NodeInstantiator instantiator = NodeInstantiator.create(lm); // TODO Verify that no sharable components are lifecycle-managed return replaceShareableNodes(NodeProcessors.instantiate(instantiator)); } catch (InjectionException e) { throw new RecommenderBuildException("Recommender instantiation failed", e); } }
/** * Simulate instantiating a graph. * @return The simulated graph. */ public DAGNode<Component,Dependency> simulate() throws RecommenderBuildException { try { return replaceShareableNodes(NodeProcessors.simulateInstantiation()); } catch (InjectionException e) { throw new RecommenderBuildException("Simulated instantiation failed", e); } }
/** * Instantiate the recommender graph. This requires the graph to have been resolved with a real * DAO instance, not just a class, if anything references the DAO. Use {@link * LenskitConfiguration#buildGraph()} to get such a graph. The result of instantiating a graph * is that all shareable nodes will be instantiated. * * @return A new recommender graph with all shareable nodes pre-instantiated. * @throws RecommenderBuildException If there is an error instantiating the graph. */ public DAGNode<Component,Dependency> instantiate() throws RecommenderBuildException { try (LifecycleManager lm = new LifecycleManager()) { NodeInstantiator instantiator = NodeInstantiator.create(lm); // TODO Verify that no sharable components are lifecycle-managed return replaceShareableNodes(NodeProcessors.instantiate(instantiator)); } catch (InjectionException e) { throw new RecommenderBuildException("Recommender instantiation failed", e); } }