Problem with dropdownDescriptorSelector

2013-01-17 Thread Dimitri CHARLES
What I am trying to do is to save the properties of the Scala class and the 
Jahia class. For that I defined a Profil class which is abstract and those 
class extend Profil. 
 
I have a config.jelly where I use the taglib f:drowDownDescriptorSelector  :



and the associated class : 

private final Profilprofil;

 @DataBoundConstructor
public RemoteDeploymentBuilder(Profil profil, String environment, 
String component, String version)
{
this.environment = environment;
this.profil = profil;
this.component = component;
this.version = version;
}

My problem is that the properties of each class (Jahia and Scala)  are 
properly saved but they do not display properly, the textboxes where I 
defined them are empty. How can I solve that? 
Here is the profil class and his subclass : 

public static abstract class Profil implements Describable < Profil >
{

protected String name;

private Profil(String name)
{
this.name
 
 = name;
}

public String getName() {
return name;
}

public Descriptor < Profil > getDescriptor()
{
return Jenkins.getInstance().getDescriptor(getClass());
}
}

public static class ProfilDescriptor extends Descriptor < Profil >
{

public ProfilDescriptor(Class < ? extends Profil > clazz)
{
super(clazz);
}

@Override
public String getDisplayName()
{
return clazz.getSimpleName();
}
}

public static class Jahia extends Profil
{
private String tomcatService, jahiaWebApp;

@DataBoundConstructor
public Jahia(String tomcatService, String jahiapublic static 
abstract class Profil implements Describable < Profil >
{

protected String name;

private Profil(String name)
{
this.name  = name;
}

public String getName() {
return name;
}

public Descriptor < Profil > getDescriptor()
{
return Jenkins.getInstance().getDescriptor(getClass());
}
}

public static class ProfilDescriptor extends Descriptor < Profil >
{

public ProfilDescriptor(Class < ? extends Profil > clazz)
{
super(clazz);
}

@Override
public String getDisplayName()
{
return clazz.getSimpleName();
}
}

public static class Jahia extends Profil
{
private String tomcatService, jahiaWebApp;

@DataBoundConstructor
public Jahia(String tomcatService, String jahiaWebApp)
{
super("deploy-jahia-module");
this.tomcatService = tomcatService;
this.jahiaWebApp = jahiaWebApp;
}

public String getTomcatService()
{
return tomcatService;
}

public String getJahiaWebApp()
{
return jahiaWebApp;
}

@Extension
public static final ProfilDescriptor descriptor = new 
ProfilDescriptor(Jahia.class);

}

public static class Scala extends Profil
{
private String scalaRootDir;

@DataBoundConstructor
public Scala(String scalaRootDir)
{
super("deploy-play-module");
this.scalaRootDir = scalaRootDir;
}

public String getScalaRootDir()
{
return scalaRootDir;
}

@Extension
public static final ProfilDescriptor descriptor = new 
ProfilDescriptor(Scala.class);
}WebApp)
{
super("deploy-jahia-module");
this.tomcatService = tomcatService;
this.jahiaWebApp = jahiaWebApp;
}

public String getTomcatService()
{
return tomcatService;
}

public String getJahiaWebApp()
{
return jahiaWebApp;
}

@Extension
public static final ProfilDescriptor descriptor = new 
ProfilDescriptor(Jahia.class);

}

public static class Scala extends Profil
{
private String scalaRootDir;

@DataBoundConstructor
public Scala(String scalaRootDir)
{
super("deploy-play-module");
this.scalaRootDir = scalaRootDir;
}

public String getScalaRootDir()
{
return scalaRootDir;
}

@Extension
public static final ProfilDescriptor descriptor = new 
ProfilDescriptor(Scala.class);
}

How can I solve this problem?


DataboundConstructor is not working

2013-01-16 Thread Dimitri CHARLES
Hi, I have a problem using DataboundConstructor. 
I am currently writing a jenkins plugin and I have a class called 
RemoteDeploymentBuilder  whose constructor is defined like this: 

@DataBoundConstructor
public RemoteDeploymentBuilder(Profil profil, String environment, 
String component, String version)
{
this.profil = profil;
this.environment = environment;
this.component = component;
this.version = version;
}

Actually, I have a problem saving the profil parameter. The Profil class 
and subclass are defined like this (this plugin is very similar to Dropdown 
list in UI Sample plugin) :

