@SuppressWarnings("rawtypes") private boolean isEnabled(IRepositoryManager manager, IRepositoryReference reference) { return (manager.contains(reference.getLocation()) && manager.isEnabled(reference.getLocation())) || ((!manager.contains(reference.getLocation())) && ((reference.getOptions() & IRepository.ENABLED) == IRepository.ENABLED)); }
protected Collection<URI> getRepoLocations(IRepositoryManager<T> manager) { Set<URI> locations = new HashSet<URI>(); locations.addAll(Arrays.asList(manager.getKnownRepositories(repositoryFlags))); if (includeDisabledRepos) { locations.addAll(Arrays.asList(manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_DISABLED | repositoryFlags))); } return locations; }
/** * Adds the repository corresponding to the given event to the currently running instance. */ protected void addToSelf(IProvisioningAgent agent, IAgentLocation agentLocation, RepositoryEvent event) { IRepositoryManager<?> manager = getRepositoryManager(agent, event.getRepositoryType()); final URI location = event.getRepositoryLocation(); Preferences node = getRepositoryPreferenceNode(agentLocation, null, location, event.getRepositoryType()); int count = getRepositoryCount(node); if (manager.contains(location)) { // If a user as added a repository we need to set the initial count manually if (count == 0) count = 1; } else { if (manager != null) manager.addRepository(location); } // increment the counter & send to preferences count++; setRepositoryCount(node, count); if (!event.isRepositoryEnabled()) manager.setEnabled(location, false); final String name = event.getRepositoryNickname(); if (name != null) manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, name); }
/** * Removes the repository corresponding to the given event from the currently running instance. */ protected void removeFromSelf(IProvisioningAgent agent, IAgentLocation agentLocation, RepositoryEvent event) { IRepositoryManager<?> manager = getRepositoryManager(agent, event.getRepositoryType()); Preferences node = getRepositoryPreferenceNode(agentLocation, null, event.getRepositoryLocation(), event.getRepositoryType()); int count = getRepositoryCount(node); // modify the repository count before (potentially) removing the preference node setRepositoryCount(node, --count); if (count < 1 && manager != null) manager.removeRepository(event.getRepositoryLocation()); }
/** * Adds the repository corresponding to the given event to the currently running instance. */ protected void addToSelf(IProvisioningAgent agent, IAgentLocation agentLocation, RepositoryEvent event) { IRepositoryManager<?> manager = getRepositoryManager(agent, event.getRepositoryType()); final URI location = event.getRepositoryLocation(); Preferences node = getRepositoryPreferenceNode(agentLocation, null, location, event.getRepositoryType()); int count = getRepositoryCount(node); if (manager.contains(location)) { // If a user as added a repository we need to set the initial count manually if (count == 0) count = 1; } else { if (manager != null) manager.addRepository(location); } // increment the counter & send to preferences count++; setRepositoryCount(node, count); if (!event.isRepositoryEnabled()) manager.setEnabled(location, false); final String name = event.getRepositoryNickname(); if (name != null) manager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, name); }
/** * Removes the repository corresponding to the given event from the currently running instance. */ protected void removeFromSelf(IProvisioningAgent agent, IAgentLocation agentLocation, RepositoryEvent event) { IRepositoryManager<?> manager = getRepositoryManager(agent, event.getRepositoryType()); Preferences node = getRepositoryPreferenceNode(agentLocation, null, event.getRepositoryLocation(), event.getRepositoryType()); int count = getRepositoryCount(node); // modify the repository count before (potentially) removing the preference node setRepositoryCount(node, --count); if (count < 1 && manager != null) manager.removeRepository(event.getRepositoryLocation()); }
@SuppressWarnings("rawtypes") private boolean isEnabled(IRepositoryManager manager, IRepositoryReference reference) { return (manager.contains(reference.getLocation()) && manager.isEnabled(reference.getLocation())) || ((!manager.contains(reference.getLocation())) && ((reference.getOptions() & IRepository.ENABLED) == IRepository.ENABLED)); }