Search in sources :

Example 11 with ServiceInfo

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;
}
Also used : ServiceInfo(org.platformlayer.core.model.ServiceInfo) ServiceInfoCollection(org.platformlayer.core.model.ServiceInfoCollection)

Example 12 with ServiceInfo

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;
}
Also used : ServiceInfo(org.platformlayer.core.model.ServiceInfo)

Example 13 with ServiceInfo

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;
}
Also used : ServiceInfo(org.platformlayer.core.model.ServiceInfo) ModelClass(org.platformlayer.xaas.services.ModelClass) ServiceType(org.platformlayer.ids.ServiceType) ServiceProvider(org.platformlayer.xaas.services.ServiceProvider)

Aggregations

ServiceInfo (org.platformlayer.core.model.ServiceInfo)13 ServiceType (org.platformlayer.ids.ServiceType)6 ItemType (org.platformlayer.ids.ItemType)3 ModelClass (org.platformlayer.xaas.services.ModelClass)3 ServiceProvider (org.platformlayer.xaas.services.ServiceProvider)3 PlatformLayerKey (org.platformlayer.core.model.PlatformLayerKey)2 FederationKey (org.platformlayer.ids.FederationKey)2 Map (java.util.Map)1 JAXBException (javax.xml.bind.JAXBException)1 PlatformLayerClient (org.platformlayer.PlatformLayerClient)1 ServiceInfoCollection (org.platformlayer.core.model.ServiceInfoCollection)1 ManagedItemId (org.platformlayer.ids.ManagedItemId)1 ProjectId (org.platformlayer.ids.ProjectId)1