use of org.platformlayer.core.model.ServiceInfo in project platformlayer by platformlayer.
the class DirectPlatformLayerClient method listServices.
@Override
public Collection<ServiceInfo> listServices(boolean allowCache) throws PlatformLayerClientException {
Collection<ServiceInfo> services = this.services;
if (!allowCache || services == null) {
ServiceInfoCollection serviceInfoCollection = opsSystem.listServices();
services = serviceInfoCollection.services;
this.services = services;
}
return services;
}
use of org.platformlayer.core.model.ServiceInfo in project platformlayer by platformlayer.
the class FederatedPlatformLayerClient method isServiceEnabled.
private static boolean isServiceEnabled(TypedPlatformLayerClient localClient, String namespace) throws PlatformLayerClientException {
Collection<ServiceInfo> services = localClient.listServices(true);
boolean found = false;
for (ServiceInfo service : services) {
if (namespace.equals(service.getNamespace())) {
found = true;
}
}
return found;
}
use of org.platformlayer.core.model.ServiceInfo in project platformlayer by platformlayer.
the class ServiceProviderHelpers method getModelSubclasses.
public <T extends ItemBase> List<ModelClass<? extends T>> getModelSubclasses(Class<T> parent) {
List<ModelClass<? extends T>> modelClasses = Lists.newArrayList();
for (ServiceInfo serviceInfo : serviceProviderDictionary.getAllServices()) {
ServiceType serviceType = new ServiceType(serviceInfo.serviceType);
ServiceProvider serviceProvider = serviceProviderDictionary.getServiceProvider(serviceType);
for (ModelClass<?> modelClass : serviceProvider.getModels().all()) {
Class<?> javaClass = modelClass.getJavaClass();
if (parent.isAssignableFrom(javaClass)) {
modelClasses.add((ModelClass<? extends T>) modelClass);
}
}
}
return modelClasses;
}
Aggregations