use of com.alibaba.dubbo.registry.common.domain.Provider in project dubbo by alibaba.
the class Versions method show.
public void show(Long[] ids, Map<String, Object> context) {
String version = (String) context.get("version");
if (version != null && version.length() > 0) {
List<Provider> providers = providerService.findAll();
List<Consumer> consumers = consumerService.findAll();
Set<String> parametersSet = new HashSet<String>();
Set<String> applications = new HashSet<String>();
for (Provider provider : providers) {
parametersSet.add(provider.getParameters());
}
for (Consumer consumer : consumers) {
parametersSet.add(consumer.getParameters());
}
Iterator<String> temp = parametersSet.iterator();
while (temp.hasNext()) {
Map<String, String> parameter = StringUtils.parseQueryString(temp.next());
if (parameter != null) {
String dubbo = parameter.get("dubbo");
if (dubbo == null)
dubbo = "0.0.0";
String application = parameter.get("application");
if (version.equals(dubbo)) {
applications.add(application);
}
}
}
context.put("applications", applications);
}
}
use of com.alibaba.dubbo.registry.common.domain.Provider in project dubbo by alibaba.
the class Unregisterall method doExecute.
protected String doExecute(Map<String, Object> context) throws Exception {
String address = request.getParameter("provider");
if (address == null || address.length() == 0) {
address = request.getParameter("client");
}
if (address == null || address.length() == 0) {
throw new IllegalArgumentException("The url provider parameter is null! Usage: " + request.getRequestURL().toString() + "?provider=" + operatorAddress);
}
List<Provider> providers = providerService.findByAddress(address);
if (providers != null && providers.size() > 0) {
for (Provider provider : providers) {
if (!currentUser.hasServicePrivilege(provider.getService())) {
throw new IllegalStateException("The user " + currentUser + " have no privilege of service " + provider.getService());
}
}
for (Provider provider : providers) {
provider.setUsername(operator);
provider.setOperatorAddress(operatorAddress);
providerService.deleteStaticProvider(provider.getId());
}
}
return "Unregister " + (providers == null ? 0 : providers.size()) + " services.";
}
Aggregations