|
Re: Exemplar configuration thoughts: msg#00137java.hudson.user
On 1/29/07, Kohsuke Kawaguchi <Kohsuke.Kawaguchi@xxxxxxx> wrote:
I'm really not that solid on my jelly skills yet, so some of what happens between the XML and the Java is a bit of a mystery but I'll try and show you what I was thinking of.
h.addJobDescriptor( new ExternalJobDescriptor() );To list up the various kinds of Jobs, // Not-the-current-APIs, just making what I'm doing clear // Create a Hudson instance Hudson h = new Hudson(); // Give it the JobDescriptors h.addJobDescriptor ( new JPRTJobDescriptor() ); h.addJobDescriptor( new HudsonJobDescriptor() ); // When the jelly page that needs the job specific descriptors is created, // whatever it is that gets things into jelly could hand it this, Descriptor[] jobDescriptors = h.getJobDescriptors(); I don't need to have an existing Job to get a list of all the Descriptors that I know about. If I remove getDescriptor(), how do I do that? and how do I The descriptors could still be used to instantiate the new Job instance. I don't need to have an existing Job to make a brand new one. // I'm not sure how I get the StaplerRequest in exact detail, but someone // clicks the New Job, and the selected descriptor from the list that we // gave the jelly page earlier is used StaplerRequest req = ...; Descriptor jobDescriptor = ...; jobDescriptor.newInstance(req); The Job instances themselves could be used to copy an existing Job using clone(). I do need a Job to create a copy but I don't need the Descriptor. Or once loaded, the global configuration (like where Ant is installed) I can still share a state between these objects without a getDescriptor() // Put the AntBuilder into Hudsone h.addBuilderDescriptor( new HudsonAntDescriptor() ); class Ant extends ... { private final AntInstallation[] installations; Ant(AntInstallation[] installations) { this.installations = installations; } // ... } class AntDescriptor extends ... { private AntInstallation[] installations = ...; // ... public Builder newInstance(StaplerRequest req) { return new Ant(installations); } // ... } I'm not totally familar with XStream, so I'm not sure if this would store a duplicate - so maybe one of these fields needs to be marked transient. This is more of an XStream detail though and less what I'm trying to illustrate. If I need the semantics to be that the list of AntInstallations is shared and not copied, then I can share a j.u.l.c.CopyOnWriteArrayList. When the global config page is displayed, we'd collect from the Hudson instance the arrays of the various Descriptor types and stick them into the jelly page. The addExtensionPoint methods I was using on the Hudson instance to register the Descriptors actually might add to a HashSet for each type of Descriptor, eliminating duplicate Descriptors. > This was something I was starting to think about and I think I would be -- - Eric
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Exemplar configuration thoughts, Kohsuke Kawaguchi |
|---|---|
| Next by Date: | Subversion polling in .76, Martin Ankerl |
| Previous by Thread: | Re: Exemplar configuration thoughts, Kohsuke Kawaguchi |
| Next by Thread: | Subversion polling in .76, Martin Ankerl |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |