this(Arrays.asList(new NodeTypeTemplate[] {nodeTypeTemplate}));
}
public NodeTemplateNodeTypeSource( List<NodeTypeTemplate> nodeTypeTemplates ) throws InvalidNodeTypeDefinitionException {
ExecutionContext context = null;
if (nodeTypeTemplates.isEmpty()) {
context = new ExecutionContext();
} else {
for (NodeTypeTemplate ntt : nodeTypeTemplates) {
if (!(ntt instanceof JcrNodeTypeTemplate)) {
throw new IllegalArgumentException(JcrI18n.cannotConvertValue.text(ntt.getClass(), JcrNodeTypeTemplate.class));
}
JcrNodeTypeTemplate jntt = (JcrNodeTypeTemplate)ntt;
if (context == null) {
context = jntt.getExecutionContext();
assert context != null;
} else {
if (context != jntt.getExecutionContext()) {
throw new IllegalArgumentException(JcrI18n.allNodeTypeTemplatesMustComeFromSameSession.text());
}
}
}
}
assert context != null;
this.pathFactory = context.getValueFactories().getPathFactory();
this.nameFactory = context.getValueFactories().getNameFactory();
this.booleanFactory = context.getValueFactories().getBooleanFactory();
this.stringFactory = context.getValueFactories().getStringFactory();
PathFactory pathFactory = context.getValueFactories().getPathFactory();
InMemoryRepositorySource source = new InMemoryRepositorySource();
source.setName("NodeTypeTemplate Import Source");
this.graph = Graph.create(source, context);
Graph.Batch batch = graph.batch();
destination = new GraphBatchDestination(batch);