public static ModelVersion fromString(String versionString) { if (versionString == null) { throw new IllegalArgumentException("Cannot parse null"); } final Matcher matcher = MODEL_VERSION_PATTERN.matcher(versionString); if (!matcher.matches()) { throw new IllegalArgumentException(String.format("Could not parse model version string '%s'", versionString)); } return new ModelVersion(Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2))); }
new ModelVersion(BrokerModel.MODEL_MAJOR_VERSION, BrokerModel.MODEL_MINOR_VERSION); ModelVersion storedVersion = getStoredVersion();
new ModelVersion(BrokerModel.MODEL_MAJOR_VERSION, BrokerModel.MODEL_MINOR_VERSION); if (currentVersion.lessThan(storedVersion))
@Override protected Collection<LinkDefinition<Source, Target>> doOpenAndLoad(final LinkStoreUpdater updater) throws StoreException { Collection<LinkDefinition<Source, Target>> linkDefinitions; try { checkTransactionIsolationLevel(); createOrOpenStoreDatabase(); linkDefinitions = getLinks(); ModelVersion storedVersion = getStoredVersion(); ModelVersion currentVersion = new ModelVersion(BrokerModel.MODEL_MAJOR_VERSION, BrokerModel.MODEL_MINOR_VERSION); if (storedVersion.lessThan(currentVersion)) { linkDefinitions = performUpdate(updater, linkDefinitions, storedVersion, currentVersion); } else if (currentVersion.lessThan(storedVersion)) { throw new StoreException(String.format("Cannot downgrade the store from %s to %s", storedVersion, currentVersion)); } } catch (SQLException e) { throw new StoreException("Cannot open link store", e); } return linkDefinitions; }
new ModelVersion(BrokerModel.MODEL_MAJOR_VERSION, BrokerModel.MODEL_MINOR_VERSION); ModelVersion storedVersion = getStoredVersion(); if (currentVersion.lessThan(storedVersion))