public static abstract class Profil implements Describable < Profil >
{

protected String name;

protected Profil(String name)
{
this.name = name;
}

public Descriptor < Profil > getDescriptor()
{
return Jenkins.getInstance().getDescriptor(getClass());
}
}

public static class ProfilDescriptor extends Descriptor < Profil >
{

public ProfilDescriptor(Class < ? extends Profil > clazz)
{
super(clazz);
}

@Override
public String getDisplayName()
{
LOGGER.info(">> Name = " + clazz.getSimpleName());
return clazz.getSimpleName();
}
}

public static class Jahia extends Profil
{
private String tomcatService, jahiaWebApp;

@DataBoundConstructor
public Jahia(String tomcatService, String jahiaWebApp)
{
super("deploy-jahia-module");
this.tomcatService = tomcatService;
this.jahiaWebApp = jahiaWebApp;
}

public String getTomcatService()
{
return tomcatService;
}

public String getJahiaWebApp()
{
return jahiaWebApp;
}

@Extension
public static final ProfilDescriptor descriptor = new 
ProfilDescriptor(Jahia.class);

}

public static class Scala extends Profil
{
private String scalaRootDir;

@DataBoundConstructor
public Scala(String scalaRootDir)
{
super("deploy-play-module");
this.scalaRootDir = scalaRootDir;
}

public String getScalaRootDir()
{
return scalaRootDir;
}

@Extension
public static final ProfilDescriptor descriptor = new 
ProfilDescriptor(Scala.class);
}


Jahia class and Scala class have their own config.jelly. 
I would like to save the properties  tomcatService, jahiaWebApp,  
scalaRootDir. 
How can I do that? 

I tried using the @DataboundConstructor but it does not work. 





Re: Calling a maven instance from a plugin

2012-11-14 Thread Dimitri CHARLES
Hi James, I finally corrected my mistakes. 
In fact, in the setUp, instead of returning a new Environment, I just 
called the super.setUp and that gave the error show above. 

And now, I am returning a new Environment and everything works. Thanks for 
your help !!

