Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 125547 Details for
Bug 259598
[repo] repo manager should favor client-settable repo name
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Add support for nicknames on repositories
patch.txt (text/plain), 8.36 KB, created by
John Arthorne
on 2009-02-12 13:19:47 EST
(
hide
)
Description:
Add support for nicknames on repositories
Filename:
MIME Type:
Creator:
John Arthorne
Created:
2009-02-12 13:19:47 EST
Size:
8.36 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.tests >Index: src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java,v >retrieving revision 1.13 >diff -u -r1.13 ArtifactRepositoryManagerTest.java >--- src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java 3 Dec 2008 15:31:55 -0000 1.13 >+++ src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryManagerTest.java 12 Feb 2009 18:19:25 -0000 >@@ -129,6 +129,28 @@ > assertTrue("1.0", manager.contains(location)); > } > >+ public void testNickname() throws ProvisionException { >+ File site = getTestData("Repository", "/testData/artifactRepo/simple/"); >+ URI location = site.toURI(); >+ manager.addRepository(location); >+ String nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME); >+ assertNull(nick); >+ nick = "Nick"; >+ manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, nick); >+ nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME); >+ assertEquals("Nick", nick); >+ //ensure loading the repository doesn't affect the nickname >+ manager.loadRepository(location, getMonitor()); >+ nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME); >+ assertEquals("Nick", nick); >+ >+ //remove and re-add the repository should lose the nickname >+ manager.removeRepository(location); >+ manager.loadRepository(location, getMonitor()); >+ nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME); >+ assertNull(nick); >+ } >+ > public void testPathWithSpaces() { > File site = getTestData("Repository", "/testData/artifactRepo/simple with spaces/"); > URI location = site.toURI(); >Index: src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java,v >retrieving revision 1.27 >diff -u -r1.27 MetadataRepositoryManagerTest.java >--- src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java 11 Feb 2009 22:28:05 -0000 1.27 >+++ src/org/eclipse/equinox/p2/tests/metadata/repository/MetadataRepositoryManagerTest.java 12 Feb 2009 18:19:25 -0000 >@@ -311,6 +311,28 @@ > cacheFile.delete(); > } > >+ public void testNickname() throws ProvisionException { >+ File site = getTestData("Repositoy", "/testData/metadataRepo/good/"); >+ URI location = site.toURI(); >+ manager.addRepository(location); >+ String nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME); >+ assertNull(nick); >+ nick = "Nick"; >+ manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, nick); >+ nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME); >+ assertEquals("Nick", nick); >+ //ensure loading the repository doesn't affect the nickname >+ manager.loadRepository(location, getMonitor()); >+ nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME); >+ assertEquals("Nick", nick); >+ >+ //remove and re-add the repository should lose the nickname >+ manager.removeRepository(location); >+ manager.loadRepository(location, getMonitor()); >+ nick = manager.getRepositoryProperty(location, IRepository.PROP_NICKNAME); >+ assertNull(nick); >+ } >+ > public void testPathWithSpaces() { > File site = getTestData("Repository", "/testData/metadataRepo/good with spaces/"); > URI location = site.toURI(); >#P org.eclipse.equinox.p2.core >Index: src/org/eclipse/equinox/internal/provisional/p2/core/repository/IRepository.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/provisional/p2/core/repository/IRepository.java,v >retrieving revision 1.9 >diff -u -r1.9 IRepository.java >--- src/org/eclipse/equinox/internal/provisional/p2/core/repository/IRepository.java 9 Oct 2008 03:22:18 -0000 1.9 >+++ src/org/eclipse/equinox/internal/provisional/p2/core/repository/IRepository.java 12 Feb 2009 18:19:26 -0000 >@@ -42,6 +42,13 @@ > public static final String PROP_NAME = "name"; //$NON-NLS-1$ > > /** >+ * The key for a string property providing a user-defined name for the repository. >+ * This property is never stored in the repository itself, but is instead tracked and managed >+ * by an {@link IRepositoryManager}. >+ */ >+ public static final String PROP_NICKNAME = "p2.nickname"; //$NON-NLS-1$ >+ >+ /** > * The key for a string property providing a human-readable description for the repository. > */ > public static final String PROP_DESCRIPTION = "description"; //$NON-NLS-1$ >Index: src/org/eclipse/equinox/internal/p2/core/helpers/AbstractRepositoryManager.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/AbstractRepositoryManager.java,v >retrieving revision 1.16 >diff -u -r1.16 AbstractRepositoryManager.java >--- src/org/eclipse/equinox/internal/p2/core/helpers/AbstractRepositoryManager.java 11 Feb 2009 22:44:23 -0000 1.16 >+++ src/org/eclipse/equinox/internal/p2/core/helpers/AbstractRepositoryManager.java 12 Feb 2009 18:19:26 -0000 >@@ -34,6 +34,7 @@ > public boolean isSystem = false; > public URI location; > public String name; >+ public String nickname; > public SoftReference repository; > public String suffix; > >@@ -48,6 +49,7 @@ > public static final String KEY_DESCRIPTION = "description"; //$NON-NLS-1$ > public static final String KEY_ENABLED = "enabled"; //$NON-NLS-1$ > public static final String KEY_NAME = "name"; //$NON-NLS-1$ >+ public static final String KEY_NICKNAME = "nickname"; //$NON-NLS-1$ > public static final String KEY_PROVIDER = "provider"; //$NON-NLS-1$ > public static final String KEY_SUFFIX = "suffix"; //$NON-NLS-1$ > public static final String KEY_SYSTEM = "isSystem"; //$NON-NLS-1$ >@@ -491,10 +493,12 @@ > return null;// Repository not found > if (IRepository.PROP_DESCRIPTION.equals(key)) > return info.description; >- if (IRepository.PROP_NAME.equals(key)) >+ else if (IRepository.PROP_NAME.equals(key)) > return info.name; >- if (IRepository.PROP_SYSTEM.equals(key)) >+ else if (IRepository.PROP_SYSTEM.equals(key)) > return Boolean.toString(info.isSystem); >+ else if (IRepository.PROP_NICKNAME.equals(key)) >+ return info.nickname; > // Key not known, return null > return null; > } >@@ -512,10 +516,12 @@ > return;// Repository not found > if (IRepository.PROP_DESCRIPTION.equals(key)) > info.description = value; >- if (IRepository.PROP_NAME.equals(key)) >+ else if (IRepository.PROP_NAME.equals(key)) > info.name = value; >- if (IRepository.PROP_SYSTEM.equals(key)) >- //only true is value.equals("true") which is OK because a repository is only system if it's explicitly set to system. >+ else if (IRepository.PROP_NICKNAME.equals(key)) >+ info.nickname = value; >+ else if (IRepository.PROP_SYSTEM.equals(key)) >+ //only true if value.equals("true") which is OK because a repository is only system if it's explicitly set to system. > info.isSystem = Boolean.valueOf(value).booleanValue(); > // Key not known > } >@@ -712,6 +718,7 @@ > changed |= putValue(node, KEY_SYSTEM, Boolean.toString(info.isSystem)); > changed |= putValue(node, KEY_DESCRIPTION, info.description); > changed |= putValue(node, KEY_NAME, info.name); >+ changed |= putValue(node, KEY_NICKNAME, info.nickname); > changed |= putValue(node, KEY_SUFFIX, info.suffix); > changed |= putValue(node, KEY_ENABLED, Boolean.toString(info.isEnabled)); > if (changed && flush) >@@ -788,6 +795,7 @@ > RepositoryInfo info = new RepositoryInfo(); > info.location = location; > info.name = child.get(KEY_NAME, null); >+ info.nickname = child.get(KEY_NICKNAME, null); > info.description = child.get(KEY_DESCRIPTION, null); > info.isSystem = child.getBoolean(KEY_SYSTEM, false); > info.isEnabled = child.getBoolean(KEY_ENABLED, true);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 259598
: 125547 |
125588