Re: Jenkins Common Coding Questions in GSoC 2019

2019-06-04 Thread martinda
Hi Yufei,

I am running on commit 19164b7 with these versions:
~/Downloads/apache-maven-3.6.0/bin/mvn compile
[INFO] Scanning for projects...
[INFO] 
[INFO] -< org.jenkins-ci.plugins:external-workspace-manager 
>--
[INFO] Building External Workspace Manager Plugin 1.1.3-SNAPSHOT
[INFO] [ hpi 
]-
[INFO] 
[INFO] --- maven-hpi-plugin:3.5:validate (default-validate) @ 
external-workspace-manager ---
[INFO] 
[INFO] --- maven-enforcer-plugin:3.0.0-M2:display-info (display-info) @ 
external-workspace-manager ---
[INFO] Maven Version: 3.6.0
[INFO] JDK Version: 1.8.0_212 normalized as: 1.8.0-212
[INFO] OS Info: Arch: amd64 Family: unix Name: linux Version: 
4.15.0-47-generic


And I run in the same error as the Jenkins build in the pull-request 62 
build #5 

:
[ERROR] 
/home/martin/git/jenkinsci/external-workspace-manager-plugin/src/main/java/org/jenkinsci/plugins/ewm/clouds/Aws/AwsEfsMounter.java:[13,15]
 
modifier static not allowed here
[ERROR] 
/home/martin/git/jenkinsci/external-workspace-manager-plugin/src/main/java/org/jenkinsci/plugins/ewm/clouds/Aws/AwsEfsMounter.java:[29,38]
 
cannot find symbol
  symbol:   class ProfileCredentialsProvider
  location: class org.jenkinsci.plugins.ewm.clouds.Aws.AwsEfsMounter
[ERROR] 
/home/martin/git/jenkinsci/external-workspace-manager-plugin/src/main/java/org/jenkinsci/plugins/ewm/steps/ExwsAllocateExecution.java:[97,50]
 
incompatible types: org.jenkinsci.plugins.ewm.definitions.Disk cannot be 
converted to org.jenkinsci.plugins.ewm.definitions.AwsEfsDisk


It's probably something in your local environment.

Martin

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/20ac897e-0d01-4839-b534-b812576daa99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-06-04 Thread Yufei Zhang
Sorry I didn't make it clear, I want to fix this problem in my local 
environment, and this error has been up for a couple of times, I tried to 
figure out 
what is wrong but couldn't get a clue. I updated to 3.43 (latest) parent 
pom, and still couldn't find out which rule was broke. Not sure if it is 
because 
some dependency versions are too low.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/17f334a7-73cd-446d-ac11-1dd81f279beb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-06-03 Thread Baptiste Mathus
Current failure in that PR is a compile error, not enforcer related.

Also, update to latest parent pom to use latest enforcer plugin already.

Le mar. 4 juin 2019 à 07:39, Yufei Zhang  a écrit :

> Hi, this is the related PR :
> https://github.com/jenkinsci/external-workspace-manager-plugin/pull/62
> The java version should be :
> [INFO] Maven Version: 3.6.0
> [INFO] JDK Version: 1.8.0_212 normalized as: 1.8.0-212
> [INFO] OS Info: Arch: amd64 Family: unix Name: linux Version:
> 4.15.0-50-generic
>
> When I delete the related pom entry for AWS java SDK, it will goes to the
> compile phase, but with the AWS Java pom entry, it fails at enforce.
>
> 在 2019年6月3日星期一 UTC-7下午10:09:45,Baptiste Mathus写道:
>>
>> Can you push a PR somewhere that shows the failure?
>>
>> Can you run with mvn -V compile and show the first lines (i.e. the JDK
>> and maven versions in use).
>>
>> Also I'd recommend bumping to the latest parent pom (3.43 to date)
>>
>> Le mar. 4 juin 2019 à 06:53, Yufei Zhang  a écrit :
>>
>>> QUESTION 6 : This is a AWS Java SDK related problem and I think it has
 something to do with the pom.xml

