@Override public String getValue(EndpointProfileDto item) { return item.getClientProfileVersion() + ""; } }, 80);
private EndpointProfileDataDto convert(EndpointProfileDto profileDto) { return new EndpointProfileDataDto( profileDto.getId(), endpointKey, profileDto.getClientProfileVersion(), profileDto.getClientProfileBody(), profileDto.getServerProfileVersion(), profileDto.getServerProfileBody()); }
@Override public boolean matches(String appToken, String profileFilterId, EndpointProfileDto profile) { AppProfileVersionsKey key = new AppProfileVersionsKey( appToken, profile.getClientProfileVersion(), profile.getServerProfileVersion()); String endpointProfileSchemaBody = getEndpointProfileSchemaBody(key); String serverProfileSchemaBody = getServerProfileSchemaBody(key); FilterEvaluator filterEvaluator = new DefaultFilterEvaluator(); filterEvaluator.init(profile, endpointProfileSchemaBody, serverProfileSchemaBody); ProfileFilterDto filter = cacheService.getFilter(profileFilterId); LOG.trace("matching profile body with filter [{}]: {}", filter.getId(), filter.getBody()); return checkFilter(filterEvaluator, filter); }
@Override public HistoryDelta getDelta(EndpointProfileDto profile, String applicationToken, int curAppSeqNumber) { String endpointId = Base64Util.encode(profile); ConfigurationIdKey confIdKey = new ConfigurationIdKey( applicationToken, curAppSeqNumber, profile.getConfigurationVersion()); AppProfileVersionsKey appVersionsKey = new AppProfileVersionsKey( applicationToken, profile.getClientProfileVersion(), profile.getServerProfileVersion()); List<ProfileFilterDto> filters = filterService.getAllMatchingFilters(appVersionsKey, profile); LOG.debug("[{}] Found {} matching filters", endpointId, filters.size()); List<EndpointGroupStateDto> result = new ArrayList<>(1 + filters.size()); EndpointGroupDto groupDto = cacheService.getDefaultGroup(applicationToken); EndpointGroupStateDto groupAllState = new EndpointGroupStateDto(); groupAllState.setEndpointGroupId(groupDto.getId()); groupAllState.setConfigurationId(cacheService.getConfIdByKey( confIdKey.copyWithNewEgId(groupDto.getId()))); result.add(groupAllState); for (ProfileFilterDto filter : filters) { String confId = cacheService.getConfIdByKey( confIdKey.copyWithNewEgId(filter.getEndpointGroupId())); EndpointGroupStateDto endpointGroupState = new EndpointGroupStateDto(); endpointGroupState.setEndpointGroupId(filter.getEndpointGroupId()); endpointGroupState.setProfileFilterId(filter.getId()); endpointGroupState.setConfigurationId(confId); result.add(endpointGroupState); } return new HistoryDelta(result, true, true, true); }
profile.getClientProfileVersion(), profile.getServerProfileVersion()); ConfigurationIdKey confIdKey = new ConfigurationIdKey( applicationToken, curAppSeqNumber, profile.getConfigurationVersion());
@Override public EndpointProfileBodyDto findBodyByKeyHash(byte[] endpointKeyHash) { LOG.debug("Find endpoint profile body by endpoint key hash [{}] ", endpointKeyHash); EndpointProfileBodyDto endpointProfileBodyDto = null; Query query = Query.query(where(EP_ENDPOINT_KEY_HASH).is(endpointKeyHash)); query.fields() .include(DaoConstants.PROFILE) .include(EP_SERVER_PROFILE_PROPERTY) .include(EP_APPLICATION_ID) .include(EP_PROFILE_VERSION) .include(EP_SERVER_PROFILE_VERSION_PROPERTY) .include(EP_USE_RAW_SCHEMA); EndpointProfileDto pf = mongoTemplate.findOne(query, getDocumentClass()).toDto(); if (pf != null) { endpointProfileBodyDto = new EndpointProfileBodyDto( endpointKeyHash, pf.getClientProfileBody(), pf.getServerProfileBody(), pf.getClientProfileVersion(), pf.getServerProfileVersion(), pf.getApplicationId()); } LOG.debug("[{}] Found client-side endpoint profile body {} with client-side endpoint " + "profile version {} and server-side endpoint profile body {} " + "with server-side endpoint profile version {} and application id {}", endpointKeyHash, pf.getClientProfileBody(), pf.getServerProfileBody(), pf.getClientProfileVersion(), pf.getServerProfileVersion(), pf.getApplicationId()); return endpointProfileBodyDto; }
ep.getClientProfileBody(), ep.getServerProfileBody(), ep.getClientProfileVersion(), ep.getServerProfileVersion(), ep.getApplicationId());
controlService.getProfileSchemaByApplicationIdAndVersion( endpointProfile.getApplicationId(), endpointProfile.getClientProfileVersion()); ServerProfileSchemaDto serverProfileSchema = controlService.getServerProfileSchemaByApplicationIdAndVersion(
(DBObject) JSON.parse(dto.getClientProfileBody())); this.profileHash = dto.getProfileHash(); this.profileVersion = dto.getClientProfileVersion(); this.serverProfileVersion = dto.getServerProfileVersion(); this.configurationHash = dto.getConfigurationHash();
this.profile = dto.getClientProfileBody(); this.profileHash = getByteBuffer(dto.getProfileHash()); this.profileVersion = dto.getClientProfileVersion(); this.serverProfileVersion = dto.getServerProfileVersion(); this.configurationHash = getByteBuffer(dto.getConfigurationHash());