/** * Inspect the given artifact to determine the classes contained in the artifact. TODO: remove * once PluginRepository is gone * * @param artifactId the id of the artifact to inspect * @param artifactFile the artifact file * @param template the template this plugin artifact extends * @param parentClassLoader the parent classloader to use when inspecting plugins contained in the * artifact. For example, a ProgramClassLoader created from the artifact the input artifact * extends * @return metadata about the classes contained in the artifact * @throws IOException if there was an exception opening the jar file */ public ArtifactClasses inspectArtifact( Id.Artifact artifactId, File artifactFile, String template, ClassLoader parentClassLoader) throws IOException { try (PluginInstantiator pluginInstantiator = new PluginInstantiator(cConf, template, parentClassLoader)) { List<PluginClass> plugins = inspectPlugins(artifactId, artifactFile, pluginInstantiator); return ArtifactClasses.builder().addPlugins(plugins).build(); } }
/** * Inspect the given artifact to determine the classes contained in the artifact. * * @param artifactId the id of the artifact to inspect * @param artifactFile the artifact file * @param parentClassLoader the parent classloader to use when inspecting plugins contained in the * artifact. For example, a ProgramClassLoader created from the artifact the input artifact * extends * @return metadata about the classes contained in the artifact * @throws IOException if there was an exception opening the jar file * @throws InvalidArtifactException if the artifact is invalid. For example, if the application * main class is not actually an Application. */ public ArtifactClasses inspectArtifact( Id.Artifact artifactId, File artifactFile, ClassLoader parentClassLoader) throws IOException, InvalidArtifactException { List<ApplicationClass> appClasses = inspectApplications(artifactFile); try (PluginInstantiator pluginInstantiator = new PluginInstantiator(cConf, parentClassLoader)) { List<PluginClass> plugins = inspectPlugins(artifactId, artifactFile, pluginInstantiator); return ArtifactClasses.builder().addApps(appClasses).addPlugins(plugins).build(); } }