private Instantiators(ArtifactDescriptor parentArtifactDescriptor) throws Exception { // todo : shouldn't pass null, should use ArtifactId instead of ArtifactDescriptor so we have namespace. this.parentClassLoader = authArtifactRepository.createArtifactClassLoader( // todo : should not pass null, (Temporary) // change Instantiators to accept ArtifactId instead of ArtifactDescriptor parentArtifactDescriptor.getLocation(), new EntityImpersonator(null, impersonator)); this.instantiatorInfoMap = new ConcurrentHashMap<>(); this.pluginDir = DirUtils.createTempDir(stageDir); }
private Instantiators(ArtifactDescriptor parentArtifactDescriptor) throws Exception { // todo : shouldn't pass null, should use ArtifactId instead of ArtifactDescriptor so we have namespace. this.parentClassLoader = authArtifactRepository.createArtifactClassLoader( // todo : should not pass null, (Temporary) // change Instantiators to accept ArtifactId instead of ArtifactDescriptor parentArtifactDescriptor.getLocation(), new EntityImpersonator(null, impersonator)); this.instantiatorInfoMap = new ConcurrentHashMap<>(); this.pluginDir = DirUtils.createTempDir(stageDir); }
EntityImpersonator entityImpersonator = new EntityImpersonator(artifactId.toEntityId(), impersonator); if (!parentArtifacts.isEmpty()) {
EntityImpersonator entityImpersonator = new EntityImpersonator(artifactId.toEntityId(), impersonator); if (!parentArtifacts.isEmpty()) {
private void writeArtifact(Id.Artifact artifactId, ArtifactMeta meta, String contents) throws ArtifactAlreadyExistsException, IOException, WriteConflictException { File artifactFile = TEMP_FOLDER.newFile(); Files.write(artifactFile.toPath(), Bytes.toBytes(contents)); artifactStore.write(artifactId, meta, artifactFile, new EntityImpersonator(artifactId.toEntityId(), new DefaultImpersonator(CConfiguration.create(), null))); } }
@Test(expected = InvalidArtifactException.class) public void testInvalidConfigApp() throws Exception { Manifest manifest = new Manifest(); File appFile = createJar(InvalidConfigApp.class, new File(TMP_FOLDER.newFolder(), "InvalidConfigApp-1.0.0.jar"), manifest); Id.Artifact artifactId = Id.Artifact.from(Id.Namespace.DEFAULT, "InvalidConfigApp", "1.0.0"); Location artifactLocation = Locations.toLocation(appFile); try (CloseableClassLoader artifactClassLoader = classLoaderFactory.createClassLoader( ImmutableList.of(artifactLocation).iterator(), new EntityImpersonator(artifactId.toEntityId(), new DefaultImpersonator(CConfiguration.create(), null)))) { artifactInspector.inspectArtifact(artifactId, appFile, artifactClassLoader); } }
classLoaderFactory.createClassLoader( ImmutableList.of(artifactLocation).iterator(), new EntityImpersonator(artifactId.toEntityId(), new DefaultImpersonator(CConfiguration.create(), null)))) {
new EntityImpersonator(artifactId.toEntityId(), impersonator).impersonate(new Callable<Void>() { @Override public Void call() throws Exception {
appJar, new EntityImpersonator(artifactId.getNamespace().toEntityId(), new DefaultImpersonator(cConf, null)))) { Configurator configuratorWithConfig =
new EntityImpersonator(artifactId, impersonator); ClassLoader artifactClassLoader = artifactRepository.createArtifactClassLoader(artifactLocation, classLoaderImpersonator);
new EntityImpersonator(artifactId, impersonator); ClassLoader artifactClassLoader = artifactRepository.createArtifactClassLoader(artifactLocation, classLoaderImpersonator);
new EntityImpersonator(artifactId.toEntityId(), impersonator).impersonate(new Callable<Void>() { @Override public Void call() throws Exception {
appJar, new EntityImpersonator(artifactId.getNamespace().toEntityId(), new DefaultImpersonator(cConf, null)))) { Configurator configurator = new InMemoryConfigurator(conf, Id.Namespace.DEFAULT, artifactId,