/** * {@inheritDoc} */ @Override public final void connect(final String reponame, final AbstractRepository repository) throws AnalysisConfigurationException { if (this.state != STATE.READY) { throw new AnalysisConfigurationException("Plugin: " + this.getClass().getName() + " final not in " + STATE.READY + " this.state, but final in state " + this.state + "."); } final RepositoryPort port = this.repositoryPorts.get(reponame); if (port == null) { throw new AnalysisConfigurationException("Failed to connect plugin '" + this.getName() + "' (" + this.getPluginName() + ") to repository '" + repository.getName() + "' (" + repository.getRepositoryName() + "). Unknown repository port: " + reponame); } final Class<? extends AbstractRepository> repositoryType = port.repositoryType(); if (!repositoryType.isAssignableFrom(repository.getClass())) { throw new AnalysisConfigurationException("Failed to connect plugin '" + this.getName() + "' (" + this.getPluginName() + ") to repository '" + repository.getName() + "' (" + repository.getRepositoryName() + "). Expected RepositoryType: " + repositoryType.getName() + " Found: " + repository.getClass().getName()); } synchronized (this) { if (this.registeredRepositories.containsKey(reponame)) { throw new AnalysisConfigurationException("Failed to connect plugin '" + this.getName() + "' (" + this.getPluginName() + ") to repository '" + repository.getName() + "' (" + repository.getRepositoryName() + "). RepositoryPort already connected: " + reponame); } this.registeredRepositories.put(reponame, repository); } }
/** * {@inheritDoc} */ @Override public final void connect(final String reponame, final AbstractRepository repository) throws AnalysisConfigurationException { if (this.state != STATE.READY) { throw new AnalysisConfigurationException("Plugin: " + this.getClass().getName() + " final not in " + STATE.READY + " this.state, but final in state " + this.state + "."); } final RepositoryPort port = this.repositoryPorts.get(reponame); if (port == null) { throw new AnalysisConfigurationException("Failed to connect plugin '" + this.getName() + "' (" + this.getPluginName() + ") to repository '" + repository.getName() + "' (" + repository.getRepositoryName() + "). Unknown repository port: " + reponame); } final Class<? extends AbstractRepository> repositoryType = port.repositoryType(); if (!repositoryType.isAssignableFrom(repository.getClass())) { throw new AnalysisConfigurationException("Failed to connect plugin '" + this.getName() + "' (" + this.getPluginName() + ") to repository '" + repository.getName() + "' (" + repository.getRepositoryName() + "). Expected RepositoryType: " + repositoryType.getName() + " Found: " + repository.getClass().getName()); } synchronized (this) { if (this.registeredRepositories.containsKey(reponame)) { throw new AnalysisConfigurationException("Failed to connect plugin '" + this.getName() + "' (" + this.getPluginName() + ") to repository '" + repository.getName() + "' (" + repository.getRepositoryName() + "). RepositoryPort already connected: " + reponame); } this.registeredRepositories.put(reponame, repository); } }