Posts

Showing posts from August, 2017

Java 8 lambda expression for list/array conversion

1). Convert List to List ( List of Strings to List of Integers) List<Integer>  integerList = stringList.stream().map(Integer::parseInt).collect(Collectors.toList());  // the longer full lambda version:  List<Integer>  integerList  = stringList.stream().map(s -> Integer.parseInt(s)).collect(Collectors.toList()); 2). Convert List to int[](List of Strings to int array) int[] intArray = stringList.stream().mapToInt(Integer::parseInt).toArray(); 3). Convert String[] to List ( String array to List of Integers) List<Integer>  integerList = Stream.of(array).map(Integer::parseInt).collect(Collectors.toList()); 4). Convert String[] to int[] (String array to int array) int[] intArray = Stream.of(stringArray).mapToInt(Integer::parseInt).toArray(); 5). Convert String[] to List (String array to Double List) List<Double> doubleList = Stream.of(stringArray).map(Double::parseDouble).collect(Collectors.toList()); 6). Co

Manage Solr Data in WSO2 Server

Image
Recently I was checking an issue faced by one of my colleague while automating WSO2 API Manager deployment. There, once the new pack is deployed by pointing to the existing databases, APIM Store didn't show existing APIs at once. It took some time to display all the existing APIs in the Store. The APIs are retrieved using the Solr based indexing in APIM. Therefore, the main reason for this behavior is that a fresh pack doesn't have existing Solr data and it takes some time to complete the indexing. Until that indexing process is completed, it will not show API in the Store instantly. To address this, you can follow one of the below approaches: 1). Backup existing Solr data ( APIM_HOME/solr/data ) from the existing deployment and added it to newly created pack. 2). Externalize Solr data directory. Solr data stored location can be configured via core.properties file located in the APIM_HOME/repository/conf/solr/registry-indexing directory. So you can update core.prope