Le mercredi 14 novembre 2012 18:03:19 UTC+1, Dimitri CHARLES a écrit :
>
> Hi James, 
>
> Thanks for your answer. I am able to pass my custom variable to maven but 
> when I am launching a build, I have a strange error : 
>
> saying  : 
>
> *Building in workspace 
> D:\workspace2\remote-deployment-new\work\jobs\Maven\workspace
> FATAL: The plugin 'com.ebiznext.plugins.RemoteDeploymentWrapper' still uses 
> deprecated setUp(Build,Launcher,BuildListener) method. Update the plugin to 
> use setUp(AbstractBuild, Launcher, BuildListener) 
> instead.java.lang.AssertionError 
> <http://stacktrace.jenkins-ci.org/search?query=java.lang.AssertionError>: The 
> plugin 'com.ebiznext.plugins.RemoteDeploymentWrapper' still uses deprecated 
> setUp(Build,Launcher,BuildListener) method. Update the plugin to use 
> setUp(AbstractBuild, Launcher, BuildListener) instead.
>   at hudson.tasks.BuildWrapper.setUp(BuildWrapper.java:144) 
> <http://stacktrace.jenkins-ci.org/search/?query=hudson.tasks.BuildWrapper.setUp&entity=method>
>   at 
> com.ebiznext.plugins.RemoteDeploymentWrapper.setUp(RemoteDeploymentWrapper.java:100)
>  
> <http://stacktrace.jenkins-ci.org/search/?query=com.ebiznext.plugins.RemoteDeploymentWrapper.setUp&entity=method>
>   at 
> hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:601)
>  
> <http://stacktrace.jenkins-ci.org/search/?query=hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun&entity=method>
>   at 
> hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586) 
> <http://stacktrace.jenkins-ci.org/search/?query=hudson.model.AbstractBuild$AbstractBuildExecution.run&entity=method>
> *
>
>
>
> It's strange because I have implemented the correct method, not the 
> deprecated one :
>
> *public class RemoteDeploymentWrapper extends BuildWrapper {
> *
> *
> *
> *  *
> *
> *
> *public Environment setUp(@SuppressWarnings("rawtypes") AbstractBuild 
> build, Launcher launcher, final BuildListener listener)*
> *throws IOException,*
> *InterruptedException {*
> * ...*
> *   } *
> *}*
>
> Thanks for your advice !!
> Le mercredi 14 novembre 2012 16:04:02 UTC+1, teilo a écrit :
>>
>>  It uses the getGoalsAndOptions rather than the intercept.
>>
>>  
>>
>> Intercept is more for adding extra options, getGotalsAndOptions is used 
>> to change the default goals that run (the ones that are normally entered in 
>> the UI).
>>
>>  
>>
>> See 
>> https://github.com/jenkinsci/jenkins/blob/master/maven-plugin/src/main/java/hudson/maven/MavenArgumentInterceptorAction.java
>>
>>  
>>
>> /James
>>
>>  
>>
>> *From:* jenkin...@googlegroups.com [mailto:jenkin...@googlegroups.com] *On 
>> Behalf Of *Dimitri CHARLES
>> *Sent:* 14 November 2012 14:37
>> *To:* jenkin...@googlegroups.com
>> *Subject:* Re: Calling a maven instance from a plugin
>>
>>  
>>
>> Hi James,
>>  
>>  
>>  
>> Thanks for your answer. 
>>  
>>  
>>  
>> I watched and it seems that I have to implement 
>> MavenArgumentInterceptorAction. 
>>  
>>  
>>  
>> But in the class M2ReleaseArgumentInterceptorAction, why dont implement 
>> the intercept method?
>>  
>>  
>>  
>>
>> Le mercredi 14 novembre 2012 13:04:45 UTC+1, teilo a écrit :
>>  
>> Hi Dimitri,
>>
>>  
>>
>> Don’t use it – just look at the code which will give you an example of 
>> changing the goals.
>>
>>  
>>
>> /James
>>
>>  
>>
>> *From:* jenkin...@googlegroups.com [mailto:jenkin...@googlegroups.com] *On 
>> Behalf Of *Dimitri CHARLES
>> *Sent:* 14 November 2012 11:57
>> *To:* jenkin...@googlegroups.com
>> *Subject:* Re: Calling a maven instance from a plugin
>>
>>  
>>
>> Hi James, 
>>  
>> Thanks for your answer. 
>>  
>>  
>>  
>> How can I use this plugin. I see that it is used to perform Maven 
>> release. Can you give me an example how can I use it?
>>  
>>  
>>  
>> Thanks
>>
>> Le mercredi 14 novembre 2012 12:29:14 UTC+1, teilo a écrit :
>>  
>> Ta

Re: Calling a maven instance from a plugin

2012-11-14 Thread Dimitri CHARLES
Hi James, 

Thanks for your answer. I am able to pass my custom variable to maven but 
when I am launching a build, I have a strange error : 

saying  : 

*Building in workspace 
D:\workspace2\remote-deployment-new\work\jobs\Maven\workspace
FATAL: The plugin 'com.ebiznext.plugins.RemoteDeploymentWrapper' still uses 
deprecated setUp(Build,Launcher,BuildListener) method. Update the plugin to use 
setUp(AbstractBuild, Launcher, BuildListener) instead.java.lang.AssertionError 
<http://stacktrace.jenkins-ci.org/search?query=java.lang.AssertionError>: The 
plugin 'com.ebiznext.plugins.RemoteDeploymentWrapper' still uses deprecated 
setUp(Build,Launcher,BuildListener) method. Update the plugin to use 
setUp(AbstractBuild, Launcher, BuildListener) instead.
at hudson.tasks.BuildWrapper.setUp(BuildWrapper.java:144) 
<http://stacktrace.jenkins-ci.org/search/?query=hudson.tasks.BuildWrapper.setUp&entity=method>
at 
com.ebiznext.plugins.RemoteDeploymentWrapper.setUp(RemoteDeploymentWrapper.java:100)
 
<http://stacktrace.jenkins-ci.org/search/?query=com.ebiznext.plugins.RemoteDeploymentWrapper.setUp&entity=method>
at 
hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:601)
 
<http://stacktrace.jenkins-ci.org/search/?query=hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun&entity=method>
at 
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586) 
<http://stacktrace.jenkins-ci.org/search/?query=hudson.model.AbstractBuild$AbstractBuildExecution.run&entity=method>
*



