public static InstancesLoadResult loadInstances ( File instancesFile , File rootDirectory , Graphs graph , String applicationName ) { InstancesLoadResult result = new InstancesLoadResult ( ) ; INST : { if ( ! instancesFile . exists ( ) ) { RoboconfError error = new RoboconfError ( ErrorCode . PROJ_MISSING_INSTANCE_EP ) ; error . setDetails ( expected ( instancesFile . getAbsolutePath ( ) ) ) ; result . loadErrors . add ( error ) ; break INST ; } FromInstanceDefinition fromDef = new FromInstanceDefinition ( rootDirectory ) ; Collection < Instance > instances = fromDef . buildInstances ( graph , instancesFile ) ; result . getParsedFiles ( ) . addAll ( fromDef . getProcessedImports ( ) ) ; if ( ! fromDef . getErrors ( ) . isEmpty ( ) ) { result . loadErrors . addAll ( fromDef . getErrors ( ) ) ; break INST ; } Collection < ModelError > errors = RuntimeModelValidator . validate ( instances ) ; result . loadErrors . addAll ( errors ) ; result . objectToSource . putAll ( fromDef . getObjectToSource ( ) ) ; result . getRootInstances ( ) . addAll ( instances ) ; } for ( Instance rootInstance : result . rootInstances ) rootInstance . data . put ( Instance . APPLICATION_NAME , applicationName ) ; return result ; }
Loads instances from a file .