hudson.diagnosis
Class OldDataMonitor

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.AdministrativeMonitor
          extended by hudson.diagnosis.OldDataMonitor
All Implemented Interfaces:
ExtensionPoint, ModelObject, SearchableModelObject, SearchItem

@Extension
public class OldDataMonitor
extends AdministrativeMonitor

Tracks whether any data structure changes were corrected when loading XML, that could be resaved to migrate that data to the new format.

Author:
[email protected]

Nested Class Summary
static class OldDataMonitor.ManagementLinkImpl
           
static class OldDataMonitor.VersionRange
           
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
static SaveableListener changeListener
           
static ItemListener itemDeleteListener
           
static RunListener<Run> runDeleteListener
           
 
Fields inherited from class hudson.model.AdministrativeMonitor
id
 
Constructor Summary
OldDataMonitor()
           
 
Method Summary
 org.kohsuke.stapler.HttpResponse doAct(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Depending on whether the user said "yes" or "no", send him to the right place.
 org.kohsuke.stapler.HttpResponse doDiscard(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Save all files containing only unreadable data (no data upgrades), which discards this data.
 org.kohsuke.stapler.HttpResponse doIndex(org.kohsuke.stapler.StaplerResponse rsp)
           
 org.kohsuke.stapler.HttpResponse doUpgrade(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Save all or some of the files to persist data in the new forms.
 Map<Saveable,OldDataMonitor.VersionRange> getData()
           
 String getDisplayName()
           
 Iterator<hudson.util.VersionNumber> getVersionList()
          Sorted list of unique max-versions in the data set.
 boolean isActivated()
          Returns true if this monitor is activated and wants to produce a warning message.
static void report(Saveable obj, Collection<Throwable> errors)
          Inform monitor that some unreadable data was found while loading.
static void report(Saveable obj, String version)
          Inform monitor that some data in a deprecated format has been loaded, and converted in-memory to a new structure.
static void report(com.thoughtworks.xstream.converters.UnmarshallingContext context, String version)
          Inform monitor that some data in a deprecated format has been loaded, during XStream unmarshalling when the Saveable containing this object is not available.
 
Methods inherited from class hudson.model.AdministrativeMonitor
all, disable, doDisable, getSearchUrl, getUrl, isEnabled
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

changeListener

@Extension
public static final SaveableListener changeListener

itemDeleteListener

@Extension
public static final ItemListener itemDeleteListener

runDeleteListener

@Extension
public static final RunListener<Run> runDeleteListener
Constructor Detail

OldDataMonitor

public OldDataMonitor()
Method Detail

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in interface ModelObject
Overrides:
getDisplayName in class AdministrativeMonitor

isActivated

public boolean isActivated()
Description copied from class: AdministrativeMonitor
Returns true if this monitor is activated and wants to produce a warning message.

This method is called from the HTML rendering thread, so it should run efficiently.

Specified by:
isActivated in class AdministrativeMonitor

getData

public Map<Saveable,OldDataMonitor.VersionRange> getData()

report

public static void report(Saveable obj,
                          String version)
Inform monitor that some data in a deprecated format has been loaded, and converted in-memory to a new structure.

Parameters:
obj - Saveable object; calling save() on this object will persist the data in its new format to disk.
version - Hudson release when the data structure changed.

report

public static void report(com.thoughtworks.xstream.converters.UnmarshallingContext context,
                          String version)
Inform monitor that some data in a deprecated format has been loaded, during XStream unmarshalling when the Saveable containing this object is not available.

Parameters:
context - XStream unmarshalling context
version - Hudson release when the data structure changed.

report

public static void report(Saveable obj,
                          Collection<Throwable> errors)
Inform monitor that some unreadable data was found while loading.

Parameters:
obj - Saveable object; calling save() on this object will discard the unreadable data.
errors - Exception(s) thrown while loading, regarding the unreadable classes/fields.

getVersionList

public Iterator<hudson.util.VersionNumber> getVersionList()
Sorted list of unique max-versions in the data set. For select list in jelly.


doAct

public org.kohsuke.stapler.HttpResponse doAct(org.kohsuke.stapler.StaplerRequest req,
                                              org.kohsuke.stapler.StaplerResponse rsp)
                                       throws IOException
Depending on whether the user said "yes" or "no", send him to the right place.

Throws:
IOException

doUpgrade

public org.kohsuke.stapler.HttpResponse doUpgrade(org.kohsuke.stapler.StaplerRequest req,
                                                  org.kohsuke.stapler.StaplerResponse rsp)
                                           throws IOException
Save all or some of the files to persist data in the new forms. Remove those items from the data map.

Throws:
IOException

doDiscard

public org.kohsuke.stapler.HttpResponse doDiscard(org.kohsuke.stapler.StaplerRequest req,
                                                  org.kohsuke.stapler.StaplerResponse rsp)
                                           throws IOException
Save all files containing only unreadable data (no data upgrades), which discards this data. Remove those items from the data map.

Throws:
IOException

doIndex

public org.kohsuke.stapler.HttpResponse doIndex(org.kohsuke.stapler.StaplerResponse rsp)
                                         throws IOException
Throws:
IOException


Copyright © 2004-2013. All Rights Reserved.