import java.io.IOException; /** * The Class CustomDataSource. */ public class CustomDataSource extends org.apache.tomcat.jdbc.pool.DataSource { /** * Sets the password. * * @param encodedPassword the new password */ public synchronized void setPassword(String encodedPassword) { this.poolProperties.setPassword(AESUtils.decrypt(encodedPassword)); } /** * Sets the username. * * @param encodedUsername the new username */ public synchronized void setUsername(String encodedUsername) { this.poolProperties.setUsername(AESUtils.decrypt(encodedUsername)); } /** * Sets the url. * * @param encodedUrl the new url */ public synchronized void setUrl(String encodedUrl) { this.poolProperties.setUrl(AESUtils.decrypt(encodedUrl)); } /** * The main method. * * @param args the arguments * @throws IOException Signals that an I/O exception has occurred. */ public static void main(String args[]) throws IOException { //System.out.println(args.length); if (args.length < 2) { System.out.println("ArrayIndexOutOfBoundsException: 1, For Encrypt use command (sh encodeco.sh e '') | For Decrypt use command (sh encodeco.sh d '') | Note: Input must be in single quote" ); } else if (args[0].toString().equals("e")) { System.out.println("Encrypted One"); System.out.println(AESUtils.encrypt(args[1].toString())); } else if (args[0].toString().equals("d")) { System.out.println("Decrypted One"); System.out.println(AESUtils.decrypt(args[1].toString())); } } }