>>> When I run *mvn compile*, it has error like this :
>>>
>>> Execution display-info of goal
>>> org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1:enforce failed.:
>>> NullPointerException
>>>
>>> Part of my pom.xml look like this
>>>
>>> 
>>> org.jenkins-ci.plugins
>>> plugin
>>> 3.18
>>> 
>>>
>>> external-workspace-manager
>>> 1.1.3-SNAPSHOT
>>> hpi
>>>
>>> 
>>> 2.60.3
>>> 8
>>>
>>> -Xmx1024m
>>>
>>> 
>>>
>>>
>>> and the AWS Java SDK property was copied from ec2-plugin pom.xml.
>>> it looks like
>>>
>>> 
>>> org.jenkins-ci.plugins
>>> aws-java-sdk
>>> 1.11.457
>>> 
>>>
>>>
>>> And the pom.xml in ec2-plugin looks like
>>>
>>> 
>>> org.jenkins-ci.plugins
>>> plugin
>>> 3.25
>>> 
>>>
>>>
>>> I tried upgrade my plugin version to 3.25, but didn't work, does anyone
>>> know what's the potential problem ? Thanks !
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Jenkins Developers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to jenkin...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jenkinsci-dev/2ab86fec-880c-4470-9604-e14d7df64e22%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/bfc0a42c-dacf-49bb-91d9-9704d159de46%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANWgJS4XWRAxA17B4YHejgPPLaCXfB-%2BhdeqTVN-bOny1fWe%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-06-03 Thread Yufei Zhang
Hi, this is the related PR : 
https://github.com/jenkinsci/external-workspace-manager-plugin/pull/62
The java version should be : 
[INFO] Maven Version: 3.6.0
[INFO] JDK Version: 1.8.0_212 normalized as: 1.8.0-212
[INFO] OS Info: Arch: amd64 Family: unix Name: linux Version: 
4.15.0-50-generic

When I delete the related pom entry for AWS java SDK, it will goes to the 
compile phase, but with the AWS Java pom entry, it fails at enforce.

在 2019年6月3日星期一 UTC-7下午10:09:45,Baptiste Mathus写道:
>
> Can you push a PR somewhere that shows the failure?
>
> Can you run with mvn -V compile and show the first lines (i.e. the JDK and 
> maven versions in use).
>
> Also I'd recommend bumping to the latest parent pom (3.43 to date)
>
> Le mar. 4 juin 2019 à 06:53, Yufei Zhang > 
> a écrit :
>
>> QUESTION 6 : This is a AWS Java SDK related problem and I think it has 
>>> something to do with the pom.xml
>>>
>> When I run *mvn compile*, it has error like this :
>>
>> Execution display-info of goal 
>> org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1:enforce failed.: 
>> NullPointerException
>>
>> Part of my pom.xml look like this
>>
>> 
>> org.jenkins-ci.plugins
>> plugin
>> 3.18
>> 
>>
>> external-workspace-manager
>> 1.1.3-SNAPSHOT
>> hpi
>>
>> 
>> 2.60.3
>> 8
>>
>> -Xmx1024m
>>
>>  
>>
>>
>> and the AWS Java SDK property was copied from ec2-plugin pom.xml.
>> it looks like 
>>
>> 
>> org.jenkins-ci.plugins
>> aws-java-sdk
>> 1.11.457
>> 
>>
>>  
>> And the pom.xml in ec2-plugin looks like 
>>
>> 
>> org.jenkins-ci.plugins
>> plugin
>> 3.25
>> 
>>
>>
>> I tried upgrade my plugin version to 3.25, but didn't work, does anyone 
>> know what's the potential problem ? Thanks !
>>
>>
>>
>>
>>
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkin...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-dev/2ab86fec-880c-4470-9604-e14d7df64e22%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/bfc0a42c-dacf-49bb-91d9-9704d159de46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-06-03 Thread Baptiste Mathus
Can you push a PR somewhere that shows the failure?

Can you run with mvn -V compile and show the first lines (i.e. the JDK and
maven versions in use).

Also I'd recommend bumping to the latest parent pom (3.43 to date)

Le mar. 4 juin 2019 à 06:53, Yufei Zhang  a écrit :

