Package com.opengamma.livedata

Examples of com.opengamma.livedata.UserPrincipal


  private String _userName;
 
  //-------------------------------------------------------------------------
  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) throws Exception {
    UserPrincipal sharedUser = UserPrincipal.getLocalUser(getUserName());
    ComponentInfo info = new ComponentInfo(UserPrincipal.class, "shared");
    repo.registerComponent(info, sharedUser);
  }
View Full Code Here


    ImmutableMap<String, Object> callbackMap = ImmutableMap.<String, Object>of("id", requestId, "message", uri.getPath());
    URI errorUri = uriInfo.getAbsolutePathBuilder()
        .path(viewId)
        .path(ViewResource.class, "getErrors")
        .build();
    UserPrincipal ogUserPrincipal = userName != null ? UserPrincipal.getLocalUser(userName) : UserPrincipal.getTestUser();
    _viewManager.createView(viewRequest, clientId, ogUserPrincipal, connection, viewId, callbackMap,
                            portfolioGridUri.getPath(), primitivesGridUri.getPath(), errorUri.getPath());
    return Response.status(Response.Status.CREATED).build();
  }
View Full Code Here

        ImmutableMap.<String, Object>of("id", requestId, "message", uri.getPath());
    URI errorUri = uriInfo.getAbsolutePathBuilder()
        .path(viewId)
        .path("errors")
        .build();
    UserPrincipal ogUserPrincipal = userName != null ? UserPrincipal.getLocalUser(userName) : UserPrincipal.getTestUser();
    _viewManager.createView(viewRequest, clientId, ogUserPrincipal, connection, viewId, callbackMap,
                            portfolioGridUri.getPath(), primitivesGridUri.getPath(), errorUri.getPath());
    return Response.status(Response.Status.CREATED).build();
  }
View Full Code Here

    ViewDefinitionJSONBuilder builder = ViewDefinitionJSONBuilder.INSTANCE;
    return builder.toJSON(getBlankView());
  }

  private static ViewDefinition getBlankView() {
    ViewDefinition blank = new ViewDefinition("Untitled", new UserPrincipal("", ""));
    blank.setDefaultCurrency(Currency.GBP);
    blank.setMaxDeltaCalculationPeriod(0L);
    blank.setMaxFullCalculationPeriod(0L);
    blank.setMinDeltaCalculationPeriod(0L);
    blank.setMinFullCalculationPeriod(0L);
View Full Code Here

  }

  //-------------------------------------------------------------------------
  @Test(enabled = false)
  public void entitled() throws Exception {
    UserPrincipal user = new UserPrincipal("6926421", InetAddress.getLocalHost().getHostAddress());
    assertTrue(_entitlementChecker.isEntitled(user, DIST_SPEC.getFullyQualifiedLiveDataSpecification()));
  }
View Full Code Here

    assertTrue(_entitlementChecker.isEntitled(user, DIST_SPEC.getFullyQualifiedLiveDataSpecification()));
  }

  @Test(enabled = false)
  public void notEntitled() {
    UserPrincipal user = new UserPrincipal("impostor", "127.0.0.1");
    assertFalse(_entitlementChecker.isEntitled(user, DIST_SPEC.getFullyQualifiedLiveDataSpecification()));
  }
View Full Code Here

   * @return the resolved object
   */
  private UserPrincipal ensureUserNameNonEmpty(UserPrincipal userPrincipal) {
    String userName = userPrincipal.getUserName();
    if (userName == null || "".equals(userName)) {
      UserPrincipal testUser = UserPrincipal.getTestUser();
      s_logger.info("UserName undefined for {}. Will use test user {} instead.", userPrincipal, UserPrincipal.getTestUser());
      return testUser;
    } else {
      return userPrincipal;
    }
View Full Code Here

    // [PLAT-1158] The notifications are performed outside of holding the lock which avoids the deadlock problem, but we'll still block
    // for completion which was the thing PLAT-1158 was trying to avoid. This is because the contracts for the order in which
    // notifications can be received is unclear and I don't want to risk introducing a change at this moment in time.
    for (final ViewResultListener listener : listeners) {
      try {
        final UserPrincipal listenerUser = listener.getUser();
        final boolean hasMarketDataPermissions = permissionProvider.checkMarketDataPermissions(listenerUser, marketData).isEmpty();
        listener.viewDefinitionCompiled(compiledViewDefinition, hasMarketDataPermissions);
      } catch (final Exception e) {
        logListenerError(listener, e);
      }
View Full Code Here

  public ViewDefinition buildObject(FudgeDeserializer deserializer, FudgeMsg message) {
   
    final FudgeField portfolioIdField = message.getByName(PORTFOLIO_ID_FIELD);
    final UniqueId portfolioId = portfolioIdField == null ? null : deserializer.fieldValueToObject(UniqueId.class, portfolioIdField);
    final String name = message.getFieldValue(String.class, message.getByName(NAME_FIELD));
    final UserPrincipal user = deserializer.fieldValueToObject(UserPrincipal.class, message.getByName(USER_FIELD));
    final ResultModelDefinition model = deserializer.fieldValueToObject(ResultModelDefinition.class, message.getByName(RESULT_MODEL_DEFINITION_FIELD));
    ViewDefinition viewDefinition = new ViewDefinition(
        name,
        portfolioId,
        user,
View Full Code Here

TOP

Related Classes of com.opengamma.livedata.UserPrincipal

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.