Class ProjectFileUpgrader
java.lang.Object
org.apache.cayenne.project.upgrade.ProjectFileUpgrader
Upgrades project or DataMap XML resources created by older versions of Cayenne to the current project version.
- Since:
- 5.0
-
Constructor Summary
ConstructorsConstructorDescriptionProjectFileUpgrader(org.apache.cayenne.di.Provider<XMLReader> xmlReaderProvider) -
Method Summary
Modifier and TypeMethodDescriptioncheckUpgradeNeeded(String version) Determines what kind of upgrade, if any, a project of the given version needs.static StringprojectVersion(String rootNamespace, Attributes rootAttributes) Returns the version of a project or DataMap XML based on its root tag, or null if it can't be determined.readVersion(Resource resource) Reads the version from the root tag of a project or DataMap XML, without reading the rest of the document.upgradeDataMapDOM(Resource resource, String fromVersion) Reads the DataMap XML and upgrades its DOM from the given version.upgradeProjectDOM(Resource resource, String fromVersion) Reads the project XML and upgrades its DOM from the given version.
-
Constructor Details
-
ProjectFileUpgrader
-
-
Method Details
-
checkUpgradeNeeded
Determines what kind of upgrade, if any, a project of the given version needs. -
projectVersion
Returns the version of a project or DataMap XML based on its root tag, or null if it can't be determined. The version is a part of the root namespace, e.g. "http://cayenne.apache.org/schema/14/dataMap". The documents older than version 14 may have no namespace, or a namespace with no project version in it, in which case the version is taken from their "project-version" attribute.- Since:
- 5.0
-
readVersion
-
upgradeProjectDOM
Reads the project XML and upgrades its DOM from the given version. The project file is not modified. The referenced DataMaps are not touched, seeupgradeDataMapDOM(Resource, String).- Throws:
ConfigurationException- if the version is newer than the current one, or is too old to be upgraded
-
upgradeDataMapDOM
Reads the DataMap XML and upgrades its DOM from the given version. The DataMap file is not modified.- Throws:
ConfigurationException- if the version is newer than the current one, or is too old to be upgraded
-