> QUESTION 6 : This is a AWS Java SDK related problem and I think it has
>> something to do with the pom.xml
>>
> When I run *mvn compile*, it has error like this :
>
> Execution display-info of goal
> org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1:enforce failed.:
> NullPointerException
>
> Part of my pom.xml look like this
>
> 
> org.jenkins-ci.plugins
> plugin
> 3.18
> 
>
> external-workspace-manager
> 1.1.3-SNAPSHOT
> hpi
>
> 
> 2.60.3
> 8
>
> -Xmx1024m
>
> 
>
>
> and the AWS Java SDK property was copied from ec2-plugin pom.xml.
> it looks like
>
> 
> org.jenkins-ci.plugins
> aws-java-sdk
> 1.11.457
> 
>
>
> And the pom.xml in ec2-plugin looks like
>
> 
> org.jenkins-ci.plugins
> plugin
> 3.25
> 
>
>
> I tried upgrade my plugin version to 3.25, but didn't work, does anyone
> know what's the potential problem ? Thanks !
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/2ab86fec-880c-4470-9604-e14d7df64e22%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANWgJS6ywqmoDJ87gOLss0n1T-DvCE29PS3LG4%3DkbbgDDGNqVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-06-03 Thread Yufei Zhang

>
> QUESTION 6 : This is a AWS Java SDK related problem and I think it has 
> something to do with the pom.xml
>
When I run *mvn compile*, it has error like this :

Execution display-info of goal 
org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1:enforce failed.: 
NullPointerException

Part of my pom.xml look like this


org.jenkins-ci.plugins
plugin
3.18


external-workspace-manager
1.1.3-SNAPSHOT
hpi


2.60.3
8

-Xmx1024m

 


and the AWS Java SDK property was copied from ec2-plugin pom.xml.
it looks like 


org.jenkins-ci.plugins
aws-java-sdk
1.11.457


 
And the pom.xml in ec2-plugin looks like 


org.jenkins-ci.plugins
plugin
3.25



I tried upgrade my plugin version to 3.25, but didn't work, does anyone 
know what's the potential problem ? Thanks !








-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/2ab86fec-880c-4470-9604-e14d7df64e22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-06-03 Thread Jesse Glick
On Sun, Jun 2, 2019 at 2:39 AM Joseph P  wrote:
> Q5: I'd recommend using optionalProperty over optionalBlock

Yes. See `ui-samples-plugin` for an example of usage. Essentially, you
can define a `@CheckForNull` field of some `Describable` type. The
`config.jelly` of that type will appear when the box is checked.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3E-T7EFtUV3ySZ3cx35-6Ur7TGZLim-qcE2q74-o9ZRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-06-03 Thread Jesse Glick
On Sat, Jun 1, 2019 at 9:00 PM Yufei Zhang  wrote:
> For Q4, we can use a Boolean fields

`boolean` not `Boolean`.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr1q5WM6cVzLHbMFRnm457RZO6c9cFLMmRPrMB6AZ92v_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-06-03 Thread Jesse Glick
On Wed, May 22, 2019 at 10:41 AM Matt Sicker  wrote:
> For Q1, I'm not sure how data bound constructor works with inherited
> classes.

Only a concrete class may use `@DataBoundConstructor`. It should be a
compile-time error to apply it to an `abstract` class. (If it is not,
fix the annotation processor!)

> For Q2, this has something to do with the Jenkins API for
> Descriptor/Describable. Typically, you can use a no-arg constructor in
> your Descriptor class to call Descriptor's default constructor which
> uses reflection to determine the proper class argument. For more
> advanced scenarios, you may need to pass an explicit class reference
> to the constructor

Some `abstract` subtypes of `Descriptor` include a `protected`
constructor accepting `Class` just in case some concrete subclass does
not use the normal idiom of defining the descriptor as a nested class
of the corresponding `Describable`. Generally you can ignore this
overload.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr28Abr7LkHE6uEAnD0bgJ%2BZkU-F%2Beg3cLnDPMEMuiNFWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-06-01 Thread Yufei Zhang
For Q4, we can use a Boolean fields, and the corresponding UI element can 
be checkbox or something. But now I have another similiar question

Q5. about foldable configuration block , reference here : 
https://wiki.jenkins.io/display/JENKINS/Writing+a+foldable+section+controlled+by+a+checkbox.
 
