forked from mwaylabs/jenkins-mcap-eas-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 391800e
Showing
29 changed files
with
2,790 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.DS_Store | ||
.settings | ||
.classpath | ||
.project | ||
target/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.jenkins-ci.plugins</groupId> | ||
<artifactId>plugin</artifactId> | ||
<version>1.526</version><!-- which version of Jenkins is this plugin | ||
built against? --> | ||
</parent> | ||
|
||
<groupId>org.jenkins-ci.plugins</groupId> | ||
<artifactId>Relution</artifactId> | ||
<version>2.0-SNAPSHOT</version> | ||
<packaging>hpi</packaging> | ||
<!-- | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>attach-javadocs</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
--> | ||
<!-- get every artifact through repo.jenkins-ci.org, which proxies all the | ||
artifacts that we need --> | ||
<repositories> | ||
<repository> | ||
<id>repo.jenkins-ci.org</id> | ||
<url>http://repo.jenkins-ci.org/public/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>repo.jenkins-ci.org</id> | ||
<url>http://repo.jenkins-ci.org/public/</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
|
||
<dependencies> | ||
<!-- apache-commons: Validator --> | ||
<dependency> | ||
<groupId>commons-validator</groupId> | ||
<artifactId>commons-validator</artifactId> | ||
<version>1.4.0</version> | ||
</dependency> | ||
|
||
<!-- apache-commons: Codec --> | ||
<dependency> | ||
<groupId>commons-codec</groupId> | ||
<artifactId>commons-codec</artifactId> | ||
<version>1.8</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpcore</artifactId> | ||
<version>4.2.4</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpclient</artifactId> | ||
<version>4.2.5</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpmime</artifactId> | ||
<version>4.2.5</version> | ||
</dependency> | ||
|
||
<!-- Gson: Java to Json conversion --> | ||
<dependency> | ||
<groupId>com.google.code.gson</groupId> | ||
<artifactId>gson</artifactId> | ||
<version>2.2.4</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.code.typica</groupId> | ||
<artifactId>typica</artifactId> | ||
<version>1.7.2</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<properties> | ||
<!-- explicitly specifying the latest version here because one we get from | ||
the parent POM tends to lag behind a bit --> | ||
<maven-hpi-plugin.version>1.97</maven-hpi-plugin.version> | ||
</properties> | ||
</project> |
214 changes: 214 additions & 0 deletions
214
src/main/java/org/jenkinsci/plugins/relution/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
|
||
package org.jenkinsci.plugins.relution; | ||
|
||
import hudson.Extension; | ||
import hudson.model.AbstractDescribableImpl; | ||
import hudson.model.Descriptor; | ||
import hudson.util.FormValidation; | ||
import hudson.util.ListBoxModel; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
import javax.inject.Inject; | ||
import javax.servlet.ServletException; | ||
|
||
import org.kohsuke.stapler.DataBoundConstructor; | ||
import org.kohsuke.stapler.QueryParameter; | ||
|
||
|
||
public class Application extends AbstractDescribableImpl<Application> { | ||
|
||
private String applicationFile; | ||
private String applicationIcon; | ||
private String apiReleaseStatus; | ||
private String apiEndpointURL; | ||
private String applicationName; | ||
private String applicationReleaseNotes; | ||
|
||
/** | ||
* These constructor will be executed every time when the save/submit button will be triggered in the Jenkins. | ||
* @param apiEndpointURL URL to which the app should communicate. | ||
* @param applicationFile String representation of the File which should be uploaded. | ||
* @param applicationIcon String Representation of the Icon which should be used for the uploaded app. | ||
* @param apiReleaseStatus String Representation of the ReleaseState to the app will be published. | ||
*/ | ||
@DataBoundConstructor | ||
public Application(final String apiEndpointURL, final String applicationFile, final String applicationIcon, final String apiReleaseStatus, final String applicationName, final String applicationReleaseNotes) { | ||
this.setApiEndpointURL(apiEndpointURL); | ||
this.setApplicationFile(applicationFile); | ||
this.setApplicationIcon(applicationIcon); | ||
this.setApiReleaseStatus(apiReleaseStatus); | ||
this.setApplicationName(applicationName); | ||
this.setApplicationReleaseNotes(applicationReleaseNotes); | ||
} | ||
|
||
/** | ||
* @return URL to which your app will connect. | ||
*/ | ||
public String getApiEndpointURL() { | ||
return this.apiEndpointURL; | ||
} | ||
|
||
/** | ||
* @param apiEndpointURL Communication endpoint to set. | ||
*/ | ||
public void setApiEndpointURL(final String apiEndpointURL) { | ||
this.apiEndpointURL = apiEndpointURL; | ||
} | ||
|
||
/** | ||
* @return File which will be uploaded to relution. | ||
*/ | ||
public String getApplicationFile() { | ||
return this.applicationFile; | ||
} | ||
|
||
/** | ||
* @param applicationFile File that should be uploaded to relution. | ||
*/ | ||
public void setApplicationFile(final String applicationFile) { | ||
this.applicationFile = applicationFile; | ||
} | ||
|
||
/** | ||
* @return Pictures that will be uploaded to relution and represents your app. | ||
*/ | ||
public String getApplicationIcon() { | ||
return this.applicationIcon; | ||
} | ||
|
||
/** | ||
* @param applicationIcon Picture that should represent your app in relution. | ||
*/ | ||
public void setApplicationIcon(final String applicationIcon) { | ||
this.applicationIcon = applicationIcon; | ||
} | ||
|
||
/** | ||
* @return Publsih your app with the current releasestate. | ||
*/ | ||
public String getApiReleaseStatus() { | ||
return this.apiReleaseStatus; | ||
} | ||
|
||
/** | ||
* @param apiReleaseStatus ReleaseState that your app will have after upload to relution. | ||
*/ | ||
public void setApiReleaseStatus(final String apiReleaseStatus) { | ||
this.apiReleaseStatus = apiReleaseStatus; | ||
} | ||
|
||
/** | ||
* The Name of these app corresponds to the file which will be uploaded. | ||
* If the textfield in the Job-Configuration is not null your app will be represented by these name | ||
* @return The Name of the app in relution store. | ||
*/ | ||
public String getApplicationName() { | ||
return this.applicationName; | ||
} | ||
|
||
/** | ||
* @param applicationName Name of the new uploaded app | ||
*/ | ||
public void setApplicationName(String applicationName) { | ||
this.applicationName = applicationName; | ||
} | ||
|
||
/** | ||
* @return Content of the Log-File which will be set in the TextField. | ||
*/ | ||
public String getApplicationReleaseNotes() { | ||
return this.applicationReleaseNotes; | ||
} | ||
|
||
/** | ||
* @param applicationReleaseNotes Content that should be set to the app. | ||
*/ | ||
public void setApplicationReleaseNotes(String applicationReleaseNotes) { | ||
this.applicationReleaseNotes = applicationReleaseNotes; | ||
} | ||
|
||
|
||
/** | ||
* Descriptor for {@link DescriptorImpl}. Used as a singleton. | ||
* The class is marked as public so that it can be accessed from views. | ||
* | ||
* <p> | ||
* See <tt>src/main/resources/hudson/plugins/hello_world/HelloWorldBuilder/*.jelly</tt> | ||
* for the actual HTML fragment for the configuration screen. | ||
*/ | ||
@Extension | ||
public static class DescriptorImpl extends Descriptor<Application> { | ||
|
||
/** | ||
* Necessary Object to read the values entered in the GlobalConfigurationScreen. | ||
*/ | ||
@Inject | ||
GlobalConfigurationImpl globalConfiguration; | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return ""; | ||
} | ||
|
||
/** | ||
* Fills the DropDownList on the configuration page of an job. The values are read out of the GlobalConfiguration. | ||
* @return List of URLs which are entered in the GlobalConfigurationScreen | ||
*/ | ||
public ListBoxModel doFillApiEndpointURLItems() { | ||
Map<String, String> loginCredentials = this.globalConfiguration.getLoginCredentials(); | ||
final ListBoxModel items = new ListBoxModel(); | ||
try { | ||
for (Map.Entry<String, String> entry : loginCredentials.entrySet()) { | ||
items.add(entry.getKey().toString()); | ||
} | ||
} | ||
catch(Exception ex) { | ||
ex.printStackTrace(); | ||
} | ||
return items; | ||
} | ||
|
||
/** | ||
* Validates if the enntry in the Inputfield is empty/not empty. | ||
* @param value value of the input field applicationName. | ||
* @return true if an entry exists, false if no entry exists. | ||
* @throws IOException | ||
* @throws ServletException | ||
*/ | ||
public FormValidation doCheckApplicationName(@QueryParameter final String value) | ||
throws IOException, ServletException { | ||
if (value.length() == 0) { | ||
return FormValidation.error(Messages.Relution_appName()); | ||
} | ||
return FormValidation.ok(); | ||
} | ||
|
||
/** | ||
* Validates if the entry in the Inputfield is empty/no empty. | ||
* @param value value of the input field applicationIcon. | ||
* @return true if an entry exists, false if no entry exists. | ||
* @throws IOException | ||
* @throws ServletException | ||
*/ | ||
public FormValidation doCheckApplicationIcon(@QueryParameter final String value) | ||
throws IOException, ServletException { | ||
if (value.length() == 0) { | ||
return FormValidation.error(Messages.Relution_apiIconIsRequired()); | ||
} | ||
return FormValidation.ok(); | ||
} | ||
|
||
/** | ||
* @return List of ReleaseStatuses that the actual app could have. | ||
*/ | ||
public ListBoxModel doFillApiReleaseStatusItems() { | ||
final ListBoxModel items = new ListBoxModel(); | ||
items.add("DEVELOPMENT"); | ||
items.add("REVIEW"); | ||
items.add("RELEASE"); | ||
return items; | ||
} | ||
} | ||
} |
Oops, something went wrong.