It's strange because I have implemented the correct method, not the 
deprecated one :

*public class RemoteDeploymentWrapper extends BuildWrapper {
*
*
*
*  *
*
*
*public Environment setUp(@SuppressWarnings("rawtypes") AbstractBuild 
build, Launcher launcher, final BuildListener listener)*
*throws IOException,*
*InterruptedException {*
* ...*
*   } *
*}*

Thanks for your advice !!
Le mercredi 14 novembre 2012 16:04:02 UTC+1, teilo a écrit :
>
>  It uses the getGoalsAndOptions rather than the intercept.
>
>  
>
> Intercept is more for adding extra options, getGotalsAndOptions is used to 
> change the default goals that run (the ones that are normally entered in 
> the UI).
>
>  
>
> See 
> https://github.com/jenkinsci/jenkins/blob/master/maven-plugin/src/main/java/hudson/maven/MavenArgumentInterceptorAction.java
>
>  
>
> /James
>
>  
>
> *From:* jenkin...@googlegroups.com  [mailto:
> jenkin...@googlegroups.com ] *On Behalf Of *Dimitri CHARLES
> *Sent:* 14 November 2012 14:37
> *To:* jenkin...@googlegroups.com 
> *Subject:* Re: Calling a maven instance from a plugin
>
>  
>
> Hi James,
>  
>  
>  
> Thanks for your answer. 
>  
>  
>  
> I watched and it seems that I have to implement 
> MavenArgumentInterceptorAction. 
>  
>  
>  
> But in the class M2ReleaseArgumentInterceptorAction, why dont implement 
> the intercept method?
>  
>  
>  
>
> Le mercredi 14 novembre 2012 13:04:45 UTC+1, teilo a écrit :
>  
> Hi Dimitri,
>
>  
>
> Don’t use it – just look at the code which will give you an example of 
> changing the goals.
>
>  
>
> /James
>
>  
>
> *From:* jenkin...@googlegroups.com [mailto:jenkin...@googlegroups.com] *On 
> Behalf Of *Dimitri CHARLES
> *Sent:* 14 November 2012 11:57
> *To:* jenkin...@googlegroups.com
> *Subject:* Re: Calling a maven instance from a plugin
>
>  
>
> Hi James, 
>  
> Thanks for your answer. 
>  
>  
>  
> How can I use this plugin. I see that it is used to perform Maven release. 
> Can you give me an example how can I use it?
>  
>  
>  
> Thanks
>
> Le mercredi 14 novembre 2012 12:29:14 UTC+1, teilo a écrit :
>  
> Take a look at the m2release plugin – you can dynamically (and optionally) 
> change the default goals that get passed to maven in a plugin.
>
>  
>
> /James
>
>  
>
> *From:* jenkin...@googlegroups.com [mailto:jenkin...@googlegroups.com] *On 
> Behalf Of *Dimitri CHARLES
> *Sent:* 14 November 2012 09:11
> *To:* jenkin...@googlegroups.com
> *Subject:* Calling a maven instance from a plugin
>
>  
>
> Hi, I am actually writing a plugin where I want to pass some customs 
> parameters, goals 
>  
>  
>  
> to a maven instance. For instance, some profiles, some properties 
> contained in a POM (-Dproperty=value). 
>  
>  
>  
> I tried to look in the jenkins code and I see that the class 
> hudson.tasks.Maven <http://javadoc.jenkins-ci.org/hudson/tasks/Maven.html> 
> could 
> help me. But I also see there is the
>  
>  
>  
>

Re: Calling a maven instance from a plugin

2012-11-14 Thread Dimitri CHARLES
Hi James,

Thanks for your answer. 

I watched and it seems that I have to implement 
MavenArgumentInterceptorAction. 

But in the class M2ReleaseArgumentInterceptorAction, why dont implement the 
intercept method?


