New Version: Some minor tweeks for FileStorage.
This commit is contained in:
@ -15,7 +15,6 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
@ -57,7 +56,6 @@ public class QueryRestConfig extends WebMvcConfigurerAdapter {
|
|||||||
private static final String QUERYREST_DEFAULT_RESPONSE_FIELDS = "queryrest.default.response.fields";
|
private static final String QUERYREST_DEFAULT_RESPONSE_FIELDS = "queryrest.default.response.fields";
|
||||||
private static final String QUERYREST_CORS_ALLOWEDORIGINS = "queryrest.cors.allowedorigins";
|
private static final String QUERYREST_CORS_ALLOWEDORIGINS = "queryrest.cors.allowedorigins";
|
||||||
private static final String QUERYREST_CORS_FORCEALLHEADERS = "queryrest.cors.forceallheaders";
|
private static final String QUERYREST_CORS_FORCEALLHEADERS = "queryrest.cors.forceallheaders";
|
||||||
private static final String QUERYREST_READTIMOUT = "queryrest.readtimeout";
|
|
||||||
|
|
||||||
// a nested configuration
|
// a nested configuration
|
||||||
// this guarantees that the ordering of the properties file is as expected
|
// this guarantees that the ordering of the properties file is as expected
|
||||||
@ -74,7 +72,6 @@ public class QueryRestConfig extends WebMvcConfigurerAdapter {
|
|||||||
public static final String BEAN_NAME_DEFAULT_RESPONSE_AGGREGATIONS = "defaultResponseAggregations";
|
public static final String BEAN_NAME_DEFAULT_RESPONSE_AGGREGATIONS = "defaultResponseAggregations";
|
||||||
public static final String BEAN_NAME_CORS_ALLOWEDORIGINS = "corsAllowedorigins";
|
public static final String BEAN_NAME_CORS_ALLOWEDORIGINS = "corsAllowedorigins";
|
||||||
public static final String BEAN_NAME_CORS_FORCEALLHEADERS = "corsForceallheaders";
|
public static final String BEAN_NAME_CORS_FORCEALLHEADERS = "corsForceallheaders";
|
||||||
public static final String BEAN_NAME_READ_TIMOUT = "queryRestReadTimout";
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private Environment env;
|
private Environment env;
|
||||||
@ -194,12 +191,4 @@ public class QueryRestConfig extends WebMvcConfigurerAdapter {
|
|||||||
LOGGER.debug("Load '{}={}'", QUERYREST_CORS_FORCEALLHEADERS, value);
|
LOGGER.debug("Load '{}={}'", QUERYREST_CORS_FORCEALLHEADERS, value);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = BEAN_NAME_READ_TIMOUT)
|
|
||||||
@Lazy
|
|
||||||
public Integer readTimeout() {
|
|
||||||
Integer value = env.getProperty(QUERYREST_READTIMOUT, Integer.class, 10);
|
|
||||||
LOGGER.debug("Load '{}={}'", QUERYREST_READTIMOUT, value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import ch.psi.daq.cassandra.config.CassandraConfig;
|
|
||||||
import ch.psi.daq.common.ordering.Ordering;
|
import ch.psi.daq.common.ordering.Ordering;
|
||||||
import ch.psi.daq.domain.config.DomainConfig;
|
import ch.psi.daq.domain.config.DomainConfig;
|
||||||
import ch.psi.daq.domain.json.ChannelName;
|
import ch.psi.daq.domain.json.ChannelName;
|
||||||
@ -54,7 +53,6 @@ import ch.psi.daq.query.config.QueryConfig;
|
|||||||
import ch.psi.daq.query.model.Query;
|
import ch.psi.daq.query.model.Query;
|
||||||
import ch.psi.daq.query.processor.ChannelNameCache;
|
import ch.psi.daq.query.processor.ChannelNameCache;
|
||||||
import ch.psi.daq.query.processor.QueryProcessor;
|
import ch.psi.daq.query.processor.QueryProcessor;
|
||||||
import ch.psi.daq.queryrest.config.QueryRestConfig;
|
|
||||||
import ch.psi.daq.queryrest.query.QueryManager;
|
import ch.psi.daq.queryrest.query.QueryManager;
|
||||||
import ch.psi.daq.queryrest.response.AbstractHTTPResponse;
|
import ch.psi.daq.queryrest.response.AbstractHTTPResponse;
|
||||||
import ch.psi.daq.queryrest.response.PolymorphicResponseMixIn;
|
import ch.psi.daq.queryrest.response.PolymorphicResponseMixIn;
|
||||||
@ -91,7 +89,7 @@ public class QueryRestController {
|
|||||||
@Resource
|
@Resource
|
||||||
private Function<Query, QueryAnalyzer> queryAnalizerFactory;
|
private Function<Query, QueryAnalyzer> queryAnalizerFactory;
|
||||||
|
|
||||||
@Resource(name = QueryRestConfig.BEAN_NAME_READ_TIMOUT)
|
@Resource(name = DomainConfig.BEAN_NAME_READ_TIMEOUT)
|
||||||
private Integer readTimeout;
|
private Integer readTimeout;
|
||||||
|
|
||||||
private Map<Backend, QueryProcessor> queryProcessors = new LinkedHashMap<>();
|
private Map<Backend, QueryProcessor> queryProcessors = new LinkedHashMap<>();
|
||||||
@ -165,7 +163,7 @@ public class QueryRestController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
channelNameCache =
|
channelNameCache =
|
||||||
new ChannelNameCache(queryProcessors, appContext.getBean(CassandraConfig.BEAN_NAME_READ_TIMEOUT,
|
new ChannelNameCache(queryProcessors, appContext.getBean(DomainConfig.BEAN_NAME_READ_TIMEOUT,
|
||||||
Integer.class).longValue());
|
Integer.class).longValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import org.springframework.context.ApplicationContext;
|
|||||||
|
|
||||||
import ch.psi.daq.cassandra.config.CassandraConfig;
|
import ch.psi.daq.cassandra.config.CassandraConfig;
|
||||||
import ch.psi.daq.domain.DataEvent;
|
import ch.psi.daq.domain.DataEvent;
|
||||||
|
import ch.psi.daq.domain.config.DomainConfig;
|
||||||
import ch.psi.daq.domain.json.ChannelName;
|
import ch.psi.daq.domain.json.ChannelName;
|
||||||
import ch.psi.daq.domain.query.DAQQueries;
|
import ch.psi.daq.domain.query.DAQQueries;
|
||||||
import ch.psi.daq.domain.query.DAQQueryElement;
|
import ch.psi.daq.domain.query.DAQQueryElement;
|
||||||
@ -86,7 +87,7 @@ public class QueryManagerImpl implements QueryManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
channelNameCache =
|
channelNameCache =
|
||||||
new ChannelNameCache(queryProcessors, appContext.getBean(CassandraConfig.BEAN_NAME_READ_TIMEOUT,
|
new ChannelNameCache(queryProcessors, appContext.getBean(DomainConfig.BEAN_NAME_READ_TIMEOUT,
|
||||||
Integer.class).longValue());
|
Integer.class).longValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,3 @@ queryrest.cors.forceallheaders=false
|
|||||||
# If this is set to '*', then all requests are allowed, from any source. If it's set to, say, http://ui-data-api.psi.ch, then only requests
|
# If this is set to '*', then all requests are allowed, from any source. If it's set to, say, http://ui-data-api.psi.ch, then only requests
|
||||||
# originating from that domain (Origin header set to that value) will be allowed. Otherwise a 403 error will be returned.
|
# originating from that domain (Origin header set to that value) will be allowed. Otherwise a 403 error will be returned.
|
||||||
queryrest.cors.allowedorigins=*
|
queryrest.cors.allowedorigins=*
|
||||||
|
|
||||||
# Timeout for read operations in seconds
|
|
||||||
queryrest.readtimeout=30
|
|
||||||
|
@ -151,7 +151,7 @@ public class QueryRestControllerJsonTest extends AbstractDaqRestTest {
|
|||||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].backend").value(Backend.SF_DATABUFFER.getKey()))
|
.andExpect(MockMvcResultMatchers.jsonPath("$[0].backend").value(Backend.SF_DATABUFFER.getKey()))
|
||||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels").isArray())
|
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels").isArray())
|
||||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[23]").exists())
|
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[23]").exists())
|
||||||
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[24]").doesNotExist())
|
.andExpect(MockMvcResultMatchers.jsonPath("$[0].channels[25]").doesNotExist())
|
||||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
// .andExpect(MockMvcResultMatchers.jsonPath("$[1]").exists())
|
||||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].backend").value(Backend.archiverappliance.name()))
|
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].backend").value(Backend.archiverappliance.name()))
|
||||||
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels").isArray())
|
// .andExpect(MockMvcResultMatchers.jsonPath("$[1].channels").isArray())
|
||||||
|
Reference in New Issue
Block a user