+ @Bean
+ public Policies getPolicies() {
+ return this.policies;
+ }
+
+ @Bean
+ public PolicyTypes getPolicyTypes() {
+ return this.policyTypes;
+ }
+
+ @Bean
+ public Rics getRics() {
+ return this.rics;
+ }
+
+ private static File[] getResourceFolderFiles(String folder) {
+ return getFile(folder).listFiles();
+ }
+
+ private static String readFile(File file) throws IOException {
+ return new String(Files.readAllBytes(file.toPath()));
+ }
+
+ private void loadTypes(PolicyTypes policyTypes) {
+ File[] files = getResourceFolderFiles("policy_types/");
+ for (File file : files) {
+ try {
+ String schema = readFile(file);
+ String typeName = title(schema);
+ PolicyType type = ImmutablePolicyType.builder().name(typeName).schema(schema).build();
+ policyTypes.put(type);
+ } catch (Exception e) {
+ logger.error("Could not load json schema ", e);
+ }