mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-08 09:35:23 +02:00
[cleanup] formatted and added javadoc in preparation for debugging
This commit is contained in:
parent
698c707f7c
commit
87ab2d2c07
1 changed files with 168 additions and 208 deletions
|
@ -39,71 +39,66 @@ import org.eclipse.rse.persistence.dom.IRSEDOMExporter;
|
||||||
import org.eclipse.rse.persistence.dom.RSEDOM;
|
import org.eclipse.rse.persistence.dom.RSEDOM;
|
||||||
import org.eclipse.rse.persistence.dom.RSEDOMNode;
|
import org.eclipse.rse.persistence.dom.RSEDOMNode;
|
||||||
|
|
||||||
|
public class RSEDOMExporter implements IRSEDOMExporter {
|
||||||
public class RSEDOMExporter implements IRSEDOMExporter
|
|
||||||
{
|
|
||||||
private static RSEDOMExporter _instance = new RSEDOMExporter();
|
private static RSEDOMExporter _instance = new RSEDOMExporter();
|
||||||
private Map _domMap;
|
private Map _domMap;
|
||||||
|
|
||||||
protected RSEDOMExporter()
|
/**
|
||||||
{
|
* Constructor to create a new DOM exporter.
|
||||||
|
*/
|
||||||
|
protected RSEDOMExporter() {
|
||||||
_domMap = new HashMap();
|
_domMap = new HashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RSEDOMExporter getInstance()
|
/**
|
||||||
{
|
* @return the singleton instance of this exporter
|
||||||
|
*/
|
||||||
|
public static RSEDOMExporter getInstance() {
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the RSEDOM for this profile iff it exists
|
* Returns the RSEDOM for this profile if it exists
|
||||||
* @param profile
|
* @param profile the profile for which to get the DOM
|
||||||
* @return
|
* @return the DOM for a particular profile, null if the DOM does not exist
|
||||||
*/
|
*/
|
||||||
public RSEDOM getRSEDOM(ISystemProfile profile)
|
public RSEDOM getRSEDOM(ISystemProfile profile) {
|
||||||
{
|
return (RSEDOM) _domMap.get(profile);
|
||||||
return (RSEDOM)_domMap.get(profile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the RSE DOM for this profile
|
* Creates the RSE DOM for this profile
|
||||||
* @param profile
|
* @param profile the profile for which to create the DOM
|
||||||
* @param clean indicates whether to create from scratch or merge with existing
|
* @param clean indicates whether to create from scratch or merge with existing DOM
|
||||||
* @return
|
* @return The DOM for this profile
|
||||||
*/
|
*/
|
||||||
public RSEDOM createRSEDOM(ISystemProfile profile, boolean clean)
|
public RSEDOM createRSEDOM(ISystemProfile profile, boolean clean) {
|
||||||
{
|
|
||||||
RSEDOM dom = getRSEDOM(profile);
|
RSEDOM dom = getRSEDOM(profile);
|
||||||
if (dom == null)
|
if (dom == null) {
|
||||||
{
|
|
||||||
dom = new RSEDOM(profile);
|
dom = new RSEDOM(profile);
|
||||||
_domMap.put(profile, dom);
|
_domMap.put(profile, dom);
|
||||||
clean = true;
|
clean = true;
|
||||||
}
|
}
|
||||||
populateRSEDOM(dom, profile, clean);
|
populateRSEDOM(dom, profile, clean);
|
||||||
|
|
||||||
return dom;
|
return dom;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an RSE DOM for use in persistence
|
* Creates an RSE DOM for use in persistence
|
||||||
* @param dom
|
* @param dom the root node for the target DOM
|
||||||
* @param profile
|
* @param profile the profile from which to populate the DOM
|
||||||
* @return
|
* @param clean indicates whether to create from scratch or merge with existing DOM
|
||||||
|
* @return The DOM, updated with the data from the profile
|
||||||
*/
|
*/
|
||||||
public RSEDOM populateRSEDOM(RSEDOM dom, ISystemProfile profile, boolean clean)
|
public RSEDOM populateRSEDOM(RSEDOM dom, ISystemProfile profile, boolean clean) {
|
||||||
{
|
|
||||||
// for now we do complete refresh
|
// for now we do complete refresh
|
||||||
// clean dom for fresh creation
|
// clean dom for fresh creation
|
||||||
if (clean)
|
if (clean) {
|
||||||
{
|
|
||||||
dom.clearChildren();
|
dom.clearChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clean || profile.isDirty() || dom.isDirty())
|
if (clean || profile.isDirty() || dom.isDirty()) {
|
||||||
{
|
|
||||||
dom.clearAttributes();
|
dom.clearAttributes();
|
||||||
|
|
||||||
dom.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT_PRIVATE, getBooleanString(profile.isDefaultPrivate()));
|
dom.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT_PRIVATE, getBooleanString(profile.isDefaultPrivate()));
|
||||||
dom.addAttribute(IRSEDOMConstants.ATTRIBUTE_IS_ACTIVE, getBooleanString(profile.isActive()));
|
dom.addAttribute(IRSEDOMConstants.ATTRIBUTE_IS_ACTIVE, getBooleanString(profile.isActive()));
|
||||||
}
|
}
|
||||||
|
@ -112,8 +107,7 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
|
|
||||||
// create filter pool nodes
|
// create filter pool nodes
|
||||||
ISystemFilterPool[] filterPools = profile.getFilterPools();
|
ISystemFilterPool[] filterPools = profile.getFilterPools();
|
||||||
for (int i = 0; i < filterPools.length; i++)
|
for (int i = 0; i < filterPools.length; i++) {
|
||||||
{
|
|
||||||
ISystemFilterPool pool = filterPools[i];
|
ISystemFilterPool pool = filterPools[i];
|
||||||
createNode(dom, pool, clean);
|
createNode(dom, pool, clean);
|
||||||
}
|
}
|
||||||
|
@ -122,39 +116,32 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
|
|
||||||
// old nodes to compare with
|
// old nodes to compare with
|
||||||
RSEDOMNode[] oldHostNodes = null;
|
RSEDOMNode[] oldHostNodes = null;
|
||||||
if (!clean)
|
if (!clean) {
|
||||||
{
|
|
||||||
oldHostNodes = dom.getChildren(IRSEDOMConstants.TYPE_HOST);
|
oldHostNodes = dom.getChildren(IRSEDOMConstants.TYPE_HOST);
|
||||||
}
|
}
|
||||||
|
|
||||||
List missingNodes = new ArrayList();
|
List missingNodes = new ArrayList();
|
||||||
if (!clean)
|
if (!clean) {
|
||||||
{
|
for (int o = 0; o < oldHostNodes.length; o++) {
|
||||||
for (int o = 0; o < oldHostNodes.length; o++)
|
|
||||||
{
|
|
||||||
missingNodes.add(oldHostNodes[o]);
|
missingNodes.add(oldHostNodes[o]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IHost[] hosts = profile.getHosts();
|
IHost[] hosts = profile.getHosts();
|
||||||
for (int j = 0; j < hosts.length; j++)
|
for (int j = 0; j < hosts.length; j++) {
|
||||||
{
|
|
||||||
IHost host = hosts[j];
|
IHost host = hosts[j];
|
||||||
RSEDOMNode hnode = createNode(dom, host, clean);
|
RSEDOMNode hnode = createNode(dom, host, clean);
|
||||||
|
|
||||||
if (!clean)
|
if (!clean) {
|
||||||
{
|
|
||||||
// remove this one from the missing list
|
// remove this one from the missing list
|
||||||
missingNodes.remove(hnode);
|
missingNodes.remove(hnode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!clean)
|
if (!clean) {
|
||||||
{
|
|
||||||
// remaining missingNodes are probably deleted now
|
// remaining missingNodes are probably deleted now
|
||||||
for (int x = 0; x < missingNodes.size(); x++)
|
for (int x = 0; x < missingNodes.size(); x++) {
|
||||||
{
|
dom.removeChild((RSEDOMNode) missingNodes.get(x));
|
||||||
dom.removeChild((RSEDOMNode)missingNodes.get(x));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,60 +154,51 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates DOM nodes for each associated property set
|
* Creates DOM nodes for each associated property set
|
||||||
* @param parent
|
* @param parent The node of the DOM that needs a property set
|
||||||
* @param modelObject
|
* @param modelObject the RSE model object that has the property set.
|
||||||
* @return
|
* @param clean true if we are creating, false if we are merging
|
||||||
|
* @return an array of DOM nodes - each one being a property set
|
||||||
*/
|
*/
|
||||||
public RSEDOMNode[] createPropertySetNodes(RSEDOMNode parent, IRSEModelObject modelObject, boolean clean)
|
public RSEDOMNode[] createPropertySetNodes(RSEDOMNode parent, IRSEModelObject modelObject, boolean clean) {
|
||||||
{
|
|
||||||
IPropertySet[] propertySets = modelObject.getPropertySets();
|
IPropertySet[] propertySets = modelObject.getPropertySets();
|
||||||
for (int i = 0; i < propertySets.length; i++)
|
for (int i = 0; i < propertySets.length; i++) {
|
||||||
{
|
|
||||||
IPropertySet set = propertySets[i];
|
IPropertySet set = propertySets[i];
|
||||||
RSEDOMNode node = new RSEDOMNode(parent, IRSEDOMConstants.TYPE_PROPERTY_SET, set.getName());
|
RSEDOMNode node = new RSEDOMNode(parent, IRSEDOMConstants.TYPE_PROPERTY_SET, set.getName());
|
||||||
String[] keys = set.getPropertyKeys();
|
String[] keys = set.getPropertyKeys();
|
||||||
for (int k = 0; k < keys.length; k++)
|
for (int k = 0; k < keys.length; k++) {
|
||||||
{
|
|
||||||
String key = keys[k];
|
String key = keys[k];
|
||||||
String value = set.getPropertyValue(key);
|
String value = set.getPropertyValue(key);
|
||||||
IPropertyType type = set.getPropertyType(key);
|
IPropertyType type = set.getPropertyType(key);
|
||||||
node.addAttribute(key, value, type.toString());
|
node.addAttribute(key, value, type.toString());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return parent.getChildren();
|
return parent.getChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a DOM node representing a filter pool
|
* Create a DOM node representing a filter pool
|
||||||
* @param parent
|
* @param parent the parent DOM node
|
||||||
* @param filterPool
|
* @param filterPool the filter pool from which to create a DOM node linked to this parent
|
||||||
* @return
|
* @param clean true if we are creating, false if we are merging
|
||||||
|
* @return the DOM node representing the filter pool
|
||||||
*/
|
*/
|
||||||
public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPool filterPool, boolean clean)
|
public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPool filterPool, boolean clean) {
|
||||||
{
|
|
||||||
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_POOL, filterPool, clean);
|
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_POOL, filterPool, clean);
|
||||||
|
if (clean || node.isDirty()) {
|
||||||
if (clean || node.isDirty())
|
|
||||||
{
|
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, filterPool.getType());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, filterPool.getType());
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_ID, filterPool.getId());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_ID, filterPool.getId());
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS, getBooleanString(filterPool.supportsNestedFilters()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS, getBooleanString(filterPool.supportsNestedFilters()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DELETABLE, getBooleanString(filterPool.isDeletable()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DELETABLE, getBooleanString(filterPool.isDeletable()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filterPool.isDefault()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filterPool.isDefault()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE, getBooleanString(filterPool.isSetStringsCaseSensitive()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE, getBooleanString(filterPool.isSetStringsCaseSensitive()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS,getBooleanString(filterPool.supportsDuplicateFilterStrings()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS, getBooleanString(filterPool.supportsDuplicateFilterStrings()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE, ""+filterPool.getRelease());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE, "" + filterPool.getRelease());
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY, getBooleanString(filterPool.isSetSingleFilterStringOnly()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY, getBooleanString(filterPool.isSetSingleFilterStringOnly()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_OWNING_PARENT_NAME, filterPool.getOwningParentName());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_OWNING_PARENT_NAME, filterPool.getOwningParentName());
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE, getBooleanString(filterPool.isNonRenamable()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE, getBooleanString(filterPool.isNonRenamable()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ISystemFilter[] filters = filterPool.getSystemFilters();
|
ISystemFilter[] filters = filterPool.getSystemFilters();
|
||||||
for (int i = 0; i < filters.length; i++)
|
for (int i = 0; i < filters.length; i++) {
|
||||||
{
|
|
||||||
createNode(node, filters[i], clean);
|
createNode(node, filters[i], clean);
|
||||||
}
|
}
|
||||||
createPropertySetNodes(node, filterPool, clean);
|
createPropertySetNodes(node, filterPool, clean);
|
||||||
|
@ -230,43 +208,38 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a DOM node for a filter
|
* Creates a DOM node for a filter
|
||||||
* @param parent
|
* @param parent The parent DOM node for this filter, usually a DOM node for a filter pool
|
||||||
* @param filter
|
* @param filter the filter for which to create a new node
|
||||||
* @return
|
* @param clean true if we are creating, false if we are merging
|
||||||
|
* @return the DOM node representing the filter
|
||||||
*/
|
*/
|
||||||
public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilter filter, boolean clean)
|
public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilter filter, boolean clean) {
|
||||||
{
|
|
||||||
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER, filter, clean);
|
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER, filter, clean);
|
||||||
|
if (clean || node.isDirty()) {
|
||||||
if (clean || node.isDirty())
|
|
||||||
{
|
|
||||||
// add attributes
|
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_ID, filter.getName());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_ID, filter.getName());
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS, getBooleanString(filter.isSupportsNestedFilters()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_NESTED_FILTERS, getBooleanString(filter.isSupportsNestedFilters()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELATIVE_ORDER, "" + filter.getRelativeOrder());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELATIVE_ORDER, "" + filter.getRelativeOrder());
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filter.isDefault()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filter.isDefault()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE, getBooleanString(filter.isSetStringsCaseSensitive()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING_CASE_SENSITIVE, getBooleanString(filter.isSetStringsCaseSensitive()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(filter.isPromptable()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(filter.isPromptable()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS,getBooleanString(filter.supportsDuplicateFilterStrings()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SUPPORTS_DUPLICATE_FILTER_STRINGS, getBooleanString(filter.supportsDuplicateFilterStrings()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_DELETABLE, getBooleanString(filter.isNonDeletable()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_DELETABLE, getBooleanString(filter.isNonDeletable()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE, getBooleanString(filter.isNonRenamable()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_RENAMABLE, getBooleanString(filter.isNonRenamable()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_CHANGEABLE, getBooleanString(filter.isNonChangable()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_NON_CHANGEABLE, getBooleanString(filter.isNonChangable()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRINGS_NON_CHANGABLE, getBooleanString(filter.isStringsNonChangable()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRINGS_NON_CHANGABLE, getBooleanString(filter.isStringsNonChangable()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE, ""+filter.getRelease());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_RELEASE, "" + filter.getRelease());
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY, getBooleanString(filter.isSetSingleFilterStringOnly()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_SINGLE_FILTER_STRING_ONLY, getBooleanString(filter.isSetSingleFilterStringOnly()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// add nested filters
|
// add nested filters
|
||||||
ISystemFilter[] nestedFilters = filter.getSystemFilters();
|
ISystemFilter[] nestedFilters = filter.getSystemFilters();
|
||||||
for (int i = 0; i < nestedFilters.length; i++)
|
for (int i = 0; i < nestedFilters.length; i++) {
|
||||||
{
|
|
||||||
createNode(node, nestedFilters[i], clean);
|
createNode(node, nestedFilters[i], clean);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add filter strings
|
// add filter strings
|
||||||
ISystemFilterString[] filterStrings = filter.getSystemFilterStrings();
|
ISystemFilterString[] filterStrings = filter.getSystemFilterStrings();
|
||||||
for (int j = 0; j < filterStrings.length; j++)
|
for (int j = 0; j < filterStrings.length; j++) {
|
||||||
{
|
|
||||||
createNode(node, filterStrings[j], clean);
|
createNode(node, filterStrings[j], clean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,16 +250,15 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a DOM node for a filter string
|
* Creates a DOM node for a filter string
|
||||||
* @param parent
|
* @param parent the DOM node that is the parent to this filter string. This should be a node for a filter.
|
||||||
* @param filterString
|
* @param filterString The filter string for which the node will be created
|
||||||
* @return
|
* @param clean true if we are creating, false if we are merging
|
||||||
|
* @return the DOM node for the filter string
|
||||||
*/
|
*/
|
||||||
public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterString filterString, boolean clean)
|
public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterString filterString, boolean clean) {
|
||||||
{
|
|
||||||
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_STRING, filterString, clean);
|
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_STRING, filterString, clean);
|
||||||
|
|
||||||
if (clean || node.isDirty())
|
if (clean || node.isDirty()) {
|
||||||
{
|
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING, filterString.getString());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_STRING, filterString.getString());
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, filterString.getType());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, filterString.getType());
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filterString.isDefault()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DEFAULT, getBooleanString(filterString.isDefault()));
|
||||||
|
@ -298,16 +270,15 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a DOM node representing a host
|
* Create a DOM node representing a host
|
||||||
* @param parent
|
* @param parent The DOM node that is the parent to this host, usually a node representing a profile
|
||||||
* @param host
|
* @param host The host for which to create the DOM node
|
||||||
* @return
|
* @param clean true if we are creating, false if we are merging
|
||||||
|
* @return the DOM node for the host
|
||||||
*/
|
*/
|
||||||
public RSEDOMNode createNode(RSEDOMNode parent, IHost host, boolean clean)
|
public RSEDOMNode createNode(RSEDOMNode parent, IHost host, boolean clean) {
|
||||||
{
|
|
||||||
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_HOST, host, clean);
|
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_HOST, host, clean);
|
||||||
|
|
||||||
if (clean || node.isDirty())
|
if (clean || node.isDirty()) {
|
||||||
{
|
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, host.getSystemType());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, host.getSystemType());
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE, getBooleanString(host.isOffline()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE, getBooleanString(host.isOffline()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(host.isPromptable()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_PROMPTABLE, getBooleanString(host.isPromptable()));
|
||||||
|
@ -315,36 +286,30 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION, host.getDescription());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION, host.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IConnectorService[] connectorServices = host.getConnectorServices();
|
IConnectorService[] connectorServices = host.getConnectorServices();
|
||||||
for (int i = 0; i < connectorServices.length; i++)
|
for (int i = 0; i < connectorServices.length; i++) {
|
||||||
{
|
|
||||||
IConnectorService service = connectorServices[i];
|
IConnectorService service = connectorServices[i];
|
||||||
createNode(node, service, clean);
|
createNode(node, service, clean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
createPropertySetNodes(node, host, clean);
|
createPropertySetNodes(node, host, clean);
|
||||||
node.setDirty(false);
|
node.setDirty(false);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a DOM node for a connector service
|
* Creates a DOM node for a connector service
|
||||||
* @param parent
|
* @param parent the DOM node representing the parent for a connector service. This should be a Host
|
||||||
* @param connectorService
|
* @param connectorService the connector service for which a DOM node is to be created
|
||||||
* @return
|
* @param clean true if we are creating, false if we are merging
|
||||||
|
* @return the DOM node for the connector service
|
||||||
*/
|
*/
|
||||||
public RSEDOMNode createNode(RSEDOMNode parent, IConnectorService connectorService, boolean clean)
|
public RSEDOMNode createNode(RSEDOMNode parent, IConnectorService connectorService, boolean clean) {
|
||||||
{
|
|
||||||
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_CONNECTOR_SERVICE, connectorService, clean);
|
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_CONNECTOR_SERVICE, connectorService, clean);
|
||||||
if (clean || node.isDirty())
|
if (clean || node.isDirty()) {
|
||||||
{
|
|
||||||
// store it's attributes
|
// store it's attributes
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, connectorService.getHostType());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, connectorService.getHostType());
|
||||||
|
|
||||||
|
|
||||||
// can't do this til connector service owns the properties (right now it's still subsystem)
|
// can't do this til connector service owns the properties (right now it's still subsystem)
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_GROUP, connectorService.getName());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_GROUP, connectorService.getName());
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_USE_SSL, getBooleanString(connectorService.isUsingSSL()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_USE_SSL, getBooleanString(connectorService.isUsingSSL()));
|
||||||
|
@ -354,15 +319,13 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
// that will change later
|
// that will change later
|
||||||
|
|
||||||
IServerLauncherProperties serverLauncher = connectorService.getRemoteServerLauncherProperties();
|
IServerLauncherProperties serverLauncher = connectorService.getRemoteServerLauncherProperties();
|
||||||
if (serverLauncher != null)
|
if (serverLauncher != null) {
|
||||||
{
|
|
||||||
createNode(node, serverLauncher, clean);
|
createNode(node, serverLauncher, clean);
|
||||||
}
|
}
|
||||||
|
|
||||||
// store each subsystem
|
// store each subsystem
|
||||||
ISubSystem[] subSystems = connectorService.getSubSystems();
|
ISubSystem[] subSystems = connectorService.getSubSystems();
|
||||||
for (int i = 0; i < subSystems.length; i++)
|
for (int i = 0; i < subSystems.length; i++) {
|
||||||
{
|
|
||||||
createNode(node, subSystems[i], clean);
|
createNode(node, subSystems[i], clean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,16 +336,15 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a DOM node for a server launcher
|
* Creates a DOM node for a server launcher
|
||||||
* @param parent
|
* @param parent the DOM node represnting a parent for a server launcher, usually a connector service
|
||||||
* @param serverLauncher
|
* @param serverLauncher the server launcher from which to create the node
|
||||||
* @return
|
* @param clean true if we are creating, false if we are merging
|
||||||
|
* @return the node representing the server launcher
|
||||||
*/
|
*/
|
||||||
public RSEDOMNode createNode(RSEDOMNode parent, IServerLauncherProperties serverLauncher, boolean clean)
|
public RSEDOMNode createNode(RSEDOMNode parent, IServerLauncherProperties serverLauncher, boolean clean) {
|
||||||
{
|
|
||||||
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_SERVER_LAUNCHER, serverLauncher, clean);
|
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_SERVER_LAUNCHER, serverLauncher, clean);
|
||||||
|
|
||||||
if (clean || node.isDirty())
|
if (clean || node.isDirty()) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
serverLauncher.saveToProperties();
|
serverLauncher.saveToProperties();
|
||||||
|
@ -392,27 +354,24 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a DOM node for a subsystem
|
* Creates a DOM node for a subsystem
|
||||||
* @param parent
|
* @param parent the DOM node representing the parent for this subsystem, usually a connector service
|
||||||
* @param subSystem
|
* @param subSystem the subsystem from which to create the DOM node
|
||||||
* @return
|
* @param clean true if we are creating, false if we are merging
|
||||||
|
* @return the DOM node representing the subsystem
|
||||||
*/
|
*/
|
||||||
public RSEDOMNode createNode(RSEDOMNode parent, ISubSystem subSystem, boolean clean)
|
public RSEDOMNode createNode(RSEDOMNode parent, ISubSystem subSystem, boolean clean) {
|
||||||
{
|
|
||||||
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_SUBSYSTEM, subSystem, clean);
|
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_SUBSYSTEM, subSystem, clean);
|
||||||
|
|
||||||
if (clean || node.isDirty())
|
if (clean || node.isDirty()) {
|
||||||
{
|
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_HIDDEN, getBooleanString(subSystem.isHidden()));
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_HIDDEN, getBooleanString(subSystem.isHidden()));
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, subSystem.getSubSystemConfiguration().getId());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, subSystem.getSubSystemConfiguration().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// create filter pool reference nodes
|
// create filter pool reference nodes
|
||||||
ISystemFilterPoolReferenceManager refMgr = subSystem.getFilterPoolReferenceManager();
|
ISystemFilterPoolReferenceManager refMgr = subSystem.getFilterPoolReferenceManager();
|
||||||
if (refMgr != null)
|
if (refMgr != null) {
|
||||||
{
|
|
||||||
ISystemFilterPoolReference[] references = refMgr.getSystemFilterPoolReferences();
|
ISystemFilterPoolReference[] references = refMgr.getSystemFilterPoolReferences();
|
||||||
for (int i = 0; i < references.length; i++)
|
for (int i = 0; i < references.length; i++) {
|
||||||
{
|
|
||||||
ISystemFilterPoolReference ref = references[i];
|
ISystemFilterPoolReference ref = references[i];
|
||||||
createNode(node, ref, clean);
|
createNode(node, ref, clean);
|
||||||
}
|
}
|
||||||
|
@ -425,16 +384,15 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a DOM node for a filter pool reference
|
* Creates a DOM node for a filter pool reference
|
||||||
* @param parent
|
* @param parent the DOM node representing the parent for a filter pool reference, usually a subsystem
|
||||||
* @param filterPoolReference
|
* @param filterPoolReference the reference from which to create a new DOM node
|
||||||
* @return
|
* @param clean true if we are creating, false if we are merging
|
||||||
|
* @return the DOM node created for the filter pool reference
|
||||||
*/
|
*/
|
||||||
public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPoolReference filterPoolReference, boolean clean)
|
public RSEDOMNode createNode(RSEDOMNode parent, ISystemFilterPoolReference filterPoolReference, boolean clean) {
|
||||||
{
|
|
||||||
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_POOL_REFERENCE, filterPoolReference, clean);
|
RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_FILTER_POOL_REFERENCE, filterPoolReference, clean);
|
||||||
|
|
||||||
if (clean || node.isDirty())
|
if (clean || node.isDirty()) {
|
||||||
{
|
|
||||||
ISystemFilterPool filterPool = filterPoolReference.getReferencedFilterPool();
|
ISystemFilterPool filterPool = filterPoolReference.getReferencedFilterPool();
|
||||||
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_REF_ID, filterPool.getId());
|
node.addAttribute(IRSEDOMConstants.ATTRIBUTE_REF_ID, filterPool.getId());
|
||||||
}
|
}
|
||||||
|
@ -444,22 +402,25 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RSEDOMNode findOrCreateNode(RSEDOMNode parent, String type, IRSEModelObject modelObject, boolean clean)
|
/**
|
||||||
{
|
* @param parent the DOM node representing the parent of the node we are trying to find
|
||||||
|
* @param type the type of the DOM node to look for
|
||||||
|
* @param modelObject the model object for which we are trying to find a matching node
|
||||||
|
* @param clean true if we are creating, false if we are merging
|
||||||
|
* @return the DOM node that we found or created
|
||||||
|
*/
|
||||||
|
private RSEDOMNode findOrCreateNode(RSEDOMNode parent, String type, IRSEModelObject modelObject, boolean clean) {
|
||||||
RSEDOMNode node = null;
|
RSEDOMNode node = null;
|
||||||
String name = modelObject.getName();
|
String name = modelObject.getName();
|
||||||
if (!clean)
|
if (!clean) {
|
||||||
{
|
node = parent.getChild(type, name);
|
||||||
node = parent.getChild(type,name);
|
if (node != null && modelObject.isDirty()) {
|
||||||
if (node != null && modelObject.isDirty())
|
|
||||||
{
|
|
||||||
node.clearAttributes();
|
node.clearAttributes();
|
||||||
node.setDirty(true);
|
node.setDirty(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean newNode = (node == null);
|
boolean newNode = (node == null);
|
||||||
if (newNode)
|
if (newNode) {
|
||||||
{
|
|
||||||
node = new RSEDOMNode(parent, type, name);
|
node = new RSEDOMNode(parent, type, name);
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
|
@ -467,11 +428,10 @@ public class RSEDOMExporter implements IRSEDOMExporter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper to get either "true" or "false" based on boolean flag
|
* Helper to get either "true" or "false" based on boolean flag
|
||||||
* @param flag
|
* @param flag the flag which to translate
|
||||||
* @return
|
* @return a string value suitable for the DOM
|
||||||
*/
|
*/
|
||||||
private String getBooleanString(boolean flag)
|
private String getBooleanString(boolean flag) {
|
||||||
{
|
|
||||||
return flag ? IRSEDOMConstants.ATTRIBUTE_TRUE : IRSEDOMConstants.ATTRIBUTE_FALSE;
|
return flag ? IRSEDOMConstants.ATTRIBUTE_TRUE : IRSEDOMConstants.ATTRIBUTE_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue