@Override public PluginConfigurer createPluginConfigurer() { File tmpDir = new File(cConf.get(Constants.CFG_LOCAL_DATA_DIR), cConf.get(Constants.AppFabric.TEMP_DIR)).getAbsoluteFile(); try { File pluginsDir = Files.createTempDirectory(tmpDir.toPath(), "plugins").toFile(); PluginInstantiator instantiator = new PluginInstantiator(cConf, getProgram().getClassLoader(), pluginsDir); closeables.add(() -> { try { instantiator.close(); } finally { DirUtils.deleteDirectoryContents(pluginsDir, true); } }); return new DefaultPluginConfigurer(artifactId, namespaceId, instantiator, pluginFinder); } catch (IOException e) { throw new RuntimeException(e); } }
protected AbstractConfigurer(Id.Namespace deployNamespace, Id.Artifact artifactId, ArtifactRepository artifactRepository, PluginInstantiator pluginInstantiator) { this.deployNamespace = deployNamespace; this.extraPlugins = new HashMap<>(); this.pluginConfigurer = new DefaultPluginConfigurer(artifactId.toEntityId(), deployNamespace.toEntityId(), pluginInstantiator, new LocalPluginFinder(artifactRepository)); }
protected AbstractConfigurer(Id.Namespace deployNamespace, Id.Artifact artifactId, ArtifactRepository artifactRepository, PluginInstantiator pluginInstantiator) { this.deployNamespace = deployNamespace; this.extraPlugins = new HashMap<>(); this.pluginConfigurer = new DefaultPluginConfigurer(artifactId.toEntityId(), deployNamespace.toEntityId(), pluginInstantiator, new LocalPluginFinder(artifactRepository)); }
/** * Constructor. This should be called from the service handler via * the {@link SparkHttpServiceContext#getPluginContext()} method. */ public DefaultSparkHttpServicePluginContext(SparkRuntimeContext runtimeContext) throws IOException { this.runtimeContext = runtimeContext; this.pluginInstantiator = createPluginsInstantiator(runtimeContext); this.pluginConfigurer = new DefaultPluginConfigurer(runtimeContext.getArtifactId(), runtimeContext.getProgram().getId().getNamespaceId(), pluginInstantiator, runtimeContext.getPluginFinder()); this.extraPlugins = null; }
/** * Constructor. This should be called from the service handler via * the {@link SparkHttpServiceContext#getPluginContext()} method. */ public DefaultSparkHttpServicePluginContext(SparkRuntimeContext runtimeContext) throws IOException { this.runtimeContext = runtimeContext; this.pluginInstantiator = createPluginsInstantiator(runtimeContext); this.pluginConfigurer = new DefaultPluginConfigurer(runtimeContext.getArtifactId(), runtimeContext.getProgram().getId().getNamespaceId(), pluginInstantiator, runtimeContext.getPluginFinder()); this.extraPlugins = null; }
/** * Constructor. This should be called from the service handler via * the {@link SparkHttpServiceContext#getPluginContext()} method. */ public DefaultSparkHttpServicePluginContext(SparkRuntimeContext runtimeContext) throws IOException { this.runtimeContext = runtimeContext; this.pluginInstantiator = createPluginsInstantiator(runtimeContext); this.pluginConfigurer = new DefaultPluginConfigurer(runtimeContext.getArtifactId(), runtimeContext.getProgram().getId().getNamespaceId(), pluginInstantiator, runtimeContext.getPluginFinder()); this.extraPlugins = null; }