use of org.platformlayer.core.model.ItemBase in project platformlayer by platformlayer.
the class MetricsResource method listMetrics.
@GET
@Produces({ XML, JSON })
public MetricInfoCollection listMetrics() throws OpsException, RepositoryException {
final ItemBase managedItem = getManagedItem();
final ServiceProvider serviceProvider = getServiceProvider();
OpsContextBuilder opsContextBuilder = objectInjector.getInstance(OpsContextBuilder.class);
final OpsContext opsContext = opsContextBuilder.buildTemporaryOpsContext(getServiceType(), getProjectAuthorization());
return OpsContext.runInContext(opsContext, new CheckedCallable<MetricInfoCollection, Exception>() {
@Override
public MetricInfoCollection call() throws Exception {
BindingScope bindingScope = BindingScope.push(managedItem, managedItem);
try {
Object controller = serviceProvider.getController(managedItem);
MetricConfig metricConfig = opsContext.getMetricInfo(controller);
return MetricCollector.toMetricInfo(metricConfig);
} finally {
bindingScope.pop();
}
}
});
}
use of org.platformlayer.core.model.ItemBase in project platformlayer by platformlayer.
the class ItemServiceImpl method findRoots.
@Override
public List<ItemBase> findRoots(ProjectAuthorization authentication) throws OpsException {
ProjectId project = getProjectId(authentication);
boolean fetchTags = true;
List<ItemBase> items;
try {
items = repository.findRoots(project, fetchTags, SecretProvider.from(authentication));
} catch (RepositoryException e) {
throw new OpsException("Error reading objects from database", e);
}
return items;
}
use of org.platformlayer.core.model.ItemBase in project platformlayer by platformlayer.
the class ItemServiceImpl method listAll.
@Override
public List<ItemBase> listAll(ProjectAuthorization authentication, Filter filter) throws OpsException {
ProjectId project = getProjectId(authentication);
List<ItemBase> items;
try {
items = repository.listAll(project, filter, SecretProvider.from(authentication));
} catch (RepositoryException e) {
throw new OpsException("Error reading objects from database", e);
}
return items;
}
use of org.platformlayer.core.model.ItemBase in project platformlayer by platformlayer.
the class TagsResource method listTags.
@GET
@Produces({ XML, JSON })
public Tags listTags() throws RepositoryException {
boolean fetchTags = true;
ItemBase managedItem = getManagedItem(fetchTags);
Tags tags = managedItem.getTags();
cleanup(tags);
return tags;
}
use of org.platformlayer.core.model.ItemBase in project platformlayer by platformlayer.
the class XaasResourceBase method getManagedItem.
protected ItemBase getManagedItem(boolean fetchTags) throws RepositoryException {
PlatformLayerKey modelKey = getPlatformLayerKey();
ItemBase managedItem = repository.getManagedItem(modelKey, fetchTags, getSecretProvider());
if (managedItem == null) {
raiseNotFound();
}
return managedItem;
}
Aggregations