hudson.model.listeners
Class ItemListener

java.lang.Object
  extended by hudson.model.listeners.ItemListener
All Implemented Interfaces:
ExtensionPoint
Direct Known Subclasses:
BuildTrigger.DescriptorImpl.ItemListenerImpl, DisplayNameListener, Fingerprint.ProjectRenameListener

public class ItemListener
extends Object
implements ExtensionPoint

Receives notifications about CRUD operations of Item.

Since:
1.74
Author:
Kohsuke Kawaguchi

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Constructor Summary
ItemListener()
           
 
Method Summary
static ExtensionList<ItemListener> all()
          All the registered ItemListeners.
static void fireOnCopied(Item src, Item result)
           
static void fireOnCreated(Item item)
           
static void fireOnUpdated(Item item)
           
 void onBeforeShutdown()
           
 void onCopied(Item src, Item item)
          Called after a new job is created by copying from an existing job.
 void onCreated(Item item)
          Called after a new job is created and added to Jenkins, before the initial configuration page is provided.
 void onDeleted(Item item)
          Called right before a job is going to be deleted.
 void onLoaded()
          Called after all the jobs are loaded from disk into Jenkins object.
 void onRenamed(Item item, String oldName, String newName)
          Called after a job is renamed.
 void onUpdated(Item item)
          Called after a job has its configuration updated.
 void register()
          Deprecated. as of 1.286 put Extension on your class to have it auto-registered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemListener

public ItemListener()
Method Detail

onCreated

public void onCreated(Item item)
Called after a new job is created and added to Jenkins, before the initial configuration page is provided.

This is useful for changing the default initial configuration of newly created jobs. For example, you can enable/add builders, etc.


onCopied

public void onCopied(Item src,
                     Item item)
Called after a new job is created by copying from an existing job. For backward compatibility, the default implementation of this method calls onCreated(Item). If you choose to handle this method, think about whether you want to call super.onCopied or not.

Parameters:
src - The source item that the new one was copied from. Never null.
item - The newly created item. Never null.
Since:
1.325 Before this version, a copy triggered onCreated(Item).

onLoaded

public void onLoaded()
Called after all the jobs are loaded from disk into Jenkins object.


onDeleted

public void onDeleted(Item item)
Called right before a job is going to be deleted. At this point the data files of the job is already gone.


onRenamed

public void onRenamed(Item item,
                      String oldName,
                      String newName)
Called after a job is renamed.

Parameters:
item - The job being renamed.
oldName - The old name of the job.
newName - The new name of the job. Same as Item.getName().
Since:
1.146

onUpdated

public void onUpdated(Item item)
Called after a job has its configuration updated.

Since:
1.460

onBeforeShutdown

public void onBeforeShutdown()
Since:
1.446 Called at the begenning of the orderly shutdown sequence to allow plugins to clean up stuff

register

public void register()
Deprecated. as of 1.286 put Extension on your class to have it auto-registered.

Registers this instance to Hudson and start getting notifications.


all

public static ExtensionList<ItemListener> all()
All the registered ItemListeners.


fireOnCopied

public static void fireOnCopied(Item src,
                                Item result)

fireOnCreated

public static void fireOnCreated(Item item)

fireOnUpdated

public static void fireOnUpdated(Item item)


Copyright © 2004-2013. All Rights Reserved.