Powered By Blogger

Tuesday, December 4, 2018

DozerBeanMapper can be used to map the fields from one object to another object


public static void dozerConverter(Map csvFileMap){
DozerBeanMapper dozerBeanMapper = new DozerBeanMapper();
dozerBeanMapper.setMappingFiles(Arrays.asList("CASHIN_SC.xml"));
Map destFileMap = dozerBeanMapper.map(csvFileMap , HashMap.class , "BULK_BILLPAY");
for (Map.Entry entry : destFileMap.entrySet())  
            System.out.println("Key = " + entry.getKey() + 
                             ", Value = " + entry.getValue()); 
    } 




public static void main(String[] args) {
Map csvFileMap = new HashMap<>(); 
csvFileMap.put("patil Provider", "basan");
csvFileMap.put("Bank", "patil");
dozerConverter(csvFileMap);

}



xml version="1.0" encoding="UTF-8"?>
<mappings xmlns="http://dozer.sourceforge.net"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://dozer.sourceforge.net
          http://dozer.sourceforge.net/schema/beanmapping.xsd">

    <mapping wildcard="false" map-id="BULK_BILLPAY" map-null="false" type="one-way">
        <class-a>java.util.Map</class-a>
        <class-b>java.util.Map</class-b>
        <field>
            <a key="patil Provider">this</a>
            <b key="sendermfsprovider">this</b>
        </field>
        <field>
            <a key="Bank">this</a>
            <b key="bank">this</b>
        </field>
      
        
        <field>
            <a key="id">this</a>
            <b key="id">this</b>
        </field>

    </mapping>
</mappings>

Tuesday, November 20, 2018

Influx Grafana JMXtrans setup

install grafana

sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.1.4-1.x86_64.rpm
sudo service grafana-server start


Access the port
http://10.61.177.235:3000/?orgId=1 should be working


Install influx
https://www.influxdata.com/blog/package-repository-for-linux/



Insall influx

Do it as root user

cat <[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/centos/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF


sudo yum install influxdb

sudo service influxdb start


> SHOW RETENTION POLICIES ON kafka
name    duration shardGroupDuration replicaN default
----    -------- ------------------ -------- -------
autogen 0s       168h0m0s           1        true
>




Install jmxtrans
 wget -q https://raw.githubusercontent.com/jmxtrans/jmxtrans/master/jmxtrans/jmxtrans.sh

$ chmod +x jmxtrans.sh

JMXTRANS_OPTS=“-DinfluxUrl=http://10.60.237.207:8086/ -DinfluxDb=kafka -DinfluxUser=admin -DinfluxPwd=admin” SECONDS_BETWEEN_RUNS=15 JAR_FILE=jmxtrans-265-all.jar ./jmxtrans.sh start odsconsumer.json

wget http://central.maven.org/maven2/org/jmxtrans/jmxtrans/265/jmxtrans-265-all.jar
wget -q https://raw.githubusercontent.com/jmxtrans/jmxtrans/master/jmxtrans/jmxtrans.sh

Thursday, November 8, 2018

Setting Data type to avoid chld cursor issue

13.7 Common problems with parameter and data value handling in Spring DAO

Common problems with parameters and data values exist in the different approaches provided by the Spring Framework JDBC.

13.7.1 Providing SQL type information for parameters

Usually Spring determines the SQL type of the parameters based on the type of parameter passed in. It is possible to explicitly provide the SQL type to be used when setting parameter values. This is sometimes necessary to correctly set NULL values.
You can provide SQL type information in several ways:
  • Many update and query methods of the JdbcTemplate take an additional parameter in the form of an int array. This array is used to indicate the SQL type of the coresponding parameter using constant values from the java.sql.Types class. Provide one entry for each parameter.
  • You can use the SqlParameterValue class to wrap the parameter value that needs this additional information. Create a new instance for each value and pass in the SQL type and parameter value in the constructor. You can also provide an optional scale parameter for numeric values.
  • For methods working with named parameters, use the SqlParameterSource classes BeanPropertySqlParameterSource or MapSqlParameterSource. They both have methods for registering the SQL type for any of the named parameter values.


MapSqlParameterSource namedParameters = new MapSqlParameterSource();
// OrderDomain orderDomain = new OrderDomain(schema);
namedParameters.addValue("basan_order_key",orderDomain.getOmsOrderKey(), Types.VARCHAR) ;