Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.greenstone.gatherer.msm
Class MSMProfiler  view MSMProfiler download MSMProfiler.java

java.lang.Object
  extended byorg.greenstone.gatherer.msm.MSMAdapter
      extended byorg.greenstone.gatherer.msm.MSMProfiler
All Implemented Interfaces:
MSMListener

public class MSMProfiler
extends MSMAdapter

This class is essentially records what actions a user took when merging two metadata sets, so we can avoid having to get the user to repeat the proceedure.

Version:
2.2

Field Summary
private static java.lang.String IGNORE
           
private  java.io.File profile_file
          The file the profile should be loaded from and saved to.
private  org.greenstone.gatherer.util.HashMap3D profiles
          A mapping of known profile actions.
 
Constructor Summary
MSMProfiler()
          The constructor loads the previous profile for this collection if there is one.
 
Method Summary
 void addAction(java.lang.String collection_file, java.lang.String source, java.lang.String target)
          Adds a new action mapping to the profile.
 void addSource(java.lang.String collection_file)
           
 boolean containsAction(java.lang.String collection_file, java.lang.String source)
          Determine if an action exists for the given collection and source.
 boolean containsSource(java.lang.String collection_file)
           
 void destroy()
          Destructor to ensure that no memory leaks.
 void elementChanged(MSMEvent event)
          Method that is called whenever an element within a set is changed or modified, in which case we must modify the action profiles to suit.
 java.lang.String getAction(java.lang.String collection_file, java.lang.String source)
          Search the profilerer for any previous actions regarding the indicated collection and metadata element.
 java.util.HashMap getActions(java.lang.String collection_file)
           
 java.util.ArrayList getCollections()
           
 java.util.ArrayList getSources(java.lang.String collection_file)
           
private  void load(org.w3c.dom.Document document)
          Reload the mapping information stored in this document.
 void removeAction(java.lang.String collection_file, java.lang.String source)
           
 void removeProfile(java.lang.String collection_file)
           
 void save()
          Save the profile document.
 
Methods inherited from class org.greenstone.gatherer.msm.MSMAdapter
metadataChanged, setChanged, valueChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

profile_file

private java.io.File profile_file
The file the profile should be loaded from and saved to.


profiles

private org.greenstone.gatherer.util.HashMap3D profiles
A mapping of known profile actions.


IGNORE

private static final java.lang.String IGNORE
See Also:
Constant Field Values
Constructor Detail

MSMProfiler

public MSMProfiler()
The constructor loads the previous profile for this collection if there is one.

Method Detail

addAction

public void addAction(java.lang.String collection_file,
                      java.lang.String source,
                      java.lang.String target)
Adds a new action mapping to the profile. Such a mapping records that for a certain collection (file) and metadata element a specific action must occur. The action is either a renaming to a new metadata element name, also provided, or an instruction to ignore this particular metadata element, is the target is null.


addSource

public void addSource(java.lang.String collection_file)

containsAction

public boolean containsAction(java.lang.String collection_file,
                              java.lang.String source)
Determine if an action exists for the given collection and source.


containsSource

public boolean containsSource(java.lang.String collection_file)

destroy

public void destroy()
Destructor to ensure that no memory leaks.


elementChanged

public void elementChanged(MSMEvent event)
Method that is called whenever an element within a set is changed or modified, in which case we must modify the action profiles to suit. If an element was removed, remove all action profiles with this element as the target. If an elements name changes, update all matching targets to reflect new name.

Specified by:
elementChanged in interface MSMListener
Overrides:
elementChanged in class MSMAdapter

getAction

public java.lang.String getAction(java.lang.String collection_file,
                                  java.lang.String source)
Search the profilerer for any previous actions regarding the indicated collection and metadata element.


getActions

public java.util.HashMap getActions(java.lang.String collection_file)

getCollections

public java.util.ArrayList getCollections()

getSources

public java.util.ArrayList getSources(java.lang.String collection_file)

removeProfile

public void removeProfile(java.lang.String collection_file)

removeAction

public void removeAction(java.lang.String collection_file,
                         java.lang.String source)

save

public void save()
Save the profile document.


load

private void load(org.w3c.dom.Document document)
Reload the mapping information stored in this document.