for (ConnectorConfiguration c : configs) { try { registrationManager.updateRegistration(c.getConnectorId(), c.getContent()); } catch (ConnectorValidationFailedException e) { throw new IllegalStateException(e);
@Override public void forceCreate(ConnectorId id, ConnectorDescription connectorDescription) { validateId(id); checkForExistingServices(id); registrationManager.forceUpdateRegistration(id, connectorDescription); ConnectorConfiguration configuration = new ConnectorConfiguration(id, connectorDescription); try { getConfigPersistence().persist(configuration); } catch (PersistenceException e) { throw new IllegalArgumentException(e); } }
@Override public ConnectorDescription getAttributeValues(ConnectorId id) { try { List<ConnectorConfiguration> list = getConfigPersistence().load(id.toMetaData()); if (list.isEmpty()) { throw new IllegalArgumentException("no connector with metadata: " + id + " found"); } if (list.size() < 1) { LOGGER.error("multiple values found for the same meta-data"); throw new IllegalStateException("multiple connectors with metadata: " + id + " found"); } return list.get(0).getContent(); } catch (PersistenceException e) { throw new RuntimeException(e); } }
@Override public void forceUpdate(ConnectorId id, ConnectorDescription connectorDescription) throws IllegalArgumentException { validateId(id); ConnectorDescription old = getOldConfig(id); registrationManager.forceUpdateRegistration(id, connectorDescription); applyConfigChanges(old, connectorDescription); try { getConfigPersistence().persist(new ConnectorConfiguration(id, connectorDescription)); } catch (PersistenceException e) { throw new RuntimeException(e); } }
private ConnectorDescription getOldConfig(ConnectorId id) { List<ConnectorConfiguration> list; try { list = getConfigPersistence().load(id.toMetaData()); } catch (PersistenceException e) { throw new RuntimeException(e); } if (list.isEmpty()) { throw new IllegalArgumentException("no connector with id " + id + " found"); } if (list.size() > 1) { throw new IllegalStateException("multiple connectors with id " + id + " found"); } return list.get(0).getContent(); }
@Override public void update(ConnectorId id, ConnectorDescription connectorDescpription) throws ConnectorValidationFailedException, IllegalArgumentException { validateId(id); ConnectorDescription old = getOldConfig(id); registrationManager.updateRegistration(id, connectorDescpription); applyConfigChanges(old, connectorDescpription); try { getConfigPersistence().persist(new ConnectorConfiguration(id, connectorDescpription)); } catch (PersistenceException e) { throw new RuntimeException(e); } }
@Override public void create(ConnectorId id, ConnectorDescription connectorDescription) throws ConnectorValidationFailedException { validateId(id); checkForExistingServices(id); addDefaultLocations(id, connectorDescription); registrationManager.updateRegistration(id, connectorDescription); ConnectorConfiguration configuration = new ConnectorConfiguration(id, connectorDescription); try { getConfigPersistence().persist(configuration); } catch (PersistenceException e) { throw new IllegalArgumentException(e); } }