/** * Initializes the module. Use this method to perform all initial setup operations. This method is * called only once in a modules lifetime. If the initializing cannot be completed, throw a * ModuleInitializeException to indicate the error,. The module will not be available to the * system. * * @param subSystem the subSystem. * @throws ModuleInitializeException if an error ocurred while initializing the module. */ public void initialize(final SubSystem subSystem) throws ModuleInitializeException { PasswordEncryptionService.getInstance() .registerService(new PlainTextPasswordEncryptionServiceProvider()); PasswordEncryptionService.getInstance() .registerService(new StaticAESPasswordEncryptionServiceProvider()); PasswordEncryptionService.getInstance() .registerService(new ObscurificatePasswordEncryptionServiceProvider()); }
public String writeReport( final XmlWriter xmlWriter, final OlapConnectionProvider connectionProvider) throws IOException, BundleWriterException { if (xmlWriter == null) { throw new NullPointerException(); } if (connectionProvider == null) { throw new NullPointerException(); } final DriverConnectionProvider driverProvider = (DriverConnectionProvider) connectionProvider; xmlWriter.writeTag(Olap4JDataFactoryModule.NAMESPACE, "connection", XmlWriterSupport.OPEN); xmlWriter.writeTag(Olap4JDataFactoryModule.NAMESPACE, "driver", XmlWriterSupport.OPEN); xmlWriter.writeTextNormalized(driverProvider.getDriver(), false); xmlWriter.writeCloseTag(); xmlWriter.writeTag(Olap4JDataFactoryModule.NAMESPACE, "url", XmlWriterSupport.OPEN); xmlWriter.writeTextNormalized(driverProvider.getUrl(), false); xmlWriter.writeCloseTag(); xmlWriter.writeTag(Olap4JDataFactoryModule.NAMESPACE, "properties", XmlWriterSupport.OPEN); final String[] propertyNames = driverProvider.getPropertyNames(); for (int i = 0; i < propertyNames.length; i++) { final String name = propertyNames[i]; final String value = driverProvider.getProperty(name); xmlWriter.writeTag( Olap4JDataFactoryModule.NAMESPACE, "property", "name", name, XmlWriterSupport.OPEN); if (name.toLowerCase().contains("password")) { xmlWriter.writeTextNormalized( PasswordEncryptionService.getInstance().encrypt(value), false); } else { xmlWriter.writeTextNormalized(value, false); } xmlWriter.writeCloseTag(); } xmlWriter.writeCloseTag(); xmlWriter.writeCloseTag(); return null; }