/*
* Copyright (C) 2011-2014 GeoForge Project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.geoforge.guillcogc.thread;
import gov.nasa.worldwind.avlist.AVList;
import gov.nasa.worldwind.avlist.AVListImpl;
import gov.nasa.worldwind.ogc.OGCBoundingBox;
import gov.nasa.worldwind.ogc.OGCOnlineResource;
import gov.nasa.worldwind.ogc.wms.WMSLayerCapabilities;
import gov.nasa.worldwind.ogc.wms.WMSLayerStyle;
import gov.nasa.worldwind.ogc.wms.WMSLogoURL;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.util.*;
import java.util.logging.Logger;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.xml.stream.XMLStreamException;
import org.geoforge.bsoogc.boundingbox.GfrBbxLyrImgWms;
import org.geoforge.guillc.progressbar.GfrProgressBar;
import org.geoforge.lang.util.eventobject.GfrEventObjectAbs;
import org.geoforge.lang.handler.IGfrHandlerEventListenerThreadJobProgress;
import org.geoforge.lang.util.GfrResBundleLang;
import org.geoforge.java.util.logging.filehandler.FileHandlerLogger;
import org.geoforge.lang.util.number.GfrDouble;
import org.geoforge.mdldatogc.GfrMdlDatIdObjTloOgcWms;
import org.geoforge.mdldatogc.worldwind.capabilities.GfrCapWms;
import org.geoforge.worldwindogc.capabilities.GfrWMSCapabilities;
import org.geoforge.worldwindogc.util.eventobject.GfrEventObjectCreatedUrlWmsOgc;
import org.geoforge.worldwindogc.factory.FactoryChildWms;
import org.geoforge.worldwindogc.factory.InfoChildWms;
import org.geoforge.worldwindogc.layer.GfrLyrWMSTiledImageLayer;
import org.geoforge.worldwindogc.terrain.GfrEmlWMSBasicElevationModel;
import org.geoforge.worldwindogc.thread.GfrPgsThrOgcWmsAbs;
/**
*
* @author bantchao
*/
public class GfrPgsThrOgcWmsCreate extends GfrPgsThrOgcWmsAbs
{
// ----
// begin: instantiate logger for this class
final private static Logger _LOGGER_ = Logger.getLogger(GfrPgsThrOgcWmsCreate.class.getName());
static
{
GfrPgsThrOgcWmsCreate._LOGGER_.addHandler(FileHandlerLogger.s_getInstance());
}
// end: instantiate logger for this class
// ----
private GfrProgressBar _pbr_ = null;
private JLabel _lbl_ = null;
public GfrPgsThrOgcWmsCreate(
String strIdParent,
IGfrHandlerEventListenerThreadJobProgress hnd,
GfrProgressBar pbr,
JLabel lbl)
throws Exception
{
super(strIdParent, hnd);
this._pbr_ = pbr;
this._lbl_ = lbl;
}
// call this method whenever you want to notify
//the event listeners of the particular event
@Override
protected synchronized void _fireEvent() throws Exception
{
if (super._blnCanceled)
return;
GfrEventObjectAbs event = new GfrEventObjectCreatedUrlWmsOgc(this, super._strError,
super._strUrlServerParent);
Iterator itr = super._listeners.iterator();
while (itr.hasNext())
{
if (super._blnCanceled)
return;
((IGfrHandlerEventListenerThreadJobProgress) itr.next()).handleEventThreadJobDone(event);
}
}
@Override
protected void _actionCancelled()
{
// handled in DlgProgress's parent
}
@Override
protected void _doJob()
{
GfrWMSCapabilities capWms = null;
List<WMSLayerCapabilities> lstCapLayersLeaf = null;
try
{
if (! GfrCapWms.getInstance().isOpen())
{
if (super._listeners != null) // ???
super._listeners.clear();
return; // should not send event anymore
}
capWms = GfrCapWms.getInstance().newObject(this._strIdParent, this._strUrlServerParent);
lstCapLayersLeaf = capWms.getNamedLayersLeaves();
if (lstCapLayersLeaf == null)
{
String strWarning = "No children found";
GfrPgsThrOgcWmsCreate._LOGGER_.warning(strWarning);
super._strError = strWarning;
return;
}
}
catch(java.lang.NullPointerException excNullPointer)
{
if (super._blnCanceled)
{
return;
}
excNullPointer.printStackTrace();
String str = "Got null pointer exception, _strUrlServer=" + _strUrlServerParent + ", _strId=" + _strIdParent;
GfrPgsThrOgcWmsCreate._LOGGER_.severe(str);
super._strError = str;
return;
}
catch(java.net.UnknownHostException excUnknownHost)
{
excUnknownHost.printStackTrace();
String str = "Unknown host: " + excUnknownHost.getMessage();
GfrPgsThrOgcWmsCreate._LOGGER_.severe(str);
super._strError = str;
return;
}
catch (URISyntaxException excURISyntax)
{
excURISyntax.printStackTrace();
String str = excURISyntax.getMessage();
GfrPgsThrOgcWmsCreate._LOGGER_.severe(str);
super._strError = str;
return;
}
catch (MalformedURLException excMalformedURL)
{
excMalformedURL.printStackTrace();
String str = excMalformedURL.getMessage();
GfrPgsThrOgcWmsCreate._LOGGER_.severe(str);
super._strError = str;
return;
}
catch (XMLStreamException excXMLStream)
{
excXMLStream.printStackTrace();
String str = excXMLStream.getMessage();
GfrPgsThrOgcWmsCreate._LOGGER_.severe(str);
super._strError = str;
return;
}
catch(java.net.SocketException excSocket)
{
excSocket.printStackTrace();
String str = excSocket.getMessage();
GfrPgsThrOgcWmsCreate._LOGGER_.warning(str);
super._strError = str;
return;
}
catch (IOException excIO)
{
excIO.printStackTrace();
String str = excIO.getMessage();
GfrPgsThrOgcWmsCreate._LOGGER_.severe(str);
super._strError = str;
return;
}
catch (Exception exc)
{
exc.printStackTrace();
String str = exc.getMessage();
GfrPgsThrOgcWmsCreate._LOGGER_.severe(str);
super._strError = str;
return;
}
try
{
int intCount = 0;
int intTotal = lstCapLayersLeaf.size();
boolean blnShowProgress = false;
if (intTotal > 1)
{
blnShowProgress = true;
}
if (blnShowProgress)
this._pbr_.setIndeterminate(false);
// assign determinate progress bar
ArrayList<String> altIdLeaves = new ArrayList<String>();
// first create leaves
for (WMSLayerCapabilities capLayerLeafCur: lstCapLayersLeaf)
{
if (super._blnCanceled)
return;
if (! super.isAlive())
return;
if (blnShowProgress)
{
int intPercent = intCount * 100 / intTotal;
this._lbl_.setText("Processing leaves layers, " + intPercent + "% done");
this._pbr_.setValue(intPercent);
intCount ++;
}
else
{
this._lbl_.setText("Processing folders layers, please wait ...");
}
String strLegendUrlLayer = this._getLegendUrlLayer_(capLayerLeafCur);
ArrayList<GfrBbxLyrImgWms> altBbxs = _getBoundingBoxes_(capLayerLeafCur);
String strIdChild = _createLayerLeaf_(capWms, capLayerLeafCur, strLegendUrlLayer, altBbxs);
if (strIdChild == null)
{
String str = "strIdChild == null";
GfrPgsThrOgcWmsCreate._LOGGER_.severe(str);
super._strError = str;
break;
}
altIdLeaves.add(strIdChild);
}
this._pbr_.setIndeterminate(true);
this._lbl_.setText("Processing layers, please wait ...");
if (altIdLeaves.size() != lstCapLayersLeaf.size())
return;
// TODO: then create folders
List<WMSLayerCapabilities> lstCapsLayerFolders = capWms.getAllLayersFolders();
ArrayList<String> altIdFolders = _createFolders_(lstCapsLayerFolders);
_createTreeArborescence_(altIdLeaves, lstCapLayersLeaf, altIdFolders, lstCapsLayerFolders);
GfrMdlDatIdObjTloOgcWms.getInstance().doneTreeArborescence(super._strIdParent);
}
catch (Exception exc)
{
exc.printStackTrace();
String str = exc.getMessage();
GfrPgsThrOgcWmsCreate._LOGGER_.severe(str);
super._strError = str;
}
}
/*
* should not duplicate crsKind, taking lowest values
*/
private ArrayList<GfrBbxLyrImgWms> _getBoundingBoxes_(WMSLayerCapabilities capLayer)
{
ArrayList<GfrBbxLyrImgWms> altBbxs = new ArrayList<GfrBbxLyrImgWms>();
Set<OGCBoundingBox> setBbx = capLayer.getBoundingBoxes();
if (setBbx==null || setBbx.isEmpty())
return altBbxs;
for (OGCBoundingBox bbxCur: setBbx)
{
String strKindCrs = bbxCur.getCRS();
double dblMinX = bbxCur.getMinx();
double dblMinY = bbxCur.getMiny();
double dblMaxX = bbxCur.getMaxx();
double dblMaxY = bbxCur.getMaxy();
double dblResX = bbxCur.getResx(); // ATTN: nil data value
double dblResY = bbxCur.getResy(); // ATTN: nil data value
// ---
// ie. brasil
if (strKindCrs==null || strKindCrs.length()<1)
continue;
GfrBbxLyrImgWms bbxSameKindCrs = _getBoundingBoxSharingCrsKind_(altBbxs, strKindCrs);
// done in a hurry !!!!!!!!!!
// not sure if for eg "EPSG:26915"
if (bbxSameKindCrs != null)
{
boolean blnShouldReset = false;
if (dblMinX > bbxSameKindCrs.getMinimumX())
{
blnShouldReset = true;
}
else if (dblMinY > bbxSameKindCrs.getMinimumY())
{
blnShouldReset = true;
}
else if (dblMaxX < bbxSameKindCrs.getMaximumX())
{
blnShouldReset = true;
}
else if (dblMaxY < bbxSameKindCrs.getMaximumY())
{
blnShouldReset = true;
}
if (! blnShouldReset)
continue;
bbxSameKindCrs.setMinimumX(dblMinX);
bbxSameKindCrs.setMinimumY(dblMinY);
bbxSameKindCrs.setMaximumX(dblMaxX);
bbxSameKindCrs.setMaximumY(dblMaxY);
bbxSameKindCrs.setResolutionX(dblResX);
bbxSameKindCrs.setResolutionY(dblResY);
continue;
}
// ---
GfrBbxLyrImgWms bbxImgCur = new GfrBbxLyrImgWms(
"dummy-strId", // assigned in wrapper
"dummy-strIdOwnerLayer", // assigned in wrapper
strKindCrs,
dblMinX,
dblMaxX,
dblMinY,
dblMaxY,
dblResX,
dblResY);
altBbxs.add(bbxImgCur);
}
return altBbxs;
}
private GfrBbxLyrImgWms _getBoundingBoxSharingCrsKind_(ArrayList<GfrBbxLyrImgWms> altBbxs, String strKindCrs)
{
if (altBbxs==null || altBbxs.isEmpty())
return null;
for (GfrBbxLyrImgWms bbxCur: altBbxs)
{
String strKindCrsCur = bbxCur.getKindCrs();
if (strKindCrsCur.compareTo(strKindCrs) != 0)
continue;
return bbxCur;
}
return null;
}
private ArrayList<String> _createFolders_(
List<WMSLayerCapabilities> lstCapsLayerFolders) throws Exception
{
ArrayList<String> altIdFolder = new ArrayList<String>();
for (int i=0; i<lstCapsLayerFolders.size(); i++)
{
// !!!!!!!!!!!!!! TODO: store styles
String strValueNameLayer = lstCapsLayerFolders.get(i).getName();
String strValueTitleLayer = lstCapsLayerFolders.get(i).getTitle();
String strValueAbstractLayer = lstCapsLayerFolders.get(i).getLayerAbstract();
String strValueStylesLayer = ""; // lstCapsLayerFolders.get(i).getStyles();
String strLegendUrlLayer = this._getLegendUrlLayer_(lstCapsLayerFolders.get(i));
ArrayList<GfrBbxLyrImgWms> altBbxs = this._getBoundingBoxes_(lstCapsLayerFolders.get(i));
if (strValueNameLayer == null) // nil value allowed
strValueNameLayer = "";
if (strValueAbstractLayer == null)
strValueAbstractLayer = "";
String strIdChild = GfrMdlDatIdObjTloOgcWms.getInstance().newObjectLayerFolder(_strIdParent,
strValueNameLayer, strValueTitleLayer, strValueAbstractLayer,
strValueStylesLayer, strLegendUrlLayer, altBbxs);
altIdFolder.add(strIdChild);
}
return altIdFolder;
}
private void _createTreeArborescence_(
List<String> lstIdLeaves,
List<WMSLayerCapabilities> lstCapLayersLeaf,
List<String> lstIdFolders,
List<WMSLayerCapabilities> lstCapsLayerFolder
) throws Exception
{
for (int i=0; i<lstCapsLayerFolder.size(); i++)
{
WMSLayerCapabilities capLayerFolderCur = lstCapsLayerFolder.get(i);
String strIdParentFolderCur = lstIdFolders.get(i);
List<WMSLayerCapabilities> lstCapLayersCur = capLayerFolderCur.getLayers();
for (WMSLayerCapabilities capLayerCur: lstCapLayersCur)
{
boolean blnGotChildLeaf = false;
for (int j=0; j<lstCapLayersLeaf.size(); j++)
{
WMSLayerCapabilities capLayerLeafCur = lstCapLayersLeaf.get(j);
if (capLayerLeafCur != capLayerCur)
continue;
String strIdLayerLeafCur = lstIdLeaves.get(j);
GfrMdlDatIdObjTloOgcWms.getInstance().setParentFolderIdLayerLeaf(strIdLayerLeafCur, strIdParentFolderCur);
blnGotChildLeaf = true;
break;
}
if (blnGotChildLeaf)
continue;
for (int j=0; j<lstCapsLayerFolder.size(); j++)
{
WMSLayerCapabilities capLayerFolderChildCur = lstCapsLayerFolder.get(j);
if (capLayerFolderChildCur == capLayerFolderCur)
continue;
if (capLayerFolderChildCur != capLayerCur)
continue;
String strIdLayerFolderCur = lstIdFolders.get(j);
GfrMdlDatIdObjTloOgcWms.getInstance().setParentFolderIdLayerFolder(strIdLayerFolderCur, strIdParentFolderCur);
break;
}
}
}
}
private String _createChildLeaf_(
Object objComponent,
InfoChildWms lyrInfoChild,
String strLegendUrlLayer,
ArrayList<GfrBbxLyrImgWms> altBbxs,
boolean blnIsKindScaleDenominator,
double dblMinScale,
double dblMaxScale)
throws Exception
{
String strNameCur = lyrInfoChild.getLayerNames();
String strTitleCur = lyrInfoChild.getDisplayName();
if (objComponent == null)
{
String strError = "Got errors in WMS server named " + this._strUrlServerParent;
strError += "\n" + "Failed to load child(ren):";
strError += "\n. " + "Title: " + strTitleCur + ", Name: " + strNameCur;
GfrPgsThrOgcWmsCreate._LOGGER_.severe(strError);
return null;
//throw new Exception(strError);
}
boolean blnIsLayer = false;
if (objComponent instanceof GfrLyrWMSTiledImageLayer)
{
GfrLyrWMSTiledImageLayer objLyr = (GfrLyrWMSTiledImageLayer) objComponent;
String strErrorCheck = objLyr.getErrorCheck();
if (strErrorCheck != null)
{
String strError = "Got errors in WMS server named " + this._strUrlServerParent;
strError += "\n" + "Failed to load child(ren):";
strError += "\n. " + "Title: " + strTitleCur + ", \nName: " + strNameCur;
strError += ", \nthis layer contains errors: " + strErrorCheck;
GfrPgsThrOgcWmsCreate._LOGGER_.severe(strError);
throw new Exception(strError);
}
blnIsLayer = true;
}
else if (objComponent instanceof GfrEmlWMSBasicElevationModel)
{
GfrEmlWMSBasicElevationModel objTer = (GfrEmlWMSBasicElevationModel) objComponent;
String strErrorCheck = objTer.getErrorCheck();
if (strErrorCheck != null)
{
String strError = "Got errors in WMS server named " + this._strUrlServerParent;
strError += "\n" + "Failed to load child(ren):";
strError += "\n. " + "Title: " + strTitleCur + ", \nName: " + strNameCur;
strError += ", \nthis terrain contains errors: " + strErrorCheck;
GfrPgsThrOgcWmsCreate._LOGGER_.severe(strError);
throw new Exception(strError);
}
}
else
{
String str = "Uncaught instanceof objComponent: " + objComponent.getClass().toString();
GfrPgsThrOgcWmsCreate._LOGGER_.severe(str);
JOptionPane.showMessageDialog(
null,
str,
GfrResBundleLang.s_getInstance().getValue("word.error"),
JOptionPane.ERROR_MESSAGE);
throw new Exception(str); // rather exiting !!!!!!!
}
AVListImpl keys = lyrInfoChild.getParams();
String strValueNameLayer = keys.getStringValue("gov.nasa.worldwind.avkey.LayerNames");
String strValueTitleLayer = keys.getStringValue("gov.nasa.worldwind.avkey.DisplayName");
String strValueAbstractLayer = keys.getStringValue("gov.nasa.worldwind.avkey.LayerAbstract");
String strValueStylesLayer = keys.getStringValue("gov.nasa.worldwind.avkey.StyleNames");
if (strValueAbstractLayer == null)
strValueAbstractLayer = "";
if (strValueStylesLayer == null)
strValueStylesLayer = "";
else
System.err.println("strValueStylesLayer=" + strValueStylesLayer);
String strIdChild = null;
if (blnIsLayer)
{
// memo: current limitations, layers should share same name!
strIdChild = GfrMdlDatIdObjTloOgcWms.getInstance().newObjectLayerLeaf(_strIdParent,
strValueNameLayer, strValueTitleLayer, strValueAbstractLayer,
strValueStylesLayer,
strLegendUrlLayer,
altBbxs,
blnIsKindScaleDenominator,
dblMinScale,
dblMaxScale
);
}
else
{
strIdChild = GfrMdlDatIdObjTloOgcWms.getInstance().newObjectTerrain(_strIdParent,
strValueNameLayer, strValueTitleLayer, strValueAbstractLayer, strValueStylesLayer);
}
return strIdChild;
}
/*
* returning first occurence of legendUrl if any
* memo, inherits from parents
* ==> could be duplicated
* ==> just keeping the one that share same nameLayer
*/
private String _getLegendUrlLayer_(WMSLayerCapabilities capLayerSource)
{
Set<WMSLayerStyle> setStyleLayer = capLayerSource.getStyles();
if (setStyleLayer == null || setStyleLayer.isEmpty())
return "";
String strResult = null;
String strNameLayerSource = capLayerSource.getName();
for (WMSLayerStyle lseCur: setStyleLayer)
{
java.util.Set<WMSLogoURL> lstLulCur = lseCur.getLegendURLs();
if (lstLulCur==null || lstLulCur.isEmpty())
continue;
for (WMSLogoURL lulCur: lstLulCur)
{
OGCOnlineResource olrCur = lulCur.getOnlineResource();
if (olrCur == null)
continue;
String strHrefCur = olrCur.getHref();
if (strHrefCur == null)
continue;
String strValueNameLayerCur = _getValueNameLayerFromLegendUrl_(strHrefCur);
if (strValueNameLayerCur.toLowerCase().compareTo(strNameLayerSource.toLowerCase()) == 0)
{
if (strResult == null)
{
strResult = strHrefCur;
continue;
}
// !!!!!!!!!!!!!
}
/*String strOut =
"strNameLayerSource=" + strNameLayerSource +
"strValueNameLayerCur=" + strValueNameLayerCur +
", strHrefCur=" + strHrefCur;
ThrProgressOgcWmsCreate._LOGGER_.info(strOut);*/
}
}
if (strResult == null)
return "";
return strResult;
}
private String _getValueNameLayerFromLegendUrl_(String strLegendUrl)
{
final String f_keyLayer = "layer=";
strLegendUrl = strLegendUrl.trim();
int intPosStart = strLegendUrl.indexOf(f_keyLayer);
intPosStart += f_keyLayer.length();
String strValueLayer = strLegendUrl.substring(intPosStart);
int intPosEnd = strValueLayer.indexOf("&");
if (intPosEnd != -1)
strValueLayer = strValueLayer.substring(0, intPosEnd);
return strValueLayer;
}
private String _createLayerLeaf_(
GfrWMSCapabilities capWms,
WMSLayerCapabilities capChild,
String strLegendUrlLayer,
ArrayList<GfrBbxLyrImgWms> altBbxs
)
throws Exception
{
// !!!!!!!!!!
//Set<WMSLayerStyle> setStyleChild = capChild.getStyles();
//if (setStyleChild == null || setStyleChild.isEmpty())
{
InfoChildWms lioLayerInfo = InfoChildWms.s_create(capWms, capChild, null);
//_tempoDumpInfos_(lioLayerInfo);
AVList lstParamsNew = lioLayerInfo.getParams();
Object objComponent = FactoryChildWms.s_create(capWms, lstParamsNew);
// current limitation
// ATTN: below: same "if" in use
// in progress, should then return GfrEmlWMSBasicElevationModel
if (objComponent == null) // elevation model
{
this._strError = "This WMS server contains at least one layer of type Elevation Layer:";
this._strError += "\n" + ". Layer's title:" + lioLayerInfo.getDisplayName();
String strNameLayer = lioLayerInfo.getLayerNames();
if (strNameLayer!=null && strNameLayer.length()>0)
this._strError += "\n" + ". Layer's name:" + strNameLayer;
this._strError += "\n\n" + "Sorry, Elevation Layers not supported yet!";
GfrPgsThrOgcWmsCreate._LOGGER_.warning(this._strError);
throw new Exception(this._strError);
}
boolean blnIsKindScaleDenominator = true;
double dblMinScale = GfrDouble.DBL_NDV;
double dblMaxScale = GfrDouble.DBL_NDV;
String strVersion = capWms.getVersion();
if (strVersion.startsWith("1.1"))
blnIsKindScaleDenominator = false;
if (! blnIsKindScaleDenominator)
{
Double douMin = capChild.getMinScaleHint();
Double douMax = capChild.getMaxScaleHint();
if (douMin!=null && douMax!=null)
{
dblMinScale = douMin.doubleValue();
dblMaxScale = douMax.doubleValue();
}
}
else
{
Double douMin = capChild.getMinScaleDenominator();
Double douMax = capChild.getMaxScaleDenominator();
if (douMin!=null && douMax!=null)
{
dblMinScale = douMin.doubleValue();
dblMaxScale = douMax.doubleValue();
}
}
String strIdLayerLeaf = _createChildLeaf_(
objComponent, lioLayerInfo,
strLegendUrlLayer, altBbxs, blnIsKindScaleDenominator, dblMinScale, dblMaxScale);
return strIdLayerLeaf;
}
/*else
{
for (WMSLayerStyle styleChildCur: setStyleChild) // !!!!!!!
{
InfoChildWms lioLayerInfo = InfoChildWms.s_create(capWms, capChild, styleChildCur);
//_tempoDumpInfos_(lioLayerInfo);
AVList lstParamsNew = lioLayerInfo.getParams();
Object objComponent = FactoryChildWms.s_create(capWms, lstParamsNew);
if (objComponent == null) // elevation model
{
continue;
}
_createChild_(objComponent, lioLayerInfo,
hstDisplayNameInUseLayer, hstDisplayNameInUseTerrain);
}
}*/
}
static private int _INT_COUNT_ = 0;
private void _tempoDumpInfos_(InfoChildWms lioCur) throws Exception
{
_INT_COUNT_ ++;
/*
* beg tempo
*/
AVList lstParamsNew = lioCur.getParams();
String strPathAbs = "C:\\_tempo\\" + _INT_COUNT_+ "_" + lioCur.getLayerNames() + ".txt";
File fle = new File(strPathAbs);
BufferedWriter out =
new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fle), "UTF8"));
Set<Map.Entry<String, Object>> setKeyToValue = lstParamsNew.getEntries();
Iterator it = setKeyToValue.iterator();
while(it.hasNext())
{
Object obj = it.next();
Map.Entry<String, Object> entCur = (Map.Entry<String, Object>) obj;
String strKey = entCur.getKey();
String strValue = (String) entCur.getValue();
out.write(strKey + ": " + strValue + "\n");
}
out.close();
/*
* end tempo
*/
}
}