BUG 2041701: Release notes content/link in SDK Updater schema

This commit is contained in:
Raphael
2009-08-11 13:46:21 -07:00
parent e89d6042a3
commit 609b375a03
4 changed files with 107 additions and 16 deletions

View File

@@ -46,12 +46,16 @@ public abstract class Package implements IDescription {
private static final String PROP_LICENSE = "Pkg.License"; //$NON-NLS-1$ private static final String PROP_LICENSE = "Pkg.License"; //$NON-NLS-1$
private static final String PROP_DESC = "Pkg.Desc"; //$NON-NLS-1$ private static final String PROP_DESC = "Pkg.Desc"; //$NON-NLS-1$
private static final String PROP_DESC_URL = "Pkg.DescUrl"; //$NON-NLS-1$ private static final String PROP_DESC_URL = "Pkg.DescUrl"; //$NON-NLS-1$
private static final String PROP_RELEASE_NOTE = "Pkg.RelNote"; //$NON-NLS-1$
private static final String PROP_RELEASE_URL = "Pkg.RelNoteUrl"; //$NON-NLS-1$
private static final String PROP_SOURCE_URL = "Pkg.SourceUrl"; //$NON-NLS-1$ private static final String PROP_SOURCE_URL = "Pkg.SourceUrl"; //$NON-NLS-1$
private static final String PROP_USER_SOURCE = "Pkg.UserSrc"; //$NON-NLS-1$ private static final String PROP_USER_SOURCE = "Pkg.UserSrc"; //$NON-NLS-1$
private final int mRevision; private final int mRevision;
private final String mLicense; private final String mLicense;
private final String mDescription; private final String mDescription;
private final String mDescUrl; private final String mDescUrl;
private final String mReleaseNote;
private final String mReleaseUrl;
private final Archive[] mArchives; private final Archive[] mArchives;
private final RepoSource mSource; private final RepoSource mSource;
@@ -80,6 +84,8 @@ public abstract class Package implements IDescription {
mRevision = XmlParserUtils.getXmlInt (packageNode, SdkRepository.NODE_REVISION, 0); mRevision = XmlParserUtils.getXmlInt (packageNode, SdkRepository.NODE_REVISION, 0);
mDescription = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_DESCRIPTION); mDescription = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_DESCRIPTION);
mDescUrl = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_DESC_URL); mDescUrl = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_DESC_URL);
mReleaseNote = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_RELEASE_NOTE);
mReleaseUrl = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_RELEASE_URL);
mLicense = parseLicense(packageNode, licenses); mLicense = parseLicense(packageNode, licenses);
mArchives = parseArchives(XmlParserUtils.getFirstChild( mArchives = parseArchives(XmlParserUtils.getFirstChild(
@@ -104,10 +110,19 @@ public abstract class Package implements IDescription {
Arch archiveArch, Arch archiveArch,
String archiveOsPath) { String archiveOsPath) {
if (description == null) {
description = "";
}
if (descUrl == null) {
descUrl = "";
}
mRevision = Integer.parseInt(getProperty(props, PROP_REVISION, Integer.toString(revision))); mRevision = Integer.parseInt(getProperty(props, PROP_REVISION, Integer.toString(revision)));
mLicense = getProperty(props, PROP_LICENSE, license); mLicense = getProperty(props, PROP_LICENSE, license);
mDescription = getProperty(props, PROP_DESC, description); mDescription = getProperty(props, PROP_DESC, description);
mDescUrl = getProperty(props, PROP_DESC_URL, descUrl); mDescUrl = getProperty(props, PROP_DESC_URL, descUrl);
mReleaseNote = getProperty(props, PROP_RELEASE_NOTE, "");
mReleaseUrl = getProperty(props, PROP_RELEASE_URL, "");
// If source is null and we can find a source URL in the properties, generate // If source is null and we can find a source URL in the properties, generate
// a dummy source just to store the URL. This allows us to easily remember where // a dummy source just to store the URL. This allows us to easily remember where
@@ -145,16 +160,24 @@ public abstract class Package implements IDescription {
*/ */
void saveProperties(Properties props) { void saveProperties(Properties props) {
props.setProperty(PROP_REVISION, Integer.toString(mRevision)); props.setProperty(PROP_REVISION, Integer.toString(mRevision));
if (mLicense != null) { if (mLicense != null && mLicense.length() > 0) {
props.setProperty(PROP_LICENSE, mLicense); props.setProperty(PROP_LICENSE, mLicense);
} }
if (mDescription != null) {
if (mDescription != null && mDescription.length() > 0) {
props.setProperty(PROP_DESC, mDescription); props.setProperty(PROP_DESC, mDescription);
} }
if (mDescUrl != null) { if (mDescUrl != null && mDescUrl.length() > 0) {
props.setProperty(PROP_DESC_URL, mDescUrl); props.setProperty(PROP_DESC_URL, mDescUrl);
} }
if (mReleaseNote != null && mReleaseNote.length() > 0) {
props.setProperty(PROP_RELEASE_NOTE, mReleaseNote);
}
if (mReleaseUrl != null && mReleaseUrl.length() > 0) {
props.setProperty(PROP_RELEASE_URL, mReleaseUrl);
}
if (mSource != null) { if (mSource != null) {
props.setProperty(PROP_SOURCE_URL, mSource.getUrl()); props.setProperty(PROP_SOURCE_URL, mSource.getUrl());
props.setProperty(PROP_USER_SOURCE, Boolean.toString(mSource.isUserSource())); props.setProperty(PROP_USER_SOURCE, Boolean.toString(mSource.isUserSource()));
@@ -258,6 +281,22 @@ public abstract class Package implements IDescription {
return mDescUrl; return mDescUrl;
} }
/**
* Returns the optional release note for all packages (platform, add-on, tool, doc) or
* for a lib. Can be empty but not null.
*/
public String getReleaseNote() {
return mReleaseNote;
}
/**
* Returns the optional release note URL for all packages (platform, add-on, tool, doc).
* Can be empty but not null.
*/
public String getReleaseNoteUrl() {
return mReleaseUrl;
}
/** /**
* Returns the archives defined in this package. * Returns the archives defined in this package.
* Can be an empty array but not null. * Can be an empty array but not null.
@@ -291,7 +330,31 @@ public abstract class Package implements IDescription {
* Can be empty but not null. * Can be empty but not null.
*/ */
public String getLongDescription() { public String getLongDescription() {
return String.format("%1$s\nRevision %2$d", getDescription(), getRevision()); StringBuilder sb = new StringBuilder();
String s = getDescription();
if (s != null) {
sb.append(s);
}
sb.append(String.format("\nRevision %1$d", getRevision()));
s = getDescUrl();
if (s != null && s.length() > 0) {
sb.append(String.format("\n\nMore information at %1$s", s));
}
s = getReleaseNote();
if (s != null && s.length() > 0) {
sb.append("\n\nRelease note:\n").append(s);
}
s = getReleaseNoteUrl();
if (s != null && s.length() > 0) {
sb.append("\nRelease note URL: ").append(s);
}
return sb.toString();
} }
/** /**

View File

@@ -58,6 +58,10 @@ public class SdkRepository {
public static final String NODE_DESCRIPTION = "description"; //$NON-NLS-1$ public static final String NODE_DESCRIPTION = "description"; //$NON-NLS-1$
/** The optional description URL for all packages (platform, add-on, tool, doc). */ /** The optional description URL for all packages (platform, add-on, tool, doc). */
public static final String NODE_DESC_URL = "desc-url"; //$NON-NLS-1$ public static final String NODE_DESC_URL = "desc-url"; //$NON-NLS-1$
/** The optional release note for all packages (platform, add-on, tool, doc). */
public static final String NODE_RELEASE_NOTE = "release-note"; //$NON-NLS-1$
/** The optional release note URL for all packages (platform, add-on, tool, doc). */
public static final String NODE_RELEASE_URL = "release-url"; //$NON-NLS-1$
/** The version, a string, for platform packages. */ /** The version, a string, for platform packages. */
public static final String NODE_VERSION = "version"; //$NON-NLS-1$ public static final String NODE_VERSION = "version"; //$NON-NLS-1$

View File

@@ -65,6 +65,10 @@
<xsd:element name="description" type="xsd:string" minOccurs="0" /> <xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package --> <!-- The optional description URL of this package -->
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" /> <xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
<!-- The optional release note for this package. -->
<xsd:element name="release-note" type="xsd:string" minOccurs="0" />
<!-- The optional release note URL of this package -->
<xsd:element name="release-url" type="xsd:token" minOccurs="0" />
<!-- A list of file archives for this package. --> <!-- A list of file archives for this package. -->
<xsd:element name="archives" type="sdk:archivesType" /> <xsd:element name="archives" type="sdk:archivesType" />
</xsd:all> </xsd:all>
@@ -99,6 +103,10 @@
<xsd:element name="description" type="xsd:string" minOccurs="0" /> <xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package --> <!-- The optional description URL of this package -->
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" /> <xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
<!-- The optional release note for this package. -->
<xsd:element name="release-note" type="xsd:string" minOccurs="0" />
<!-- The optional release note URL of this package -->
<xsd:element name="release-url" type="xsd:token" minOccurs="0" />
<!-- A list of file archives for this package. --> <!-- A list of file archives for this package. -->
<xsd:element name="archives" type="sdk:archivesType" /> <xsd:element name="archives" type="sdk:archivesType" />
@@ -143,6 +151,10 @@
<xsd:element name="description" type="xsd:string" minOccurs="0" /> <xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package --> <!-- The optional description URL of this package -->
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" /> <xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
<!-- The optional release note for this package. -->
<xsd:element name="release-note" type="xsd:string" minOccurs="0" />
<!-- The optional release note URL of this package -->
<xsd:element name="release-url" type="xsd:token" minOccurs="0" />
<!-- A list of file archives for this package. --> <!-- A list of file archives for this package. -->
<xsd:element name="archives" type="sdk:archivesType" /> <xsd:element name="archives" type="sdk:archivesType" />
</xsd:all> </xsd:all>
@@ -173,6 +185,10 @@
<xsd:element name="description" type="xsd:string" minOccurs="0" /> <xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package --> <!-- The optional description URL of this package -->
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" /> <xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
<!-- The optional release note for this package. -->
<xsd:element name="release-note" type="xsd:string" minOccurs="0" />
<!-- The optional release note URL of this package -->
<xsd:element name="release-url" type="xsd:token" minOccurs="0" />
<!-- A list of file archives for this package. --> <!-- A list of file archives for this package. -->
<xsd:element name="archives" type="sdk:archivesType" /> <xsd:element name="archives" type="sdk:archivesType" />
</xsd:all> </xsd:all>
@@ -219,6 +235,10 @@
<xsd:element name="description" type="xsd:string" minOccurs="0" /> <xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package --> <!-- The optional description URL of this package -->
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" /> <xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
<!-- The optional release note for this package. -->
<xsd:element name="release-note" type="xsd:string" minOccurs="0" />
<!-- The optional release note URL of this package -->
<xsd:element name="release-url" type="xsd:token" minOccurs="0" />
<!-- A list of file archives for this package. --> <!-- A list of file archives for this package. -->
<xsd:element name="archives" type="sdk:archivesType" /> <xsd:element name="archives" type="sdk:archivesType" />
</xsd:all> </xsd:all>

View File

@@ -39,6 +39,10 @@
<sdk:uses-license ref="license1" /> <sdk:uses-license ref="license1" />
<sdk:description>Some optional description</sdk:description> <sdk:description>Some optional description</sdk:description>
<sdk:desc-url>http://www.example.com/platform1.html</sdk:desc-url> <sdk:desc-url>http://www.example.com/platform1.html</sdk:desc-url>
<sdk:release-note>This is an optional release note
for this package. It's a free multi-line text.
</sdk:release-note>
<sdk:release-url>http://some/url/for/the/release/note.html</sdk:release-url>
<!-- The archives node is mandatory and it cannot be empty. --> <!-- The archives node is mandatory and it cannot be empty. -->
<sdk:archives> <sdk:archives>
<sdk:archive os="any"> <sdk:archive os="any">