fixed inputstream once more
This commit is contained in:
parent
e1d7becc2e
commit
bba4173269
|
@ -1,3 +1,8 @@
|
||||||
!!org.hso.ecommerce.app.config.YAMLData {companyName: newCommerce GmbH, installationName: Fast-Web-Shop,
|
!!org.hso.ecommerce.app.config.YAMLData
|
||||||
numberOfStorageSpaces: 128, parcelServiceApiURL: 'https://dhl.api.ecommerce.mosad.xyz',
|
companyAddress: {cityName: Berlin, countryName: Germany, houseNumber: '6', streetName: Kupfergraben,
|
||||||
parcelServiceName: DHL International GmbH}
|
zipCode: '10117'}
|
||||||
|
companyName: newCommerce GmbH
|
||||||
|
installationName: Fast-Web-Shop
|
||||||
|
numberOfStorageSpaces: 128
|
||||||
|
parcelServiceApiURL: https://dhl.api.ecommerce.mosad.xyz
|
||||||
|
parcelServiceName: DHL International GmbH
|
||||||
|
|
|
@ -18,13 +18,10 @@ public class Application {
|
||||||
|
|
||||||
AppSettings appSettings = AppSettings.getInstance(); // This does not belongs here
|
AppSettings appSettings = AppSettings.getInstance(); // This does not belongs here
|
||||||
|
|
||||||
//appSettings.writeDemoConfig();
|
appSettings.writeDemoConfig();
|
||||||
|
|
||||||
appSettings.readConfig(); // This does not belongs here either
|
appSettings.readConfig(); // This does not belongs here either
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//SpringApplication.run(Application.class, args);
|
//SpringApplication.run(Application.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.hso.ecommerce.app.config.YAMLData.Address;
|
||||||
import org.yaml.snakeyaml.Yaml;
|
import org.yaml.snakeyaml.Yaml;
|
||||||
import org.yaml.snakeyaml.constructor.Constructor;
|
import org.yaml.snakeyaml.constructor.Constructor;
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ public class AppSettings {
|
||||||
|
|
||||||
data.setInstallationName("Fast-Web-Shop");
|
data.setInstallationName("Fast-Web-Shop");
|
||||||
data.setCompanyName("newCommerce GmbH");
|
data.setCompanyName("newCommerce GmbH");
|
||||||
//data.setCompanyAddress(new Address("Kupfergraben", "6", "10117", "Berlin", "Germany"));
|
data.setCompanyAddress(new Address("Kupfergraben", "6", "10117", "Berlin", "Germany"));
|
||||||
data.setNumberOfStorageSpaces(128);
|
data.setNumberOfStorageSpaces(128);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -67,23 +68,23 @@ public class AppSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readConfig() {
|
public void readConfig() {
|
||||||
/*
|
|
||||||
Yaml yaml = new Yaml(new Constructor(YAMLData.class));
|
Yaml yaml = new Yaml(new Constructor(YAMLData.class));
|
||||||
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("./eCommerce_config.yml");
|
|
||||||
YAMLData data = yaml.load(inputStream);
|
InputStream inputStream;
|
||||||
*/
|
try {
|
||||||
String input = "!!org.hso.ecommerce.app.config.YAMLData {companyName: newCommerce GmbH, installationName: Fast-Web-Shop,\n" +
|
inputStream = new FileInputStream("./eCommerce_config.yml");
|
||||||
" numberOfStorageSpaces: 128, parcelServiceApiURL: 'https://dhl.api.ecommerce.mosad.xyz',\n" +
|
|
||||||
" parcelServiceName: DHL International GmbH}\n" +
|
YAMLData data = yaml.load(inputStream);
|
||||||
"";
|
|
||||||
|
System.out.println(data.getCompanyName());
|
||||||
|
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Yaml yaml = new Yaml(new Constructor(YAMLData.class));
|
|
||||||
|
|
||||||
|
|
||||||
YAMLData data = yaml.load(input);
|
|
||||||
|
|
||||||
System.out.println(data.getCompanyName());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@ public class YAMLData {
|
||||||
|
|
||||||
private String installationName;
|
private String installationName;
|
||||||
private String companyName;
|
private String companyName;
|
||||||
//private Address companyAddress;
|
private Address companyAddress;
|
||||||
private int numberOfStorageSpaces;
|
private int numberOfStorageSpaces;
|
||||||
//private List<Supplier> suppliers;
|
//private List<Supplier> suppliers;
|
||||||
private String parcelServiceName;
|
private String parcelServiceName;
|
||||||
|
@ -26,14 +26,14 @@ public class YAMLData {
|
||||||
public void setCompanyName(String companyName) {
|
public void setCompanyName(String companyName) {
|
||||||
this.companyName = companyName;
|
this.companyName = companyName;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
public Address getCompanyAddress() {
|
public Address getCompanyAddress() {
|
||||||
return companyAddress;
|
return companyAddress;
|
||||||
}
|
}
|
||||||
public void setCompanyAddress(Address companyAddress) {
|
public void setCompanyAddress(Address companyAddress) {
|
||||||
this.companyAddress = companyAddress;
|
this.companyAddress = companyAddress;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
public int getNumberOfStorageSpaces() {
|
public int getNumberOfStorageSpaces() {
|
||||||
return numberOfStorageSpaces;
|
return numberOfStorageSpaces;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class YAMLData {
|
||||||
public void setParcelServiceApiURL(String parcelServiceApiURL) {
|
public void setParcelServiceApiURL(String parcelServiceApiURL) {
|
||||||
this.parcelServiceApiURL = parcelServiceApiURL;
|
this.parcelServiceApiURL = parcelServiceApiURL;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
public static class Address {
|
public static class Address {
|
||||||
|
|
||||||
public String streetName;
|
public String streetName;
|
||||||
|
@ -77,7 +77,7 @@ public class YAMLData {
|
||||||
this.countryName = countryName;
|
this.countryName = countryName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
public static class Supplier {
|
public static class Supplier {
|
||||||
|
|
||||||
public String name;
|
public String name;
|
||||||
|
|
Reference in New Issue