public class SyncWindowModel
extends java.lang.Object
implements com.lf.commons.model.ConfigurableUnit
GenerateOptionsWindow
.
Here, the templates are managed and can be accessed without creating the GUI components
(e.g for CLI).
Modifier and Type | Field and Description |
---|---|
protected com.lf.commons.lang.OrderedHashtable<java.lang.String,com.lf.commons.config.Configuration> |
cacheTemplates
Remembers the template configurations by their unique IDs.
|
protected java.lang.String |
currentTemplate
Remembers the active template.
|
protected com.lf.commons.config.Configuration |
templateDefault
The default template settings.
|
Constructor and Description |
---|
SyncWindowModel()
Constructor for the component.
|
Modifier and Type | Method and Description |
---|---|
void |
configureUnit(java.lang.String id,
com.lf.commons.config.Configuration config)
Restores values from persistent data stores.
|
static java.lang.String |
debugEntryMapping(com.lf.commons.lang.OrderedHashtable<java.lang.Object,java.lang.Object[]> entries,
java.lang.String[] targetsets)
Prints some debugging infos about the given entry mapping.
|
protected void |
debugTemplates()
Prints the currently managed templates.
|
protected void |
finalize()
Clean-up method to help the gc.
|
com.lf.commons.config.Configuration |
getDefaultTemplate()
Provides the default template settings.
|
com.lf.commons.lang.OrderedHashtable<java.lang.Object,java.lang.Object[]> |
getEntryMapping(java.lang.String mapping)
Prepares the current entries for the synchronization.
|
static com.lf.commons.lang.OrderedHashtable<java.lang.Object,java.lang.Object[]> |
getFlippedEntryMapping(com.lf.commons.lang.OrderedHashtable<java.lang.Object,java.lang.Object[]> entries,
java.lang.String fliptargetset,
java.lang.String[] targetsets)
Implements flipping sources with targets.
|
boolean |
getFlipSourceTarget(java.lang.String mapping)
Extracts, if the sources should be flipped with the active target set.
|
java.lang.String |
getFlipTarget(java.lang.String mapping)
Extracts the name if the target set to be flipped with the active target set.
|
java.lang.Object[] |
getSourceEntries(java.lang.String mapping)
Provides the source entries defined by the given mapping/template.
|
static java.lang.String |
getSourceGenerateTemplate(com.lf.commons.config.Configuration config)
Extracts the template to execute for the source set.
|
java.lang.String |
getSourceGenerateTemplate(java.lang.String mapping)
Extracts the template to execute for the source set.
|
static boolean |
getSourceGenerateTemplateRefresh(com.lf.commons.config.Configuration config)
Extracts the refresh flag for the template to execute for the source set.
|
boolean |
getSourceGenerateTemplateRefresh(java.lang.String mapping)
Extracts the refresh flag for the template to execute for the source set.
|
static java.util.Hashtable<java.lang.String,java.lang.String> |
getTargetGenerateTemplates(com.lf.commons.config.Configuration config)
Extracts the template(s) to execute for the target set(s).
|
java.util.Hashtable<java.lang.String,java.lang.String> |
getTargetGenerateTemplates(java.lang.String mapping)
Extracts the template(s) to execute for the target set(s).
|
static java.util.Hashtable<java.lang.String,java.lang.Boolean> |
getTargetGenerateTemplatesRefresh(com.lf.commons.config.Configuration config)
Extracts the refresh flag for the template to execute for the source set.
|
java.util.Hashtable<java.lang.String,java.lang.Boolean> |
getTargetGenerateTemplatesRefresh(java.lang.String mapping)
Extracts the refresh flag for the template to execute for the source set.
|
java.util.Vector<java.lang.Object[]> |
getTargets(java.lang.String mapping)
Provides the target set entries defined by the given mapping/template.
|
java.util.Vector<java.lang.String> |
getTargetSetNames(java.lang.String mapping)
Provides the names of the target sets defined by the given mapping/template.
|
com.lf.commons.config.Configuration |
getTemplate(java.lang.String id)
Provides the desired template, original container is copied (you may alter values).
|
java.util.Hashtable<java.lang.String,com.lf.commons.config.Configuration> |
getTemplates()
Provides the template configurations (copies, feel free to alter :-).
|
protected com.lf.commons.config.Configuration |
mapToSyncOptions(com.lf.commons.config.Configuration genconfig,
java.lang.String gentemplate,
boolean refresh,
java.lang.Object[] sources,
java.lang.Object[] targets,
java.lang.String targetname)
Derives appropriate sync options from the given generate options.
|
void |
storeUnit(java.lang.String id,
com.lf.commons.config.Configuration config)
Stores the current configuration values persistently.
|
void |
unitRegistered(com.lf.commons.model.ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was registered with a model.
|
void |
unitUnregistered(com.lf.commons.model.ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was unregistered with a model.
|
protected com.lf.commons.lang.OrderedHashtable<java.lang.String,com.lf.commons.config.Configuration> cacheTemplates
protected com.lf.commons.config.Configuration templateDefault
protected java.lang.String currentTemplate
public SyncWindowModel()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public com.lf.commons.config.Configuration getDefaultTemplate()
getEntryMapping()
.
protected com.lf.commons.config.Configuration mapToSyncOptions(com.lf.commons.config.Configuration genconfig, java.lang.String gentemplate, boolean refresh, java.lang.Object[] sources, java.lang.Object[] targets, java.lang.String targetname)
genconfig
- The generate optionsgentemplate
- The generate template to userefresh
- Refresh mode?sources
- The array of FileObject
or File
targets
- The array of FileObject
or File
targetname
- The name of the only target set (no brackets/HTML!)public java.util.Vector<java.lang.String> getTargetSetNames(java.lang.String mapping)
mapping
- The identifiernull
if not availablepublic java.lang.Object[] getSourceEntries(java.lang.String mapping)
mapping
- The identifierFile
or FileObject
)public java.util.Vector<java.lang.Object[]> getTargets(java.lang.String mapping)
mapping
- The identifierFile
or FileObject
)public com.lf.commons.lang.OrderedHashtable<java.lang.Object,java.lang.Object[]> getEntryMapping(java.lang.String mapping)
null
is returned. All values in the container
have the same array length. The sources and targets are always returned in proper order,
never flipped (reverse mode).
mapping
- The identifiernull
if invalidpublic static com.lf.commons.lang.OrderedHashtable<java.lang.Object,java.lang.Object[]> getFlippedEntryMapping(com.lf.commons.lang.OrderedHashtable<java.lang.Object,java.lang.Object[]> entries, java.lang.String fliptargetset, java.lang.String[] targetsets)
entries
- The original entriesfliptargetset
- The target set which becomes the source settargetsets
- The target set namesnull
if invalidpublic void configureUnit(java.lang.String id, com.lf.commons.config.Configuration config)
configureUnit
in interface com.lf.commons.model.ConfigurableUnit
id
- The unique identifier for the instanceconfig
- The configurationpublic void storeUnit(java.lang.String id, com.lf.commons.config.Configuration config)
storeUnit
in interface com.lf.commons.model.ConfigurableUnit
id
- The unique identifier for the instanceconfig
- The configurationpublic void unitRegistered(com.lf.commons.model.ApplicationModel model, java.lang.String id)
unitRegistered
in interface com.lf.commons.model.ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic void unitUnregistered(com.lf.commons.model.ApplicationModel model, java.lang.String id)
unitUnregistered
in interface com.lf.commons.model.ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic java.util.Hashtable<java.lang.String,com.lf.commons.config.Configuration> getTemplates()
public com.lf.commons.config.Configuration getTemplate(java.lang.String id)
id
- The template identifiernull
if not availableprotected void debugTemplates()
public static java.lang.String debugEntryMapping(com.lf.commons.lang.OrderedHashtable<java.lang.Object,java.lang.Object[]> entries, java.lang.String[] targetsets)
entries
- The source/target mappingtargetsets
- The target set names (optional)public java.lang.String getSourceGenerateTemplate(java.lang.String mapping)
mapping
- The identifiernull
otherwisepublic static java.lang.String getSourceGenerateTemplate(com.lf.commons.config.Configuration config)
config
- The variablesnull
otherwisepublic boolean getSourceGenerateTemplateRefresh(java.lang.String mapping)
mapping
- The identifierpublic static boolean getSourceGenerateTemplateRefresh(com.lf.commons.config.Configuration config)
config
- The variablespublic java.util.Hashtable<java.lang.String,java.lang.String> getTargetGenerateTemplates(java.lang.String mapping)
mapping
- The identifiernull
otherwisepublic static java.util.Hashtable<java.lang.String,java.lang.String> getTargetGenerateTemplates(com.lf.commons.config.Configuration config)
config
- The variablesnull
otherwisepublic java.util.Hashtable<java.lang.String,java.lang.Boolean> getTargetGenerateTemplatesRefresh(java.lang.String mapping)
mapping
- The identifiernull
otherwisepublic static java.util.Hashtable<java.lang.String,java.lang.Boolean> getTargetGenerateTemplatesRefresh(com.lf.commons.config.Configuration config)
config
- The variablesnull
otherwisepublic boolean getFlipSourceTarget(java.lang.String mapping)
mapping
- The identifierpublic java.lang.String getFlipTarget(java.lang.String mapping)
mapping
- The identifiernull
otherwiseCopyright © 2005-2015 Leisenfels UG. All rights reserved.