}
@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);