Package com.opengamma.master.config

Examples of com.opengamma.master.config.ConfigDocument


  //-------------------------------------------------------------------------
  @GET
  public Response get(@QueryParam("versionAsOf") String versionAsOf, @QueryParam("correctedTo") String correctedTo) {
    VersionCorrection vc = VersionCorrection.parse(versionAsOf, correctedTo);
    ConfigDocument result = getConfigMaster().get(getUrlConfigId(), vc);
    return responseOkFudge(result);
  }
View Full Code Here


  @POST
  public Response update(@Context UriInfo uriInfo, ConfigDocument request) {
    if (getUrlConfigId().equals(request.getUniqueId().getObjectId()) == false) {
      throw new IllegalArgumentException("Document objectId does not match URI");
    }
    ConfigDocument result = getConfigMaster().update(request);
    URI uri = uriVersion(uriInfo.getBaseUri(), result.getUniqueId());
    return responseCreatedFudge(uri, result);
  }
View Full Code Here

  @GET
  @Path("versions/{versionId}")
  public Response getVersioned(@PathParam("versionId") String versionId) {
    UniqueId uniqueId = getUrlConfigId().atVersion(versionId);
    ConfigDocument result = getConfigMaster().get(uniqueId);
    return responseOkFudge(result);
  }
View Full Code Here

  public Response correct(@Context UriInfo uriInfo, @PathParam("versionId") String versionId, ConfigDocument document) {
    UniqueId uniqueId = getUrlConfigId().atVersion(versionId);
    if (!uniqueId.equals(document.getUniqueId())) {
      throw new IllegalArgumentException("Document uniqueId does not match URI");
    }
    ConfigDocument result = getConfigMaster().correct(document);
    URI uri = uriVersion(uriInfo.getBaseUri(), result.getUniqueId());
    return responseCreatedFudge(uri, result);
  }
View Full Code Here

    ArgumentChecker.notNull(clazz, "clazz");
    ArgumentChecker.notNull(uniqueId, "uniqueId");

    final Element element = _configCache.get(uniqueId);
    if (element != null) {
      final ConfigDocument doc = (ConfigDocument) EHCacheUtils.get(element);
      if (doc != null) {
        return (R) doc.getConfig().getValue();
      } else {
        return null;
      }
    }
    try {
      final ConfigDocument doc = getMaster().get(uniqueId);
      putValue(uniqueId.getObjectId(), doc, _configCache);
      return (R) putValue(uniqueId, doc, _configCache).getConfig().getValue();
    } catch (final RuntimeException ex) {
      return EHCacheUtils.<R>putException(uniqueId, ex, _configCache);
    }
View Full Code Here

    ArgumentChecker.notNull(versionCorrection, "versionCorrection");

    final Object searchKey = Arrays.asList(clazz, objectId, versionCorrection);
    final Element element = _configCache.get(searchKey);
    if (element != null) {
      final ConfigDocument doc = (ConfigDocument) EHCacheUtils.get(element);
      if (doc != null) {
        return (R) doc.getConfig().getValue();
      } else {
        return null;
      }
    }
    try {
      final ConfigDocument doc = getMaster().get(objectId, versionCorrection);
      final ConfigItem<R> item = (ConfigItem<R>) doc.getConfig();
      putValue(item.getUniqueId().getObjectId(), doc, _configCache);
      putValue(item.getUniqueId(), doc, _configCache);
      return (R) putValue(searchKey, doc, _configCache).getConfig().getValue();
    } catch (final RuntimeException ex) {
      return EHCacheUtils.<R>putException(searchKey, ex, _configCache);
View Full Code Here

    ArgumentChecker.notNull(versionCorrection, "versionCorrection");

    final Object searchKey = Arrays.asList("single", clazz, configName, versionCorrection);
    final Element element = _configCache.get(searchKey);
    if (element != null) {
      final ConfigDocument doc = (ConfigDocument) EHCacheUtils.get(element);
      if (doc != null) {
        return (R) doc.getConfig().getValue();
      } else {
        return null;
      }
    }
    try {
      final ConfigSearchRequest<R> searchRequest = new ConfigSearchRequest<R>(clazz);
      searchRequest.setName(configName);
      searchRequest.setVersionCorrection(versionCorrection);
      final ConfigDocument doc = getMaster().search(searchRequest).getFirstDocument();
      putValue(searchKey, doc, _configCache);
      if (doc != null) {
        putValue(doc.getUniqueId().getObjectId(), doc, _configCache);
        putValue(doc.getUniqueId(), doc, _configCache);
        return (R) doc.getConfig().getValue();
      } else {
        return null;
      }
    } catch (final RuntimeException ex) {
      return EHCacheUtils.<R>putException(searchKey, ex, _configCache);
View Full Code Here

TOP

Related Classes of com.opengamma.master.config.ConfigDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.