Le mercredi 14 novembre 2012 13:04:45 UTC+1, teilo a écrit :
>
>  Hi Dimitri,
>
>  
>
> Don’t use it – just look at the code which will give you an example of 
> changing the goals.
>
>  
>
> /James
>
>  
>
> *From:* jenkin...@googlegroups.com  [mailto:
> jenkin...@googlegroups.com ] *On Behalf Of *Dimitri CHARLES
> *Sent:* 14 November 2012 11:57
> *To:* jenkin...@googlegroups.com 
> *Subject:* Re: Calling a maven instance from a plugin
>
>  
>
> Hi James, 
>  
> Thanks for your answer. 
>  
>  
>  
> How can I use this plugin. I see that it is used to perform Maven release. 
> Can you give me an example how can I use it?
>  
>  
>  
> Thanks
>
> Le mercredi 14 novembre 2012 12:29:14 UTC+1, teilo a écrit :
>  
> Take a look at the m2release plugin – you can dynamically (and optionally) 
> change the default goals that get passed to maven in a plugin.
>
>  
>
> /James
>
>  
>
> *From:* jenkin...@googlegroups.com [mailto:jenkin...@googlegroups.com] *On 
> Behalf Of *Dimitri CHARLES
> *Sent:* 14 November 2012 09:11
> *To:* jenkin...@googlegroups.com
> *Subject:* Calling a maven instance from a plugin
>
>  
>
> Hi, I am actually writing a plugin where I want to pass some customs 
> parameters, goals 
>  
>  
>  
> to a maven instance. For instance, some profiles, some properties 
> contained in a POM (-Dproperty=value). 
>  
>  
>  
> I tried to look in the jenkins code and I see that the class 
> hudson.tasks.Maven <http://javadoc.jenkins-ci.org/hudson/tasks/Maven.html> 
> could 
> help me. But I also see there is the
>  
>  
>  
> class 
> AbstractMavenBuilder<http://javadoc.jenkins-ci.org/hudson/maven/AbstractMavenBuilder.html>.
>  
> The idea that I have for the first one is I have a maven property (type of 
> Maven) in my plugin (my plugin is a class that extends Builder),
>  
>  
>  
> and I instantiate this property with my custom goals. In my perform 
> method, I call maven.perform(). 
>  
>  
>  
> For the  AbstractMavenBuilder,   I discovered it yesterday and I was 
> thinking to extend this class. 
>  
>  
>  
> Is this a better way to do that? Can you show an example how to call a 
> maven instance from a plugin?
>  
>  
>  
> Thanks for your suggestion
>  
>  
>  
>  
>  --
>  
>
>
>
> **
> This message is confidential and intended only for the addressee. If you 
> have received this message in error, please immediately notify the 
> postm...@nds.com and delete it from your system as well as any copies. 
> The content of e-mails as well as traffic data may be monitored by NDS for 
> employment and security purposes. To protect the environment please do not 
> print this e-mail unless necessary.
>
> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 
> 4EX, United Kingdom. A company registered in England and Wales. Registered 
> no. 3080780. VAT no. GB 603 8808 40-00
>
> **
>   
> --
>
>
>
> **
> This message is confidential and intended only for the addressee. If you 
> have received this message in error, please immediately notify the 
> postm...@nds.com  and delete it from your system as well as 
> any copies. The content of e-mails as well as traffic data may be monitored 
> by NDS for employment and security purposes. To protect the environment 
> please do not print this e-mail unless necessary.
>
> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 
> 4EX, United Kingdom. A company registered in England and Wales. Registered 
> no. 3080780. VAT no. GB 603 8808 40-00
>
> **
>  


Re: Calling a maven instance from a plugin

2012-11-14 Thread Dimitri CHARLES
Hi James, 
Thanks for your answer. 

How can I use this plugin. I see that it is used to perform Maven release. 
Can you give me an example how can I use it?

Thanks

