diff options
Diffstat (limited to 'id')
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java deleted file mode 100644 index e1c1ac49e..000000000 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java +++ /dev/null @@ -1,155 +0,0 @@ -//package at.gv.egovernment.moa.id.config.auth; -// -//import java.beans.IntrospectionException; -//import java.beans.Introspector; -//import java.beans.PropertyDescriptor; -//import java.lang.reflect.InvocationTargetException; -//import java.lang.reflect.Method; -//import java.util.Arrays; -//import java.util.List; -// -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -//import org.springframework.context.ApplicationContext; -//import org.springframework.context.support.ClassPathXmlApplicationContext; -// -//import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration; -//import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead; -//import at.gv.egovernment.moa.id.config.ConfigurationException; -//import at.gv.egovernment.moa.id.config.ConfigurationProvider; -// -//import com.fasterxml.jackson.annotation.JsonIgnore; -//import com.fasterxml.jackson.annotation.JsonProperty; -// -//public class ConfigurationToJSONConverter { -// -// @Autowired -// NewAuthConfigurationProvider configProvider; -// -// @Autowired -// MOAIDConfiguration configDataBase; -// -// public static void main(String[] args) { -// -// try { -// ConfigurationToJSONConverter converter = new ConfigurationToJSONConverter(args[0]); -// converter.writeConfigToJSONDB(); -// System.out.println("====================================="); -// System.out.println("====================================="); -// converter.readConfigFromDB(); -// System.out.println("====================================="); -// System.out.println("====================================="); -// -// // otherwise the database connection is not initialized -// JaxBAuthConfigurationProvider.getInstance(); -// List<String> methodNames = Arrays.asList("getAllOnlineApplications", "getAllUsers", "getMOAIDConfiguration"); -// converter.extractDataViaConfigurationDBRead(methodNames); -// converter.readExtractedConfigurationDBReadData(methodNames); -// -// } catch (ConfigurationException e) { -// e.printStackTrace(); -// System.out.println("Problems reading the configuration file in: " + System.getProperty(ConfigurationProvider.CONFIG_PROPERTY_NAME)); -// System.exit(1); -// } -// -// } -// -// public ConfigurationToJSONConverter(String pathToDBConfigPropertiesFile) throws ConfigurationException { -// -// System.getProperties().setProperty("location", "file:" + pathToDBConfigPropertiesFile); -// ApplicationContext context = new ClassPathXmlApplicationContext("configuration.beans.xml"); -// AutowireCapableBeanFactory acbFactory = context.getAutowireCapableBeanFactory(); -// acbFactory.autowireBean(this); -// -// } -// -// public void extractDataViaConfigurationDBRead(List<String> methodNames) { -// System.out.println("Start extracting"); -// // read objects from db and write to key-value -// for (String name : methodNames) { -// try { -// Method method = ConfigurationDBRead.class.getMethod(name); -// Object tmp = method.invoke(null, new Object[] {}); -// JsonProperty annotation = method.getAnnotation(JsonProperty.class); -// if (annotation != null) { -// configDataBase.set(annotation.value(), tmp); -// } else { -// System.out.println("Annotate Method with name: " + name); -// } -// } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException -// | InvocationTargetException e) { -// System.out.println("Problems while extracting ConfigurationDBRead data."); -// } -// } -// } -// -// public void readExtractedConfigurationDBReadData(List<String> methodNames) { -// for (String name : methodNames) { -// Object tmp = configDataBase.get(name); -// System.out.println(">>> OBJECT: " + tmp); -// } -// } -// -// public void writeConfigToJSONDB() { -// -// try { -// // find all getter methods -// for (PropertyDescriptor pd : Introspector.getBeanInfo(NewAuthConfigurationProvider.class).getPropertyDescriptors()) { -// // check if correct methods, and not annotated with @JsonIgnore -// if ((pd.getReadMethod() != null) -// && (!"class".equals(pd.getName())) -// && (pd.getReadMethod().getAnnotation(JsonIgnore.class) == null)) { -// -// JsonProperty name = pd.getReadMethod().getAnnotation(JsonProperty.class); -// // get result of get method -// Object tmp; -// try { -// tmp = pd.getReadMethod().invoke(configProvider); -// // convert result to JSON -// if (name != null) { -// configDataBase.set(name.value(), tmp); -// } else { -// System.out.println("CHECK if '" + pd.getDisplayName() + "' is NOT ANNOTATED"); -// } -// } catch (IllegalAccessException | InvocationTargetException e) { -// System.out.println("Problems while writing the configuration to the database."); -// } -// } -// } -// -// // no static method handling needed -// -// } catch (IllegalArgumentException e) { -// System.out.println("Problems while using reflection to get all getter methods."); -// } catch (IntrospectionException e) { -// System.out.println("Problems while using reflection to get all getter methods."); -// } -// -// } -// -// public void readConfigFromDB() { -// try { -// // find all getter methods -// for (PropertyDescriptor pd : Introspector.getBeanInfo(NewAuthConfigurationProvider.class) -// .getPropertyDescriptors()) { -// // check if correct methods, and not annotated with @JsonIgnore -// if ((pd.getReadMethod() != null) -// && (!"class".equals(pd.getName())) -// && (pd.getReadMethod().getAnnotation(JsonIgnore.class) == null)) { -// JsonProperty name = pd.getReadMethod().getAnnotation(JsonProperty.class); -// // get result of get method -// if (name != null) { -// System.out.println(">>> OBJECT: " + configDataBase.get(name.value())); -// } else { -// System.out.println("CHECK if '" + pd.getDisplayName() + "' is NOT ANNOTATED"); -// } -// } -// } -// } catch (IllegalArgumentException e) { -// System.out.println("Problems while using reflection to get all getter methods."); -// } catch (IntrospectionException e) { -// System.out.println("Problems while using reflection to get all getter methods."); -// } -// } -// -//} |