for (Contract contract : application.getContracts()) { String svcKey = getServiceKey(contract.getServiceOrgId(), contract.getServiceId(), contract.getServiceVersion()); ServiceContract sc = new ServiceContract(contract.getApiKey(), services.get(svcKey), application, contract.getPolicies());
/** * @see io.apiman.gateway.engine.IRegistry#unregisterApplication(io.apiman.gateway.engine.beans.Application, io.apiman.gateway.engine.async.IAsyncResultHandler) */ @Override public synchronized void unregisterApplication(Application application, IAsyncResultHandler<Void> handler) { try { String applicationKey = getApplicationKey(application); if (applications.containsKey(applicationKey)) { Application removed = applications.remove(applicationKey); for (Contract contract : removed.getContracts()) { if (contracts.containsKey(contract.getApiKey())) { contracts.remove(contract.getApiKey()); } } } else { throw new RegistrationException(Messages.i18n.format("InMemoryRegistry.AppNotFound")); //$NON-NLS-1$ } save(); handler.handle(AsyncResultImpl.create((Void) null)); } catch (Throwable t) { handler.handle(AsyncResultImpl.create(t, Void.class)); } }
try { for (Contract contract : application.getContracts()) { if (contracts.containsKey(contract.getApiKey())) { throw new RegistrationException(Messages.i18n.format("InMemoryRegistry.ContractAlreadyPublished", //$NON-NLS-1$ for (Contract contract : application.getContracts()) { String svcKey = getServiceKey(contract.getServiceOrgId(), contract.getServiceId(), contract.getServiceVersion()); ServiceContract sc = new ServiceContract(contract.getApiKey(), services.get(svcKey), application, contract.getPolicies());