Le mercredi 14 novembre 2012 12:29:14 UTC+1, teilo a écrit :
>
>  Take a look at the m2release plugin – you can dynamically (and 
> optionally) change the default goals that get passed to maven in a plugin.
>
>  
>
> /James
>
>  
>
> *From:* jenkin...@googlegroups.com  [mailto:
> jenkin...@googlegroups.com ] *On Behalf Of *Dimitri CHARLES
> *Sent:* 14 November 2012 09:11
> *To:* jenkin...@googlegroups.com 
> *Subject:* Calling a maven instance from a plugin
>
>  
>
> Hi, I am actually writing a plugin where I want to pass some customs 
> parameters, goals 
>  
>  
>  
> to a maven instance. For instance, some profiles, some properties 
> contained in a POM (-Dproperty=value). 
>  
>  
>  
> I tried to look in the jenkins code and I see that the class 
> hudson.tasks.Maven <http://javadoc.jenkins-ci.org/hudson/tasks/Maven.html> 
> could 
> help me. But I also see there is the
>  
>  
>  
> class 
> AbstractMavenBuilder<http://javadoc.jenkins-ci.org/hudson/maven/AbstractMavenBuilder.html>.
>  
> The idea that I have for the first one is I have a maven property (type of 
> Maven) in my plugin (my plugin is a class that extends Builder),
>  
>  
>  
> and I instantiate this property with my custom goals. In my perform 
> method, I call maven.perform(). 
>  
>  
>  
> For the  AbstractMavenBuilder,   I discovered it yesterday and I was 
> thinking to extend this class. 
>  
>  
>  
> Is this a better way to do that? Can you show an example how to call a 
> maven instance from a plugin?
>  
>  
>  
> Thanks for your suggestion
>  
>  
>  
> --
>
>
>
> **
> This message is confidential and intended only for the addressee. If you 
> have received this message in error, please immediately notify the 
> postm...@nds.com  and delete it from your system as well as 
> any copies. The content of e-mails as well as traffic data may be monitored 
> by NDS for employment and security purposes. To protect the environment 
> please do not print this e-mail unless necessary.
>
> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 
> 4EX, United Kingdom. A company registered in England and Wales. Registered 
> no. 3080780. VAT no. GB 603 8808 40-00
>
> **
>  


Calling a maven instance from a plugin

2012-11-14 Thread Dimitri CHARLES
Hi, I am actually writing a plugin where I want to pass some customs 
parameters, goals 

to a maven instance. For instance, some profiles, some properties contained 
in a POM (-Dproperty=value). 

I tried to look in the jenkins code and I see that the class 
hudson.tasks.Maven  
could 
help me. But I also see there is the

class 
AbstractMavenBuilder.
 
The idea that I have for the first one is I have a maven property (type of 
Maven) in my plugin (my plugin is a class that extends Builder),

and I instantiate this property with my custom goals. In my perform method, 
I call maven.perform(). 

For the  AbstractMavenBuilder,   I discovered it yesterday and I was 
thinking to extend this class. 

Is this a better way to do that? Can you show an example how to call a 
maven instance from a plugin?

Thanks for your suggestion



Re: Dynamic Drop DownList Box

2012-11-13 Thread Dimitri CHARLES
Hi, 
Thanks for your answer and it works.



