Fixed context cache renew
This commit is contained in:
parent
88ef977959
commit
179013ec5b
|
@ -107,37 +107,49 @@ public class ResourceRegistryPublisherImpl extends BaseRequestInfo implements Re
|
|||
|
||||
private void addHierarchicalMode(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||
if(hierarchicalMode) {
|
||||
queryParams.put(AccessPath.HIERARCHICAL_MODE_QUERY_PARAMETER, Boolean.toString(hierarchicalMode));
|
||||
queryParams.put(InstancePath.HIERARCHICAL_MODE_QUERY_PARAMETER, Boolean.toString(hierarchicalMode));
|
||||
}
|
||||
}
|
||||
|
||||
private void addIncludeContexts(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||
if(includeContexts) {
|
||||
queryParams.put(AccessPath.INCLUDE_CONTEXTS_QUERY_PARAMETER, Boolean.toString(includeContexts));
|
||||
queryParams.put(InstancePath.INCLUDE_CONTEXTS_QUERY_PARAMETER, Boolean.toString(includeContexts));
|
||||
}
|
||||
}
|
||||
|
||||
private void addIncludeMeta(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||
addIncludeMeta(queryParams, includeMeta);
|
||||
}
|
||||
|
||||
private void addIncludeMeta(Map<String,String> queryParams, boolean includeMeta) throws UnsupportedEncodingException{
|
||||
if(includeMeta) {
|
||||
queryParams.put(AccessPath.INCLUDE_META_QUERY_PARAMETER, Boolean.toString(includeMeta));
|
||||
queryParams.put(InstancePath.INCLUDE_META_QUERY_PARAMETER, Boolean.toString(includeMeta));
|
||||
}
|
||||
}
|
||||
|
||||
private void addIncludeAllMeta(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||
if(allMeta) {
|
||||
queryParams.put(AccessPath.INCLUDE_META_IN_ALL_INSTANCES_QUERY_PARAMETER, Boolean.toString(allMeta));
|
||||
queryParams.put(InstancePath.INCLUDE_META_IN_ALL_INSTANCES_QUERY_PARAMETER, Boolean.toString(allMeta));
|
||||
}
|
||||
}
|
||||
|
||||
private void addOffset(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||
addOffset(queryParams, offset);
|
||||
}
|
||||
|
||||
private void addOffset(Map<String,String> queryParams, Integer offset) throws UnsupportedEncodingException{
|
||||
if(offset!=null) {
|
||||
queryParams.put(AccessPath.OFFSET_QUERY_PARAMETER, offset.toString());
|
||||
queryParams.put(InstancePath.OFFSET_QUERY_PARAMETER, offset.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void addLimit(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||
addLimit(queryParams, limit);
|
||||
}
|
||||
|
||||
private void addLimit(Map<String,String> queryParams, Integer limit) throws UnsupportedEncodingException{
|
||||
if(limit!=null) {
|
||||
queryParams.put(AccessPath.LIMIT_QUERY_PARAMETER, limit.toString());
|
||||
queryParams.put(InstancePath.LIMIT_QUERY_PARAMETER, limit.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +157,7 @@ public class ResourceRegistryPublisherImpl extends BaseRequestInfo implements Re
|
|||
|
||||
@Override
|
||||
public List<Context> renew() throws ResourceRegistryException {
|
||||
return getContextsFromServer();
|
||||
return getAllContextFromServer(true, 0, BaseRequestInfo.UNBOUNDED_LIMIT);
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -186,7 +198,11 @@ public class ResourceRegistryPublisherImpl extends BaseRequestInfo implements Re
|
|||
* @return All Contexts read from server
|
||||
* @throws ResourceRegistryException
|
||||
*/
|
||||
public List<Context> getContextsFromServer() throws ResourceRegistryException {
|
||||
public List<Context> getAllContextFromServer() throws ResourceRegistryException {
|
||||
return getAllContextFromServer(includeMeta, offset, limit);
|
||||
}
|
||||
|
||||
protected List<Context> getAllContextFromServer(boolean includeMeta, Integer offset, Integer limit) throws ResourceRegistryException {
|
||||
try {
|
||||
logger.info("Going to read all {}s", Context.NAME);
|
||||
GXHTTPStringRequest gxHTTPStringRequest = getGXHTTPStringRequest();
|
||||
|
@ -195,7 +211,9 @@ public class ResourceRegistryPublisherImpl extends BaseRequestInfo implements Re
|
|||
gxHTTPStringRequest.path(AccessPath.CONTEXTS_PATH_PART);
|
||||
|
||||
Map<String,String> parameters = new HashMap<>();
|
||||
addIncludeMeta(parameters);
|
||||
addIncludeMeta(parameters, includeMeta);
|
||||
addOffset(parameters, offset);
|
||||
addLimit(parameters, limit);
|
||||
gxHTTPStringRequest.queryParams(parameters);
|
||||
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.get();
|
||||
|
|
Loading…
Reference in New Issue