com.cisco.oss.foundation.configuration.xml
Class NamespaceDefinitionMessage

java.lang.Object
  extended by com.cisco.oss.foundation.configuration.xml.NamespaceDefinitionMessage

public class NamespaceDefinitionMessage
extends Object

This class is responsible for marshalling and unmarshalling NamespaceDefinition messages.

Author:
dventura

Constructor Summary
NamespaceDefinitionMessage(NamespaceDefinitions jaxb)
           
NamespaceDefinitionMessage(String xml)
           
 
Method Summary
protected  void addDependenciesRecursively(Namespace namespace, List<Namespace> namespaceList, String dependencyId, List<String> extendedDependencies)
          Adds dependencyId, and all of it's depdencies recursively using namespaceList, to extendedDependencies for namespace.
protected  Map<Namespace,List<String>> createNamespaceMap(List<NamespaceDefinition> namespaceDefs)
          Checks that there aren't namespaces that depend on namespaces that don't exist in the list, and creates a list of all Namespace Objects in the list.
protected  NamespaceDefinition extractNamespaceWithLeastDependencies(Map<Namespace,List<String>> namespaceMap)
           
 NamespaceDefinitions jaxb()
           
protected  String marshall(NamespaceDefinitions jaxb)
           
 List<NamespaceDefinition> sortByDependencies()
          A NamespaceDefinition cannot be injected into the DB unless it's dependencies are injected first.
 String toXml()
           
protected  NamespaceDefinitions unmarshall(String xml)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamespaceDefinitionMessage

public NamespaceDefinitionMessage(String xml)
                           throws XmlException
Throws:
XmlException

NamespaceDefinitionMessage

public NamespaceDefinitionMessage(NamespaceDefinitions jaxb)
                           throws XmlException
Throws:
XmlException
Method Detail

toXml

public String toXml()

jaxb

public NamespaceDefinitions jaxb()

marshall

protected String marshall(NamespaceDefinitions jaxb)
                   throws XmlException
Throws:
XmlException

unmarshall

protected NamespaceDefinitions unmarshall(String xml)
                                   throws XmlException
Throws:
XmlException

sortByDependencies

public List<NamespaceDefinition> sortByDependencies()
                                             throws XmlException
A NamespaceDefinition cannot be injected into the DB unless it's dependencies are injected first. This method will sort the given list of NamespaceDefinitions by dependency. If dependencies are missing, or circular dependencies exist such that there aren't any NamespaceDefinitions without dependencies a XmlException will be thrown.

Returns:
The list of NamespaceDefinition Object, sorted by dependencies
Throws:
XmlException - if dependencies are missing or circular dependencies exist such that there aren't any NamespaceDefinitions without dependencies

extractNamespaceWithLeastDependencies

protected NamespaceDefinition extractNamespaceWithLeastDependencies(Map<Namespace,List<String>> namespaceMap)

createNamespaceMap

protected Map<Namespace,List<String>> createNamespaceMap(List<NamespaceDefinition> namespaceDefs)
                                                  throws XmlException
Checks that there aren't namespaces that depend on namespaces that don't exist in the list, and creates a list of all Namespace Objects in the list.

Throws:
XmlException - if there are any dependencies missing.

addDependenciesRecursively

protected void addDependenciesRecursively(Namespace namespace,
                                          List<Namespace> namespaceList,
                                          String dependencyId,
                                          List<String> extendedDependencies)
                                   throws XmlException
Adds dependencyId, and all of it's depdencies recursively using namespaceList, to extendedDependencies for namespace.

Throws:
XmlException


Copyright © 2014 Cisco. All Rights Reserved.