In an optional block, if user check the box, the hidden content would 
appear. But besides this, what should I do if I also want to set a certain 
boolean field in the object to be true, when the user check the box. Is 
there a certain tag attribute do such thing ?

 



-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/2b824061-8946-425d-b47e-2145cf1fe21d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-05-29 Thread Yufei Zhang
For Question 3 :  See 
https://wiki.jenkins.io/display/JENKINS/Form+Validation 

在 2019年5月29日星期三 UTC-7下午8:07:06,Yufei Zhang写道:
>
> I will post some more general questions, and see replies to check if it is 
> solved. 
>
>
> QUESTION 3 : In the form validation, what should we do if we want to 
> access other fields input ? 
>
>
>
> QUESTION 4 : Are we restricted to use String and Describable fields only 
> if we want this fields to appear on web UI ? What if I want to use boolean 
> fields as a class member, and make it a form entry ? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/25407b76-27b9-4d84-aee9-9e43301950ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-05-29 Thread Yufei Zhang
I will post some more general questions, and see replies to check if it is 
solved. 


QUESTION 3 : In the form validation, what should we do if we want to access 
other fields input ? 



QUESTION 4 : Are we restricted to use String and Describable fields only if 
we want this fields to appear on web UI ? What if I want to use boolean 
fields as a class member, and make it a form entry ? 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/a145cd0a-cbea-407f-9bc1-26e14163108f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-05-22 Thread Matt Sicker
Oh sorry, I missed one important use case for Q2. You would make both
constructors available as protected in your own abstract Descriptor
classes. See for example JobPropertyDescriptor or
ViewPropertyDescriptor.

On Wed, May 22, 2019 at 9:41 AM Matt Sicker  wrote:
>
> For Q1, I'm not sure how data bound constructor works with inherited
> classes. I think you would need to avoid annotating the base class's
> constructor and instead annotate the derived class's constructor.
> Alternatively, if everything is using data bound setters, that would
> likely work as is. I'm not sure what happens if a parent class and a
> child class both have data bound constructors (probably a runtime
> exception of some sort).
>
> For Q2, this has something to do with the Jenkins API for
> Descriptor/Describable. Typically, you can use a no-arg constructor in
> your Descriptor class to call Descriptor's default constructor which
> uses reflection to determine the proper class argument. For more
> advanced scenarios, you may need to pass an explicit class reference
> to the constructor, but my guess is that more so affects users
> changing APIs while remaining backward compatible with particular
> types.
>
> On Wed, May 22, 2019 at 9:26 AM Yufei Zhang  wrote:
> >
> > Hi developers, GSoC mentors and students like me,
> >
> > I met some questions reading the codebase of 
> > external-workspace-manager-plugin, and they should appear in other jenkins 
> > plugins as well. So these are quite general and I wonder they might help 
> > students like me understand  jenkins better. Hope someone can answer them 
> > and welcome to post your questions under this. The source code is : 
> > https://github.com/jenkinsci/external-workspace-manager-plugin
> >
> > supposing we are under working directory : 
> > external-workspace-manager-plugin/src/main/java/org/jenkinsci/plugins/ewm
> >
> >
> > QUESTION 1 : in file ~/definitions/Disk.java
> >
> > The Disk class is a concrete class, but now I want to change it to a base 
> > class so I there can be more disk types with specific targets. What should 
> > I do to turn it into a base class properly ? for example : should I keep 
> > the @DataBoundConstructor  annotations on the constructor ? Should I move 
> > the nested static descriptor class outside the origin class(since we 
> > declared a final attribute, which make it non-abstract) ?
> >
> >
> > QUESTION 2 : in file ~/DiskInfoProviderDescriptor.java line 23
> >
> > How to analyze this line : public DiskInfoProviderDescriptor(Class > extends DiskInfoProvider> clazz) {super(clazz);}
> > This is a more Java language problem. Why would we need derived class' 
> > metadata passed to the Descriptor (or when is this 
> > constructor called) ?
> >
> > Thanks !
> > Yufei Zhang
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Jenkins Developers" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to jenkinsci-dev+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/jenkinsci-dev/8c78d8ff-7bbb-4e39-be8f-98b632fdbd4b%40googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> Matt Sicker
> Senior Software Engineer, CloudBees



