/** * Creates ResourceBuilders. * @param classLoader classLoader * @param implementationModel implementationModel * @return ResourceBuilders */ public static List<ResourceBuilder> builders(ClassLoader classLoader, KnowledgeComponentImplementationModel implementationModel) { List<ResourceBuilder> builders = new ArrayList<ResourceBuilder>(); if (implementationModel != null) { ManifestModel manifestModel = implementationModel.getManifest(); if (manifestModel != null) { ResourcesModel resourcesModel = manifestModel.getResources(); builders.addAll(builders(classLoader, resourcesModel)); } } return builders; }
Manifest manifest = null; if (manifestModel != null) { ContainerModel containerModel = manifestModel.getContainer(); if (containerModel != null) { manifest = new ContainerManifest( containerModel.getSessionName()); } else { ResourcesModel resourcesModel = manifestModel.getResources(); if (resourcesModel != null) { manifest = new ResourcesManifest(ResourceBuilder.builders(getClassLoader(), resourcesModel)); } else { RemoteModel remoteModel = manifestModel.getRemote(); if (remoteModel != null) { manifest = new RemoteManifest(new RemoteConfigurationBuilder(getClassLoader(), remoteModel));
/** * Converts manifest annotations to manifest model. * @param manifestAnnotations annotations * @param knowledgeNamespace knowledgeNamespace * @return model */ protected ManifestModel toManifestModel(Manifest[] manifestAnnotations, KnowledgeNamespace knowledgeNamespace) { if (manifestAnnotations == null || manifestAnnotations.length == 0) { return null; } Manifest manifestAnnotation = manifestAnnotations[0]; ManifestModel manifestModel = new V1ManifestModel(knowledgeNamespace.uri()); Container[] container = manifestAnnotation.container(); if (container != null && container.length > 0) { manifestModel.setContainer(toContainerModel(container[0], knowledgeNamespace)); } manifestModel.setResources(toResourcesModel(manifestAnnotation.resources(), knowledgeNamespace)); return manifestModel; }
Manifest manifest = null; if (manifestModel != null) { ContainerModel containerModel = manifestModel.getContainer(); if (containerModel != null) { manifest = new ContainerManifest( containerModel.getSessionName()); } else { ResourcesModel resourcesModel = manifestModel.getResources(); if (resourcesModel != null) { manifest = new ResourcesManifest(ResourceBuilder.builders(getClassLoader(), resourcesModel)); } else { RemoteModel remoteModel = manifestModel.getRemote(); if (remoteModel != null) { manifest = new RemoteManifest(new RemoteConfigurationBuilder(getClassLoader(), remoteModel));
/** * Converts manifest annotations to manifest model. * @param manifestAnnotations annotations * @param knowledgeNamespace knowledgeNamespace * @return model */ protected ManifestModel toManifestModel(Manifest[] manifestAnnotations, KnowledgeNamespace knowledgeNamespace) { if (manifestAnnotations == null || manifestAnnotations.length == 0) { return null; } Manifest manifestAnnotation = manifestAnnotations[0]; ManifestModel manifestModel = new V1ManifestModel(knowledgeNamespace.uri()); Container[] container = manifestAnnotation.container(); if (container != null && container.length > 0) { manifestModel.setContainer(toContainerModel(container[0], knowledgeNamespace)); } manifestModel.setResources(toResourcesModel(manifestAnnotation.resources(), knowledgeNamespace)); return manifestModel; }
/** * Creates ResourceBuilders. * @param classLoader classLoader * @param implementationModel implementationModel * @return ResourceBuilders */ public static List<ResourceBuilder> builders(ClassLoader classLoader, KnowledgeComponentImplementationModel implementationModel) { List<ResourceBuilder> builders = new ArrayList<ResourceBuilder>(); if (implementationModel != null) { ManifestModel manifestModel = implementationModel.getManifest(); if (manifestModel != null) { ResourcesModel resourcesModel = manifestModel.getResources(); builders.addAll(builders(classLoader, resourcesModel)); } } return builders; }