return type.cast(result);
}
private void loadRepository(IProvisioningAgent agent) throws CoreException
{
IMetadataRepositoryManager repositoryManager = (IMetadataRepositoryManager) agent
.getService(IMetadataRepositoryManager.SERVICE_NAME);
IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) agent
.getService(IArtifactRepositoryManager.SERVICE_NAME);
// first: remove existing repositories (preferences might have changed)
for (URI r : repositoryManager.getKnownRepositories(IMetadataRepositoryManager.REPOSITORIES_ALL))
repositoryManager.removeRepository(r);
for (URI r : artifactManager.getKnownRepositories(IArtifactRepositoryManager.REPOSITORIES_ALL))
artifactManager.removeRepository(r);
// second: add repository as configured in preferences
try
{
String updateSite = PortfolioPlugin.getDefault().getPreferenceStore()
.getString(PortfolioPlugin.Preferences.UPDATE_SITE);
URI repoLocation = new URI(updateSite);
repositoryManager.loadRepository(repoLocation, null);
artifactManager.loadRepository(repoLocation, null);
}
catch (URISyntaxException e)
{
IStatus status = new Status(IStatus.ERROR, PortfolioPlugin.PLUGIN_ID, e.getMessage(), e);