-- 
Matt Sicker
Senior Software Engineer, CloudBees

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAEot4oyCZ75rYQkTn77SPq8h7LeKcHMDVu3jq9pJ96pF35R5oQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Common Coding Questions in GSoC 2019

2019-05-22 Thread Matt Sicker
For Q1, I'm not sure how data bound constructor works with inherited
classes. I think you would need to avoid annotating the base class's
constructor and instead annotate the derived class's constructor.
Alternatively, if everything is using data bound setters, that would
likely work as is. I'm not sure what happens if a parent class and a
child class both have data bound constructors (probably a runtime
exception of some sort).

For Q2, this has something to do with the Jenkins API for
Descriptor/Describable. Typically, you can use a no-arg constructor in
your Descriptor class to call Descriptor's default constructor which
uses reflection to determine the proper class argument. For more
advanced scenarios, you may need to pass an explicit class reference
to the constructor, but my guess is that more so affects users
changing APIs while remaining backward compatible with particular
types.

On Wed, May 22, 2019 at 9:26 AM Yufei Zhang  wrote:
>
> Hi developers, GSoC mentors and students like me,
>
> I met some questions reading the codebase of 
> external-workspace-manager-plugin, and they should appear in other jenkins 
> plugins as well. So these are quite general and I wonder they might help 
> students like me understand  jenkins better. Hope someone can answer them and 
> welcome to post your questions under this. The source code is : 
> https://github.com/jenkinsci/external-workspace-manager-plugin
>
> supposing we are under working directory : 
> external-workspace-manager-plugin/src/main/java/org/jenkinsci/plugins/ewm
>
>
> QUESTION 1 : in file ~/definitions/Disk.java
>
> The Disk class is a concrete class, but now I want to change it to a base 
> class so I there can be more disk types with specific targets. What should I 
> do to turn it into a base class properly ? for example : should I keep the 
> @DataBoundConstructor  annotations on the constructor ? Should I move the 
> nested static descriptor class outside the origin class(since we declared a 
> final attribute, which make it non-abstract) ?
>
>
> QUESTION 2 : in file ~/DiskInfoProviderDescriptor.java line 23
>
> How to analyze this line : public DiskInfoProviderDescriptor(Class DiskInfoProvider> clazz) {super(clazz);}
> This is a more Java language problem. Why would we need derived class' 
> metadata passed to the Descriptor (or when is this 
> constructor called) ?
>
> Thanks !
> Yufei Zhang
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-dev/8c78d8ff-7bbb-4e39-be8f-98b632fdbd4b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Matt Sicker
Senior Software Engineer, CloudBees

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAEot4oy%2BAtT%3DitnGvOtBQpuBDNBysC%3D5bKhegq7JV6t%3DBa_nPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Jenkins Common Coding Questions in GSoC 2019

2019-05-22 Thread Yufei Zhang
Hi developers, GSoC mentors and students like me,

I met some questions reading the codebase of 
external-workspace-manager-plugin, and they should appear in other jenkins 
plugins as well. So these are quite general and I wonder they might help 
students like me understand  jenkins better. Hope someone can answer them 
and welcome to post your questions under this. The source code is : 
https://github.com/jenkinsci/external-workspace-manager-plugin

supposing we are under working directory : 
external-workspace-manager-plugin/src/main/java/org/jenkinsci/plugins/ewm


QUESTION 1 : in file ~/definitions/Disk.java

The Disk class is a concrete class, but now I want to change it to a base 
class so I there can be more disk types with specific targets. What should 
I do to turn it into a base class properly ? for example : should I keep 
the @DataBoundConstructor  annotations on the constructor ? Should I move 
the nested static descriptor class outside the origin class(since we 
declared a final attribute, which make it non-abstract) ?


QUESTION 2 : in file ~/DiskInfoProviderDescriptor.java line 23

How to analyze this line : public DiskInfoProviderDescriptor(Class clazz) {super(clazz);}
This is a more Java language problem. Why would we need derived class' 
metadata passed to the Descriptor (or when is this 
constructor called) ?

Thanks !
Yufei Zhang

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/8c78d8ff-7bbb-4e39-be8f-98b632fdbd4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.