Le mercredi 7 novembre 2012 14:52:46 UTC+1, Dimitri CHARLES a écrit :
>
> Hi,
>
> I am actually implementing a jenkins plugin where I want to update the 
> contents of a  control dynamically based on selections of other 
> controls.
> For instance, if I have 2  selects. The first one contains values ( a list 
> of environments) like Env1, Env2, Env3 etc. The second one contains values 
> (a list of nodes, each environment contains a list of nodes) likes n11, 
> n12, n13, n21, n22, V23, etc. It can be seen as key value pair. Env1 has n11, 
> n12, n13, or Env2 has n21, n22, n23 and so on. I would like when I select 
> Env1 or Env2, it displays the correct values in the second select. 
> I follow the same example in UI Samples plugin in the dynamic dropdown 
> list, but it doesn't work. 
> Here is my config.jelly file : 
>
>field="environments">
>  onChange="loadNodesForEnv(this);" />
> 
> 
> 
> 
> ...
>
> In my descriptor, I have written those 2 methods (as the Dynamic Dropdown 
> list plugin) :
>
> public ListBoxModel doFillEnvironmentsItems() {
> LOG.info("=== Environments 
> ===");
> ListBoxModel models = new ListBoxModel();
> List envs = EnvironmentManager.getInstance()
> .getEnvironments();
> for (Environment e : envs) {
> models.add(e.getName());
> }
> return models;
> }
>
>
>   public ListBoxModel doFillNodesItems(@QueryParameter   String 
> environments) {
> if (environments == null) {
> LOG.info(" NU 
> ==");
> }
> ListBoxModel models = new ListBoxModel();
> models.add("Nodes test");
>
> return models;
> }
>
> I am able to update the environments but unable to fill the nodes. In the 
> second method, the parameter environments is Null.
>
> How can I correct that.
>
> Best regards
>


Dynamic Drop DownList Box

2012-11-07 Thread Dimitri CHARLES
Hi,

I am actually implementing a jenkins plugin where I want to update the 
contents of a  control dynamically based on selections of other 
controls.
For instance, if I have 2  selects. The first one contains values ( a list 
of environments) like Env1, Env2, Env3 etc. The second one contains values 
(a list of nodes, each environment contains a list of nodes) likes n11, 
n12, n13, n21, n22, V23, etc. It can be seen as key value pair. Env1 has n11, 
n12, n13, or Env2 has n21, n22, n23 and so on. I would like when I select 
Env1 or Env2, it displays the correct values in the second select. 
I follow the same example in UI Samples plugin in the dynamic dropdown 
list, but it doesn't work. 
Here is my config.jelly file : 

  





...

In my descriptor, I have written those 2 methods (as the Dynamic Dropdown 
list plugin) :

public ListBoxModel doFillEnvironmentsItems() {
LOG.info("=== Environments 
===");
ListBoxModel models = new ListBoxModel();
List envs = EnvironmentManager.getInstance()
.getEnvironments();
for (Environment e : envs) {
models.add(e.getName());
}
return models;
}


  public ListBoxModel doFillNodesItems(@QueryParameter   String 
environments) {
if (environments == null) {
LOG.info(" NU 
==");
}
ListBoxModel models = new ListBoxModel();
models.add("Nodes test");

return models;
}

I am able to update the environments but unable to fill the nodes. In the 
second method, the parameter environments is Null.

How can I correct that.

Best regards


Jenkins Development and Scala

2012-11-06 Thread Dimitri CHARLES
I am actually developing a plugin for Jenkins, and I want to integrate 
Scala, Java and Maven in my plugin. I developed part of my plugin in Java 
and I would like to develop other parts in Scala. 
The thing is when I integrate all of them (maven, Scala, and Java), I get 
this error from the scala maven plugin : 

[INFO] artifact org.kohsuke.stapler:stapler: checking for updates 
from scala
[INFO] D:\workspace\remote-deployment-new\src\main\java:-1: info: 
compiling
[INFO] 
D:\workspace\remote-deployment-new\target\generated-sources\localizer:-1: 
info: compiling
[INFO] Compiling 4 source files to 
D:\workspace\remote-deployment-new\target\classes at 1352200897840
[ERROR] 
D:\workspace\remote-deployment-new\src\main\java\com\ebiznext\plugins\RemoteDeployment.java:33:
 
error: RemoteDep
loyment is already defined as package RemoteDeployment
[INFO] public class RemoteDeployment extends Plugin implements Action, 
ExtensionPoint, Describable {
[INFO]  ^
[ERROR] one error found
[INFO] 

[INFO] BUILD FAILURE
[INFO] 

[INFO] Total time: 52.801s
[INFO] Finished at: Tue Nov 06 12:21:39 CET 2012
[INFO] Final Memory: 27M/370M
[INFO] 

[ERROR] Failed to execute goal 
net.alchim31.maven:scala-maven-plugin:3.1.0:compile (default) on project 
remote-deploymen
t-new: wrap: org.apache.commons.exec.ExecuteException: Process exited 
with an error: 1(Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with 
the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, 
please read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException



I totally understand the error  saying that the class `RemoteDeployment` is 
already defined as a package. It's true, since RemoteDeployment is a class, 
that extends Plugin, defined in the package com.ebiznext.plugins and follow 
Jenkins convention to create a package 
`com.ebiznext.plugins.RemoteDeployment` under `src/main/resources`.

How can I correct this problem?



Adding new custom view/page in a plugin

2012-10-25 Thread Dimitri CHARLES
Hello, 
I am a beginner in developing a plugin in Jenkins and I would like to add a 
custom page or View in my plugin. 

Let me explain. this puglin contains a set of environments that contains a 
list of nodes, that are displayed in a table with clickable links (like for 
the jobs in the dashboard). What I want to do is, when I click in the 
environment link, I go to a page I want to a page that displays 
informations about the environment. I also want it to match my url 
pattern. For instance, if the name of the plugin is myPlugin. If i go the 
environment env1, it should match myPuglin/Environment/env1. And I want to 
do the same thing for the nodes.

After searching in the documentation, my guess (maybe I am wrong) is to 
extend the View class and to add newview.jelly file. 

Can someone guide me to this process !!

Thanks in advance !!


Re: Unable to test Jenkins plugin

2012-10-23 Thread Dimitri CHARLES
Hi, thanks for your answer. 

I went to test it with maven 3.0.4 and he works. Thanks for your guidance. 

But I have some questions. In my company, we mostly use maven 2.2.1 for 
building our project. If I create my plugin with the latest version,
will there be compatibility problems? 

Dimitri

Le mardi 23 octobre 2012 02:19:46 UTC+2, kinow a écrit :
>
> Hi Dimitri, 
>
> I created a plug-in last week I think, and run mvn hpi:run and it worked 
> fine (it was using 1.466 too).
>
> But my Maven is 3.0.4. There are some special settings for Maven 2.x in 
> the plug-in tutorial, but could you consider updating your Maven to 3.0.4, 
> maybe installing both, and giving it a try? 
>
> If you are not able to run the plug-in with Maven 3.0.4, then we can 
> further investigate this issue. What do you think? 
>
> Bruno P. Kinoshita
> http://kinoshita.eti.br 
> http://tupilabs.com 
>
>
> >
> > From: Dimitri CHARLES >
> >To: jenkin...@googlegroups.com  
> >Sent: Monday, 22 October 2012 9:45 PM
> >Subject: Re: Unable to test Jenkins plugin
> > 
> >
> >I forgot to say that I am using 
> >Maven 2.2.1
> >Jenkins 1.466
> >
> >Le mardi 23 octobre 2012 01:32:58 UTC+2, Dimitri CHARLES a écrit :
> >I am actually trying to develop a Jenkins plugin using maven but I am 
> unable to test it.
> >>I created my project with the command mvn -cpu hpi:create. I called 
> the project jenkins-plugin-tutorial. I packaged it with mvn package or mvn 
> install and run the Jenkins server with mvn hpi:run.
> >>By default, there is a HelloWorlBuilder for testing purpose that should 
> appear at the Jenkins configuration page (Jenkins Menu -> Manage Jenkins -> 
> Configure System) or under the Build section, but it does not display.
> >>I followed these two tutorials (here and here) step by step many times 
> by making sure that I do not make a mistake but it still dont work.
> >>Maybe I have made something wrong. Can somebody gives me some hint how 
> to correct my errors.
> >
> >  
>
>

Re: Unable to test Jenkins plugin

2012-10-22 Thread Dimitri CHARLES
I forgot to say that I am using 
Maven 2.2.1
Jenkins 1.466

Le mardi 23 octobre 2012 01:32:58 UTC+2, Dimitri CHARLES a écrit :
>
> I am actually trying to develop a Jenkins plugin using maven but I am 
> unable to test it.
>
> I created my project with the command mvn -cpu hpi:create. I called the 
> project 
> jenkins-plugin-tutorial. I packaged it with mvn package or mvn install and 
> run the Jenkins server with mvn hpi:run.
>
> By default, there is a HelloWorlBuilder for testing purpose that should 
> appear at the Jenkins configuration page (Jenkins Menu -> Manage Jenkins -> 
> Configure System) or under the Build section, but it does not display.
>
> I followed these two tutorials 
> (here<http://blog.codecentric.de/en/2012/08/tutorial-create-a-jenkins-plugin-to-integrate-jenkins-and-nexus-repository/>
>  and here <https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial>) 
> step by step many times by making sure that I do not make a mistake but it 
> still dont work.
>
> Maybe I have made something wrong. Can somebody gives me some hint how to 
> correct my errors.
>


Unable to test Jenkins plugin

2012-10-22 Thread Dimitri CHARLES


I am actually trying to develop a Jenkins plugin using maven but I am 
unable to test it.

I created my project with the command mvn -cpu hpi:create. I called the project 
jenkins-plugin-tutorial. I packaged it with mvn package or mvn install and 
run the Jenkins server with mvn hpi:run.

By default, there is a HelloWorlBuilder for testing purpose that should 
appear at the Jenkins configuration page (Jenkins Menu -> Manage Jenkins -> 
Configure System) or under the Build section, but it does not display.

I followed these two tutorials 
(here
 and here ) 
step by step many times by making sure that I do not make a mistake but it 
still dont work.

Maybe I have made something wrong. Can somebody gives me some hint how to 
correct my errors.