Search in sources :

Example 16 with PluggableInstanceSettings

use of com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings in project gocd by gocd.

the class PackageMaterialPluginInfoBuilder method pluginInfoFor.

public PackageMaterialPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) {
    RepositoryConfiguration repositoryConfiguration = extension.getRepositoryConfiguration(descriptor.id());
    com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration packageConfiguration = extension.getPackageConfiguration(descriptor.id());
    if (repositoryConfiguration == null) {
        throw new RuntimeException(format("Plugin[%s] returned null repository configuration", descriptor.id()));
    }
    if (packageConfiguration == null) {
        throw new RuntimeException(format("Plugin[%s] returned null package configuration", descriptor.id()));
    }
    PluggableInstanceSettings pluginSettingsAndView = getPluginSettingsAndView(descriptor, extension);
    return new PackageMaterialPluginInfo(descriptor, new PluggableInstanceSettings(packageRepoConfigurations(repositoryConfiguration)), new PluggableInstanceSettings(packageRepoConfigurations(packageConfiguration)), pluginSettingsAndView);
}
Also used : PackageMaterialPluginInfo(com.thoughtworks.go.plugin.domain.packagematerial.PackageMaterialPluginInfo) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) RepositoryConfiguration(com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration)

Example 17 with PluggableInstanceSettings

use of com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings in project gocd by gocd.

the class PluggableTaskPluginInfoBuilder method pluginInfoFor.

public PluggableTaskPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) {
    final TaskPreference[] tp = { null };
    extension.doOnTask(descriptor.id(), new Action<Task>() {

        @Override
        public void execute(Task task, GoPluginDescriptor pluginDescriptor) {
            tp[0] = new TaskPreference(task);
        }
    });
    TaskConfig config = tp[0].getConfig();
    TaskView view = tp[0].getView();
    if (config == null) {
        throw new RuntimeException(format("Plugin[%s] returned null task configuration", descriptor.id()));
    }
    if (view == null) {
        throw new RuntimeException(format("Plugin[%s] returned null task view", descriptor.id()));
    }
    String displayName = view.displayValue();
    PluggableInstanceSettings taskSettings = new PluggableInstanceSettings(configurations(config), new PluginView(view.template()));
    return new PluggableTaskPluginInfo(descriptor, displayName, taskSettings);
}
Also used : Task(com.thoughtworks.go.plugin.api.task.Task) TaskView(com.thoughtworks.go.plugin.api.task.TaskView) PluggableTaskPluginInfo(com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo) TaskConfig(com.thoughtworks.go.plugin.api.task.TaskConfig) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) PluginView(com.thoughtworks.go.plugin.domain.common.PluginView) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)

Example 18 with PluggableInstanceSettings

use of com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings in project gocd by gocd.

the class AuthorizationPluginInfoBuilder method pluginInfoFor.

public AuthorizationPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) {
    Capabilities capabilities = capabilities(descriptor.id());
    PluggableInstanceSettings authConfigSettings = authConfigSettings(descriptor.id());
    PluggableInstanceSettings roleSettings = roleSettings(descriptor.id(), capabilities);
    Image image = image(descriptor.id());
    return new AuthorizationPluginInfo(descriptor, authConfigSettings, roleSettings, image, capabilities);
}
Also used : PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) Capabilities(com.thoughtworks.go.plugin.domain.authorization.Capabilities) AuthorizationPluginInfo(com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo) Image(com.thoughtworks.go.plugin.domain.common.Image)

Aggregations

PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)18 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)12 Test (org.junit.Test)12 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)10 Metadata (com.thoughtworks.go.plugin.domain.common.Metadata)10 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)9 ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)9 EncryptedConfigurationValue (com.thoughtworks.go.domain.config.EncryptedConfigurationValue)8 PluginView (com.thoughtworks.go.plugin.domain.common.PluginView)5 AuthorizationPluginInfo (com.thoughtworks.go.plugin.domain.authorization.AuthorizationPluginInfo)4 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)4 ConfigRepoPluginInfo (com.thoughtworks.go.plugin.domain.configrepo.ConfigRepoPluginInfo)3 ElasticAgentPluginInfo (com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo)3 Image (com.thoughtworks.go.plugin.domain.common.Image)2 PluggableTaskPluginInfo (com.thoughtworks.go.plugin.domain.pluggabletask.PluggableTaskPluginInfo)2 GoCipher (com.thoughtworks.go.security.GoCipher)2 ArrayList (java.util.ArrayList)2 ConfigurationPropertyBuilder (com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder)1 PluginSettingsConfiguration (com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration)1 RepositoryConfiguration (com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration)1