Sha256: 4d06dc8a43ccf6e3e8490ca41d1aeac0e464e99f137349f2b0e55586c0088440
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
/** * Sencha GXT 3.1.1 - Sencha for GWT * Copyright(c) 2007-2014, Sencha, Inc. * licensing@sencha.com * * http://www.sencha.com/products/gxt/license/ */ package com.dldinternet.aws.cfn.stacker.desktopapp.client.servicebus; import java.util.HashMap; public class ServiceBus { private HashMap<Object, Object> serviceProviders = new HashMap<Object, Object>(); public ServiceBus() { } @SuppressWarnings("unchecked") public <T extends ServiceRequest> T invoke(T serviceRequest) { ServiceProvider<T> serviceProvider = (ServiceProvider<T>) serviceProviders.get(serviceRequest.getClass()); if (serviceProvider == null) { throw new IllegalStateException("No service provider, serviceRequest=" + serviceRequest.getClass().getName()); } serviceProvider.onServiceRequest(serviceRequest); return serviceRequest; // for one step access to getters } public <T extends ServiceRequest> void registerServiceProvider(Class<T> serviceRequestClass, ServiceProvider<T> serviceProvider) { Object previousServiceProvider = serviceProviders.put(serviceRequestClass, serviceProvider); if (previousServiceProvider != null) { throw new IllegalStateException("Provider already defined, serviceRequest=" + serviceRequestClass.getName() + ", serviceProvider=" + serviceProvider.getClass().getName()); } } public <T extends ServiceRequest> void removeServiceProvider(Class<T> serviceRequestClass) { serviceProviders.remove(serviceRequestClass); } }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aws-cfn-stacker-0.0.6 | ui/src/com/dldinternet/aws/cfn/stacker/desktopapp/client/servicebus/ServiceBus.java |