Fixes bug on configuration setting and refactors logic on file parsing due to that fix.
This commit is contained in:
parent
28a2326743
commit
e81ffa2825
|
@ -40,7 +40,7 @@ public class DynamicFunderConfigurationDevelImpl implements DynamicFunderConfigu
|
||||||
|
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
||||||
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
||||||
is = new URL("file:///"+current + "/web/src/main/resources/FunderConfiguration.xml").openStream();
|
is = new URL("file:///"+ current + "/web/src/main/resources/FunderConfiguration.xml").openStream();
|
||||||
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
|
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class DynamicFunderConfigurationProdImpl implements DynamicFunderConfigur
|
||||||
|
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
||||||
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
||||||
is = new URL("file:///" + this.environment.getProperty("configuration.resources.path") + "FunderConfiguration.xml").openStream();
|
is = new URL(Paths.get(fileUrl).toUri().toURL().toString()).openStream();
|
||||||
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
|
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class DynamicGrantConfigurationDevelImpl implements DynamicGrantConfigura
|
||||||
|
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
||||||
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
||||||
is = new URL("file:///"+current + "/web/src/main/resources/GrantConfiguration.xml").openStream();
|
is = new URL("file:///"+ current + "/web/src/main/resources/GrantConfiguration.xml").openStream();
|
||||||
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
|
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class DynamicGrantConfigurationProdImpl implements DynamicGrantConfigurat
|
||||||
|
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
||||||
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
||||||
is = new URL("file:///" + this.environment.getProperty("configuration.resources.path") + "GrantConfiguration.xml").openStream();
|
is = new URL(Paths.get(fileUrl).toUri().toURL().toString()).openStream();
|
||||||
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
|
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class DynamicProjectConfigurationDevelImpl implements DynamicProjectConfi
|
||||||
|
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
||||||
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
||||||
is = new URL("file:///"+current + "/web/src/main/resources/ProjectConfiguration.xml").openStream();
|
is = new URL("file:///"+ current + "/web/src/main/resources/ProjectConfiguration.xml").openStream();
|
||||||
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
|
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class DynamicProjectConfigurationProdImpl implements DynamicProjectConfig
|
||||||
|
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
||||||
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
||||||
is = new URL("file:///" + this.environment.getProperty("configuration.resources.path") + "ProjectConfiguration.xml").openStream();
|
is = new URL(Paths.get(fileUrl).toUri().toURL().toString()).openStream();
|
||||||
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
|
this.configuration = (Configuration) jaxbUnmarshaller.unmarshal(is);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
|
@ -52,11 +52,6 @@ public class TagController extends BaseController {
|
||||||
List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getTags(externalUrlCriteria, type);
|
List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getTags(externalUrlCriteria, type);
|
||||||
TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(remoteRepos);
|
TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(remoteRepos);
|
||||||
|
|
||||||
// ObjectMapper mapper = new ObjectMapper();
|
|
||||||
// String fileUrl = this.environment.getProperty("configuration.resources.path") + this.environment.getProperty("dataset.tags.mock");
|
|
||||||
// List<Map<String, String>> data = mapper.readValue(new File(fileUrl), new TypeReference<List<Map<String, String>>>(){});
|
|
||||||
// TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(data);
|
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<TagExternalSourcesModel>().payload(researchersExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<TagExternalSourcesModel>().payload(researchersExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,7 @@ public class DatasetProfileManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getRDACommonStandards(Environment environment) {
|
public List<String> getRDACommonStandards(Environment environment) {
|
||||||
String filePath = environment.getProperty("configuration.resources.path") + "RDACommonStandards.txt";
|
String filePath = environment.getProperty("configuration.rda");
|
||||||
BufferedReader reader;
|
BufferedReader reader;
|
||||||
List<String> rdaList = new LinkedList<>();
|
List<String> rdaList = new LinkedList<>();
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class DevelConfigLoader implements ConfigLoader {
|
||||||
|
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(ExternalUrls.class);
|
JAXBContext jaxbContext = JAXBContext.newInstance(ExternalUrls.class);
|
||||||
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
||||||
is = new URL("file:///"+current+"/web/src/main/resources/ExternalUrls.xml").openStream();
|
is = new URL("file:///"+ current +"/web/src/main/resources/ExternalUrls.xml").openStream();
|
||||||
externalUrls = (ExternalUrls) jaxbUnmarshaller.unmarshal(is);
|
externalUrls = (ExternalUrls) jaxbUnmarshaller.unmarshal(is);
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import eu.eudat.logic.proxy.config.configloaders.ConfigLoader;
|
||||||
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
||||||
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -20,6 +19,7 @@ import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -28,9 +28,6 @@ public class RemoteFetcher {
|
||||||
|
|
||||||
private ConfigLoader configLoader;
|
private ConfigLoader configLoader;
|
||||||
|
|
||||||
@Value("${configuration.resources.path}")
|
|
||||||
private String resourcesPath;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public RemoteFetcher(ConfigLoader configLoader) {
|
public RemoteFetcher(ConfigLoader configLoader) {
|
||||||
this.configLoader = configLoader;
|
this.configLoader = configLoader;
|
||||||
|
@ -268,9 +265,9 @@ public class RemoteFetcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Map<String, String>> getAllResultsFromMockUpJson(String path, String query) {
|
private List<Map<String, String>> getAllResultsFromMockUpJson(String path, String query) {
|
||||||
String filePath = this.resourcesPath + path;
|
|
||||||
List<Map<String, String>> internalResults;
|
List<Map<String, String>> internalResults;
|
||||||
try {
|
try {
|
||||||
|
String filePath = Paths.get(path).toUri().toURL().toString();
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
internalResults = mapper.readValue(new File(filePath), new TypeReference<List<Map<String, Object>>>(){});
|
internalResults = mapper.readValue(new File(filePath), new TypeReference<List<Map<String, Object>>>(){});
|
||||||
searchListMap(internalResults, query);
|
searchListMap(internalResults, query);
|
||||||
|
|
|
@ -16,14 +16,10 @@ pdf.converter.url=http://localhost:88/
|
||||||
|
|
||||||
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
|
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
|
||||||
configuration.externalUrls=/tmp/ExternalUrls.xml
|
configuration.externalUrls=/tmp/ExternalUrls.xml
|
||||||
configuration.dynamicGrantUrl=/tmp/GrantConfiguration.xml
|
configuration.rda=C:/Users/gkolokythas/Documents/openDmp/dmp-backend/web/src/main/resources/RDACommonStandards.txt
|
||||||
configuration.dynamicProjectUrl=/tmp/ProjectConfiguration.xml
|
configuration.loginProviders=C:/Users/gkolokythas/Documents/openDmp/dmp-backend/web/src/main/resources/LoginProviders.xml
|
||||||
configuration.dynamicFunderUrl=/tmp/FunderConfiguration.xml
|
configuration.h2020template=C:/Users/gkolokythas/Documents/openDmp/dmp-backend/web/src/main/resources/documents/h2020.docx
|
||||||
configuration.h2020template=C:\\Users\\gkolokythas\\Documents\\openDmp\\dmp-backend\\web\\src\\main\\resources\\documents\\h2020.docx
|
|
||||||
configuration.resources.path =
|
|
||||||
|
|
||||||
####################MOCK FILES CONFIGURATIONS##########
|
|
||||||
dataset.tags.mock=/mockupTags.json
|
|
||||||
|
|
||||||
#############TWITTER LOGIN CONFIGURATIONS#########
|
#############TWITTER LOGIN CONFIGURATIONS#########
|
||||||
twitter.login.redirect_uri=http://127.0.0.1:4200/login/twitter
|
twitter.login.redirect_uri=http://127.0.0.1:4200/login/twitter
|
||||||
|
|
|
@ -17,11 +17,8 @@ pdf.converter.url=http://docsbox-web/
|
||||||
|
|
||||||
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
|
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
|
||||||
configuration.externalUrls=/tmp/ExternalUrls.xml
|
configuration.externalUrls=/tmp/ExternalUrls.xml
|
||||||
|
configuration.rda=/tmp/RDACommonStandards.txt
|
||||||
configuration.h2020template=/tmp/h2020.docx
|
configuration.h2020template=/tmp/h2020.docx
|
||||||
configuration.resources.path=/tmp
|
|
||||||
|
|
||||||
####################MOCK FILES CONFIGURATIONS##########
|
|
||||||
dataset.tags.mock=/mockupTags.json
|
|
||||||
|
|
||||||
####################SPRING MAIL CONFIGURATIONS#################
|
####################SPRING MAIL CONFIGURATIONS#################
|
||||||
spring.mail.default-encoding=UTF-8
|
spring.mail.default-encoding=UTF-8
|
||||||
|
|
|
@ -17,11 +17,8 @@ pdf.converter.url=http://docsbox-web/
|
||||||
|
|
||||||
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
|
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
|
||||||
configuration.externalUrls=/tmp/ExternalUrls.xml
|
configuration.externalUrls=/tmp/ExternalUrls.xml
|
||||||
configuration.h2020template=/tmp/h2020.docx
|
configuration.rda=/tmp/RDACommonStandards.txt
|
||||||
configuration.resources.path=/tmp/
|
configuration.h2020template=tmp/h2020.docx
|
||||||
|
|
||||||
####################MOCK FILES CONFIGURATIONS##########
|
|
||||||
dataset.tags.mock=mockupTags.json
|
|
||||||
|
|
||||||
####################INVITATION MAIL CONFIGURATIONS##############
|
####################INVITATION MAIL CONFIGURATIONS##############
|
||||||
####################GENERIC MAIL CONFIGURATIONS#################
|
####################GENERIC MAIL CONFIGURATIONS#################
|
||||||
|
|
|
@ -19,6 +19,11 @@ spring.mail.test-connection=false
|
||||||
spring.mail.properties.mail.smtp.auth=false
|
spring.mail.properties.mail.smtp.auth=false
|
||||||
spring.mail.properties.mail.smtp.starttls.enable=false
|
spring.mail.properties.mail.smtp.starttls.enable=false
|
||||||
|
|
||||||
|
####################CONFIGURATION FILES OVERRIDES CONFIGURATIONS##########
|
||||||
|
configuration.externalUrls=
|
||||||
|
configuration.rda=
|
||||||
|
configuration.h2020template=
|
||||||
|
|
||||||
#############LOGIN CONFIGURATIONS#########
|
#############LOGIN CONFIGURATIONS#########
|
||||||
#############GENERIC LOGIN CONFIGURATIONS#########
|
#############GENERIC LOGIN CONFIGURATIONS#########
|
||||||
autouser.root.email=
|
autouser.root.email=
|
||||||
|
|
Loading…
Reference in New Issue