mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-29 12:35:19 +00:00
Corrected backward incompatible signature changes in 70c1065814.
This commit is contained in:
1 parent
e669d8cc85
commit
5dddebcf94
12 files changed
+112
-51
No files matched your search
@@ -24,7 +24,7 @@
|
||||
package hudson;
|
||||
|
||||
import hudson.PluginWrapper.Dependency;
|
||||
import jenkins.model.Jenkins;
|
||||
import hudson.model.Hudson;
|
||||
import hudson.util.IOException2;
|
||||
import hudson.util.MaskingClassLoader;
|
||||
import hudson.util.VersionNumber;
|
||||
@@ -258,7 +258,7 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
public void initializeComponents(PluginWrapper plugin) {
|
||||
}
|
||||
|
||||
public <T> List<ExtensionComponent<T>> findComponents(Class<T> type, Jenkins hudson) {
|
||||
public <T> List<ExtensionComponent<T>> findComponents(Class<T> type, Hudson hudson) {
|
||||
|
||||
List<ExtensionFinder> finders;
|
||||
if (type==ExtensionFinder.class) {
|
||||
@@ -269,7 +269,7 @@ public class ClassicPluginStrategy implements PluginStrategy {
|
||||
}
|
||||
|
||||
/**
|
||||
* See {@link ExtensionFinder#scout(Class, jenkins.model.Jenkins)} for the dead lock issue and what this does.
|
||||
* See {@link ExtensionFinder#scout(Class, Hudson)} for the dead lock issue and what this does.
|
||||
*/
|
||||
if (LOGGER.isLoggable(Level.FINER))
|
||||
LOGGER.log(Level.FINER,"Scout-loading ExtensionList: "+type, new Throwable());
|
||||
|
||||
@@ -25,6 +25,7 @@ package hudson;
|
||||
|
||||
import hudson.model.Descriptor;
|
||||
import hudson.model.Describable;
|
||||
import hudson.model.Hudson;
|
||||
import jenkins.model.Jenkins;
|
||||
import hudson.model.ViewDescriptor;
|
||||
import hudson.model.Descriptor.FormException;
|
||||
@@ -67,11 +68,20 @@ public class DescriptorExtensionList<T extends Describable<T>, D extends Descrip
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static <T extends Describable<T>,D extends Descriptor<T>>
|
||||
DescriptorExtensionList<T,D> createDescriptorList(Jenkins hudson, Class<T> describableType) {
|
||||
DescriptorExtensionList<T,D> createDescriptorList(Jenkins jenkins, Class<T> describableType) {
|
||||
if (describableType == (Class) Publisher.class) {
|
||||
return (DescriptorExtensionList) new DescriptorExtensionListImpl(hudson);
|
||||
return (DescriptorExtensionList) new DescriptorExtensionListImpl(jenkins);
|
||||
}
|
||||
return new DescriptorExtensionList<T,D>(hudson,describableType);
|
||||
return new DescriptorExtensionList<T,D>(jenkins,describableType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated as of 1.416
|
||||
* Use {@link #create(Jenkins, Class)}
|
||||
*/
|
||||
public static <T extends Describable<T>,D extends Descriptor<T>>
|
||||
DescriptorExtensionList<T,D> createDescriptorList(Hudson hudson, Class<T> describableType) {
|
||||
return createDescriptorList((Jenkins)hudson,describableType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,8 +89,16 @@ public class DescriptorExtensionList<T extends Describable<T>, D extends Descrip
|
||||
*/
|
||||
private final Class<T> describableType;
|
||||
|
||||
protected DescriptorExtensionList(Jenkins hudson, Class<T> describableType) {
|
||||
super(hudson, (Class)Descriptor.class, (CopyOnWriteArrayList)getLegacyDescriptors(describableType));
|
||||
/**
|
||||
* @deprecated as of 1.416
|
||||
* Use {@link #DescriptorExtensionList(Jenkins, Class)}
|
||||
*/
|
||||
protected DescriptorExtensionList(Hudson hudson, Class<T> describableType) {
|
||||
this((Jenkins)hudson,describableType);
|
||||
}
|
||||
|
||||
protected DescriptorExtensionList(Jenkins jenkins, Class<T> describableType) {
|
||||
super(jenkins, (Class)Descriptor.class, (CopyOnWriteArrayList)getLegacyDescriptors(describableType));
|
||||
this.describableType = describableType;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ package hudson;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import hudson.init.InitMilestone;
|
||||
import hudson.model.Hudson;
|
||||
import jenkins.model.Jenkins;
|
||||
import net.java.sezpoz.Index;
|
||||
import net.java.sezpoz.IndexItem;
|
||||
import hudson.model.Descriptor;
|
||||
import org.kohsuke.accmod.Restricted;
|
||||
import org.kohsuke.accmod.restrictions.NoExternalUse;
|
||||
|
||||
@@ -59,10 +59,10 @@ import java.lang.reflect.Method;
|
||||
public abstract class ExtensionFinder implements ExtensionPoint {
|
||||
/**
|
||||
* @deprecated as of 1.356
|
||||
* Use and implement {@link #find(Class, jenkins.model.Jenkins)} that allows us to put some metadata.
|
||||
* Use and implement {@link #find(Class,Hudson)} that allows us to put some metadata.
|
||||
*/
|
||||
@Restricted(NoExternalUse.class)
|
||||
public <T> Collection<T> findExtensions(Class<T> type, Jenkins hudson) {
|
||||
public <T> Collection<T> findExtensions(Class<T> type, Hudson hudson) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -82,15 +82,15 @@ public abstract class ExtensionFinder implements ExtensionPoint {
|
||||
* @return
|
||||
* Can be empty but never null.
|
||||
* @since 1.356
|
||||
* Older implementations provide {@link #findExtensions(Class, jenkins.model.Jenkins)}
|
||||
* Older implementations provide {@link #findExtensions(Class,Hudson)}
|
||||
*/
|
||||
public abstract <T> Collection<ExtensionComponent<T>> find(Class<T> type, Jenkins hudson);
|
||||
public abstract <T> Collection<ExtensionComponent<T>> find(Class<T> type, Hudson hudson);
|
||||
|
||||
/**
|
||||
* A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
|
||||
* on BugParade for more details.
|
||||
*/
|
||||
public <T> Collection<ExtensionComponent<T>> _find(Class<T> type, Jenkins hudson) {
|
||||
public <T> Collection<ExtensionComponent<T>> _find(Class<T> type, Hudson hudson) {
|
||||
return find(type,hudson);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public abstract class ExtensionFinder implements ExtensionPoint {
|
||||
* This inconsistent locking order results in a dead lock, you see.
|
||||
*
|
||||
* <p>
|
||||
* So to reduce the likelihood, this method is called in prior to {@link #find(Class, jenkins.model.Jenkins)} invocation,
|
||||
* So to reduce the likelihood, this method is called in prior to {@link #find(Class,Hudson)} invocation,
|
||||
* but from outside the lock. The implementation is expected to perform all the class initialization activities
|
||||
* from here.
|
||||
*
|
||||
@@ -124,7 +124,7 @@ public abstract class ExtensionFinder implements ExtensionPoint {
|
||||
* Also see http://kohsuke.org/2010/09/01/deadlock-that-you-cant-avoid/ for how class initialization
|
||||
* can results in a dead lock.
|
||||
*/
|
||||
public void scout(Class extensionType, Jenkins hudson) {
|
||||
public void scout(Class extensionType, Hudson hudson) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,7 +158,7 @@ public abstract class ExtensionFinder implements ExtensionPoint {
|
||||
return indices;
|
||||
}
|
||||
|
||||
public <T> Collection<ExtensionComponent<T>> find(Class<T> type, Jenkins hudson) {
|
||||
public <T> Collection<ExtensionComponent<T>> find(Class<T> type, Hudson hudson) {
|
||||
List<ExtensionComponent<T>> result = new ArrayList<ExtensionComponent<T>>();
|
||||
|
||||
for (IndexItem<Extension,Object> item : getIndices()) {
|
||||
@@ -194,7 +194,7 @@ public abstract class ExtensionFinder implements ExtensionPoint {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scout(Class extensionType, Jenkins hudson) {
|
||||
public void scout(Class extensionType, Hudson hudson) {
|
||||
for (IndexItem<Extension,Object> item : getIndices()) {
|
||||
try {
|
||||
// we might end up having multiple threads concurrently calling into element(),
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
package hudson;
|
||||
|
||||
import hudson.init.InitMilestone;
|
||||
import hudson.model.Hudson;
|
||||
import jenkins.model.Jenkins;
|
||||
import hudson.util.AdaptedIterator;
|
||||
import hudson.util.DescriptorList;
|
||||
@@ -64,7 +65,12 @@ import java.util.logging.Logger;
|
||||
* @see jenkins.model.Jenkins#getDescriptorList(Class)
|
||||
*/
|
||||
public class ExtensionList<T> extends AbstractList<T> {
|
||||
public final Jenkins hudson;
|
||||
/**
|
||||
* @deprecated as of 1.417
|
||||
* Use {@link #jenkins}
|
||||
*/
|
||||
public final Hudson hudson;
|
||||
public final Jenkins jenkins;
|
||||
public final Class<T> extensionType;
|
||||
|
||||
/**
|
||||
@@ -79,8 +85,24 @@ public class ExtensionList<T> extends AbstractList<T> {
|
||||
*/
|
||||
private final CopyOnWriteArrayList<ExtensionComponent<T>> legacyInstances;
|
||||
|
||||
protected ExtensionList(Jenkins hudson, Class<T> extensionType) {
|
||||
this(hudson,extensionType,new CopyOnWriteArrayList<ExtensionComponent<T>>());
|
||||
/**
|
||||
* @deprecated as of 1.416
|
||||
* Use {@link #ExtensionList(Jenkins, Class)}
|
||||
*/
|
||||
protected ExtensionList(Hudson hudson, Class<T> extensionType) {
|
||||
this((Jenkins)hudson,extensionType);
|
||||
}
|
||||
|
||||
protected ExtensionList(Jenkins jenkins, Class<T> extensionType) {
|
||||
this(jenkins,extensionType,new CopyOnWriteArrayList<ExtensionComponent<T>>());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated as of 1.416
|
||||
* Use {@link #ExtensionList(Jenkins, Class, CopyOnWriteArrayList)}
|
||||
*/
|
||||
protected ExtensionList(Hudson hudson, Class<T> extensionType, CopyOnWriteArrayList<ExtensionComponent<T>> legacyStore) {
|
||||
this((Jenkins)hudson,extensionType,legacyStore);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,8 +112,9 @@ public class ExtensionList<T> extends AbstractList<T> {
|
||||
* omits this uses a new {@link Vector}, making the storage lifespan tied to the life of {@link ExtensionList}.
|
||||
* If the manually registered instances are scoped to VM level, the caller should pass in a static list.
|
||||
*/
|
||||
protected ExtensionList(Jenkins hudson, Class<T> extensionType, CopyOnWriteArrayList<ExtensionComponent<T>> legacyStore) {
|
||||
this.hudson = hudson;
|
||||
protected ExtensionList(Jenkins jenkins, Class<T> extensionType, CopyOnWriteArrayList<ExtensionComponent<T>> legacyStore) {
|
||||
this.hudson = (Hudson)jenkins;
|
||||
this.jenkins = jenkins;
|
||||
this.extensionType = extensionType;
|
||||
this.legacyInstances = legacyStore;
|
||||
}
|
||||
@@ -215,7 +238,7 @@ public class ExtensionList<T> extends AbstractList<T> {
|
||||
* Chooses the object that locks the loading of the extension instances.
|
||||
*/
|
||||
protected Object getLoadLock() {
|
||||
return hudson.lookup.setIfNull(Lock.class,new Lock());
|
||||
return jenkins.lookup.setIfNull(Lock.class,new Lock());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,7 +255,7 @@ public class ExtensionList<T> extends AbstractList<T> {
|
||||
if (LOGGER.isLoggable(Level.FINE))
|
||||
LOGGER.log(Level.FINE,"Loading ExtensionList: "+extensionType, new Throwable());
|
||||
|
||||
return hudson.getPluginManager().getPluginStrategy().findComponents(extensionType, hudson);
|
||||
return jenkins.getPluginManager().getPluginStrategy().findComponents(extensionType, hudson);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -248,11 +271,19 @@ public class ExtensionList<T> extends AbstractList<T> {
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> ExtensionList<T> create(Jenkins hudson, Class<T> type) {
|
||||
/**
|
||||
* @deprecated as of 1.416
|
||||
* Use {@link #create(Jenkins, Class)}
|
||||
*/
|
||||
public static <T> ExtensionList<T> create(Hudson hudson, Class<T> type) {
|
||||
return create((Jenkins)hudson,type);
|
||||
}
|
||||
|
||||
public static <T> ExtensionList<T> create(Jenkins jenkins, Class<T> type) {
|
||||
if(type.getAnnotation(LegacyInstancesAreScopedToHudson.class)!=null)
|
||||
return new ExtensionList<T>(hudson,type);
|
||||
return new ExtensionList<T>(jenkins,type);
|
||||
else {
|
||||
return new ExtensionList<T>(hudson,type,staticLegacyInstances.get(type));
|
||||
return new ExtensionList<T>(jenkins,type,staticLegacyInstances.get(type));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,10 +42,10 @@ import java.util.logging.Logger;
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class LocalPluginManager extends PluginManager {
|
||||
private final Jenkins hudson;
|
||||
public LocalPluginManager(Jenkins hudson) {
|
||||
super(hudson.servletContext, new File(hudson.getRootDir(),"plugins"));
|
||||
this.hudson = hudson;
|
||||
private final Jenkins jenkins;
|
||||
public LocalPluginManager(Jenkins jenkins) {
|
||||
super(jenkins.servletContext, new File(jenkins.getRootDir(),"plugins"));
|
||||
this.jenkins = jenkins;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ public class LocalPluginManager extends PluginManager {
|
||||
|
||||
Set<String> names = new HashSet<String>();
|
||||
|
||||
for( String path : Util.fixNull((Set<String>)hudson.servletContext.getResourcePaths("/WEB-INF/plugins"))) {
|
||||
for( String path : Util.fixNull((Set<String>) jenkins.servletContext.getResourcePaths("/WEB-INF/plugins"))) {
|
||||
String fileName = path.substring(path.lastIndexOf('/')+1);
|
||||
if(fileName.length()==0) {
|
||||
// see http://www.nabble.com/404-Not-Found-error-when-clicking-on-help-td24508544.html
|
||||
@@ -73,7 +73,7 @@ public class LocalPluginManager extends PluginManager {
|
||||
try {
|
||||
names.add(fileName);
|
||||
|
||||
URL url = hudson.servletContext.getResource(path);
|
||||
URL url = jenkins.servletContext.getResource(path);
|
||||
copyBundledPlugin(url, fileName);
|
||||
} catch (IOException e) {
|
||||
LOGGER.log(Level.SEVERE, "Failed to extract the bundled plugin "+fileName,e);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
package hudson;
|
||||
|
||||
import hudson.model.Hudson;
|
||||
import jenkins.model.Jenkins;
|
||||
|
||||
import java.io.File;
|
||||
@@ -69,10 +70,11 @@ public interface PluginStrategy extends ExtensionPoint {
|
||||
/**
|
||||
* Find components of the given type using the assigned strategy.
|
||||
*
|
||||
* @param type The component type
|
||||
* @param hudson The Hudson scope
|
||||
* @return Sequence of components
|
||||
*
|
||||
* @param type The component type
|
||||
* @param hudson The Hudson scope
|
||||
* @return Sequence of components
|
||||
* @since 1.400
|
||||
*/
|
||||
public abstract <T> List<ExtensionComponent<T>> findComponents(Class<T> type, Jenkins hudson);
|
||||
public abstract <T> List<ExtensionComponent<T>> findComponents(Class<T> type, Hudson hudson);
|
||||
}
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
package hudson;
|
||||
|
||||
import hudson.model.Hudson;
|
||||
import jenkins.model.Jenkins;
|
||||
import hudson.util.OneShotEvent;
|
||||
|
||||
@@ -46,15 +47,23 @@ import java.util.logging.Logger;
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class UDPBroadcastThread extends Thread {
|
||||
private final Jenkins hudson;
|
||||
private final Jenkins jenkins;
|
||||
|
||||
public final OneShotEvent ready = new OneShotEvent();
|
||||
private MulticastSocket mcs;
|
||||
private boolean shutdown;
|
||||
|
||||
public UDPBroadcastThread(Jenkins hudson) throws IOException {
|
||||
super("Hudson UDP "+PORT+" monitoring thread");
|
||||
this.hudson = hudson;
|
||||
/**
|
||||
* @deprecated as of 1.416
|
||||
* Use {@link #UDPBroadcastThread(Jenkins)}
|
||||
*/
|
||||
public UDPBroadcastThread(Hudson jenkins) throws IOException {
|
||||
this((Jenkins)jenkins);
|
||||
}
|
||||
|
||||
public UDPBroadcastThread(Jenkins jenkins) throws IOException {
|
||||
super("Jenkins UDP "+PORT+" monitoring thread");
|
||||
this.jenkins = jenkins;
|
||||
mcs = new MulticastSocket(PORT);
|
||||
}
|
||||
|
||||
@@ -72,12 +81,12 @@ public class UDPBroadcastThread extends Thread {
|
||||
SocketAddress sender = p.getSocketAddress();
|
||||
|
||||
// prepare a response
|
||||
TcpSlaveAgentListener tal = hudson.getTcpSlaveAgentListener();
|
||||
TcpSlaveAgentListener tal = jenkins.getTcpSlaveAgentListener();
|
||||
|
||||
StringBuilder rsp = new StringBuilder("<hudson>");
|
||||
tag(rsp,"version", Jenkins.VERSION);
|
||||
tag(rsp,"url",hudson.getRootUrl());
|
||||
tag(rsp,"server-id", Util.getDigestOf(hudson.getSecretKey()));
|
||||
tag(rsp,"url", jenkins.getRootUrl());
|
||||
tag(rsp,"server-id", Util.getDigestOf(jenkins.getSecretKey()));
|
||||
tag(rsp,"slave-port",tal==null?null:tal.getPort());
|
||||
|
||||
for (UDPBroadcastFragment f : UDPBroadcastFragment.all())
|
||||
|
||||
@@ -29,6 +29,7 @@ import hudson.ExtensionFinder;
|
||||
import hudson.Util;
|
||||
import hudson.cli.CLICommand;
|
||||
import hudson.cli.CloneableCLICommand;
|
||||
import hudson.model.Hudson;
|
||||
import jenkins.model.Jenkins;
|
||||
import hudson.remoting.Channel;
|
||||
import hudson.security.CliAuthenticator;
|
||||
@@ -63,7 +64,7 @@ import java.util.logging.Logger;
|
||||
*/
|
||||
@Extension
|
||||
public class CLIRegisterer extends ExtensionFinder {
|
||||
public <T> Collection<ExtensionComponent<T>> find(Class<T> type, Jenkins hudson) {
|
||||
public <T> Collection<ExtensionComponent<T>> find(Class<T> type, Hudson hudson) {
|
||||
if (type==CLICommand.class)
|
||||
return (List)discover(hudson);
|
||||
else
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
*/
|
||||
package hudson.init;
|
||||
|
||||
import hudson.model.Hudson;
|
||||
import jenkins.model.Jenkins;
|
||||
import org.jvnet.hudson.annotation_indexer.Index;
|
||||
import org.jvnet.hudson.reactor.Milestone;
|
||||
@@ -118,7 +119,7 @@ public class InitializerFinder extends TaskBuilder {
|
||||
* Determines the parameter injection of the initialization method.
|
||||
*/
|
||||
private Object lookUp(Class<?> type) {
|
||||
if (type== Jenkins.class)
|
||||
if (type==Jenkins.class || type==Hudson.class)
|
||||
return Jenkins.getInstance();
|
||||
throw new IllegalArgumentException("Unable to inject "+type);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ public abstract class Publisher extends BuildStepCompatibilityLayer implements B
|
||||
/**
|
||||
* {@link Publisher} has a special sort semantics that requires a subtype.
|
||||
*
|
||||
* @see DescriptorExtensionList#createDescriptorList(jenkins.model.Jenkins, Class)
|
||||
* @see DescriptorExtensionList#createDescriptorList(hudson.model.Hudson, Class
|
||||
*/
|
||||
public static final class DescriptorExtensionListImpl extends DescriptorExtensionList<Publisher,Descriptor<Publisher>>
|
||||
implements Comparator<ExtensionComponent<Descriptor<Publisher>>> {
|
||||
|
||||
@@ -216,7 +216,6 @@ import java.util.TreeSet;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@@ -26,7 +26,7 @@ package org.jvnet.hudson.test;
|
||||
import hudson.Extension;
|
||||
import hudson.ExtensionComponent;
|
||||
import hudson.ExtensionFinder;
|
||||
import jenkins.model.Jenkins;
|
||||
import hudson.model.Hudson;
|
||||
import net.java.sezpoz.Index;
|
||||
import net.java.sezpoz.IndexItem;
|
||||
|
||||
@@ -47,7 +47,7 @@ import java.util.logging.Logger;
|
||||
@Extension
|
||||
public class TestExtensionLoader extends ExtensionFinder {
|
||||
@Override
|
||||
public <T> Collection<ExtensionComponent<T>> find(Class<T> type, Jenkins hudson) {
|
||||
public <T> Collection<ExtensionComponent<T>> find(Class<T> type, Hudson hudson) {
|
||||
TestEnvironment env = TestEnvironment.get();
|
||||
|
||||
List<ExtensionComponent<T>> result = new ArrayList<ExtensionComponent<T>>();
|
||||
|
||||
Reference in new issue
Block a user