Package it.eng.spagobi.engines.geo

Examples of it.eng.spagobi.engines.geo.GeoEngineException


   
    try {
      geoEngineComponent = (IGeoEngineComponent) Class.forName(geoEngineComponentClassName).newInstance();
    } catch (InstantiationException e) {
      logger.error("Impossible to instatiate component of type: " + geoEngineComponentClassName);
      throw new GeoEngineException("Impossible to instatiate component of type: " + geoEngineComponentClassName, e);
    } catch (IllegalAccessException e) {
      logger.error("Impossible to instatiate component of type: " + geoEngineComponentClassName);
      throw new GeoEngineException("Impossible to instatiate component of type: " + geoEngineComponentClassName, e);
    } catch (ClassNotFoundException e) {
      GeoEngineException geoException;
      logger.error("Impossible to instatiate component of type: " + geoEngineComponentClassName);
      String description = "Impossible to instatiate component of type: " + geoEngineComponentClassName;
      List hints = new ArrayList();
      hints.add("Check if the class name is wrong or mispelled");
      hints.add("Check if the class is on the class path");
      geoException =  new GeoEngineException("Impossible to instatiate component", e);
      geoException.setDescription(description);
      geoException.setHints(hints);
      throw geoException;
    }
   
    logger.debug("Component " + geoEngineComponentClassName + " created succesfully");
    geoEngineComponent.setEnv(env);
View Full Code Here


     
    try {
      map = mapCatalogueServiceProxy.readMap(mapName);     
    } catch (Exception e) {
      logger.error("An error occurred while invoking mapCatalogueService method: readMap()");
      throw new GeoEngineException("Impossible to load map from map catalogue", e);
    }
   
    try {
     
      svgDocument = svgMapLoader.loadMapAsDocument(map);
    } catch (IOException e) {
      logger.error("Impossible to load map from map catalogue");
      throw new GeoEngineException("Impossible to load map from map catalogue", e);
    }
   
   
    logger.debug("OUT");
   
View Full Code Here

   
    try {
      mapUrl = mapCatalogueServiceProxy.getMapUrl(mapName);
    } catch (Exception e) {
      logger.error("An error occurred while invoking mapCatalogueService method: getMapUrl()");
      throw new GeoEngineException("Impossible to load map from url: " + mapUrl, e);
    }
   
    try {
      streamReader = SVGMapLoader.getMapAsStream(mapUrl);
    } catch (XMLStreamException e) {
      logger.error("An error occurred while processing xml stream of the svg map");
      throw new GeoEngineException("An error occurred while processing xml stream of the svg map", e);
    } catch (FileNotFoundException e) {
      logger.error("Map file not found at url: " + mapUrl);
      throw new GeoEngineException("Map file not found at url: " + mapUrl, e);
    }
   
   
    return streamReader;
  }
View Full Code Here

    if(conf instanceof String) {
      try {
        confSB = SourceBean.fromXMLString( (String)conf );
      } catch (SourceBeanException e) {
        logger.error("Impossible to parse configuration block for MapProvider", e);
        throw new GeoEngineException("Impossible to parse configuration block for MapProvider", e);
      }
    } else {
      confSB = (SourceBean)conf;
    }
   
View Full Code Here

    if(conf instanceof String) {
      try {
        confSB = SourceBean.fromXMLString( (String)conf );
      } catch (SourceBeanException e) {
        logger.error("Impossible to parse configuration block for MapRenderer", e);
        throw new GeoEngineException("Impossible to parse configuration block for MapRenderer", e);
      }
    } else {
      confSB = (SourceBean)conf;
    }
  }
View Full Code Here

    if(conf instanceof String) {
      try {
        confSB = SourceBean.fromXMLString( (String)conf );
      } catch (SourceBeanException e) {
        logger.error("Impossible to parse configuration block for MapRenderer", e);
        throw new GeoEngineException("Impossible to parse configuration block for MapRenderer", e);
      }
    } else {
      confSB = (SourceBean)conf;
    }
   
View Full Code Here

    // load master map
    try {
      loadMasterMapTotalTimeMonitor = MonitorFactory.start("GeoEngine.drawMapAction.renderMap.loadMasterMap");
      masterMap = svgMapLoader.loadMapAsDocument(getMasterMapFile(true));
    } catch (IOException e) {
      GeoEngineException geoException;
      logger.error("Impossible to load map from file: " + getMasterMapFile(true));
      String description = "Impossible to load map from file: " + getMasterMapFile(true);
      geoException = new GeoEngineException("Impossible to render map", e);
      geoException.setDescription(description);
      throw  geoException;
    } finally {
      if(loadMasterMapTotalTimeMonitor != null) loadMasterMapTotalTimeMonitor.stop();
    }

    // load target map
    try {
      loadTargetMapTotalTimeMonitor = MonitorFactory.start("GeoEngine.drawMapAction.renderMap.loadTargetMap");
      targetMap = mapProvider.getSVGMapDOMDocument()
    }finally {
      if(loadTargetMapTotalTimeMonitor != null) loadTargetMapTotalTimeMonitor.stop();
    }

    // marge and decorate map
    try {

      margeAndDecorateMapTotalTimeMonitor = MonitorFactory.start("GeoEngine.drawMapAction.renderMap.margeAndDecorateMap");

      addData(targetMap, dataMart);
      addLink(targetMap, dataMart);


      SVGMapMerger.margeMap(targetMap, masterMap, null, "targetMap");

      if( includeScript ) {
        includeScripts(masterMap);
      } else {
        importScripts(masterMap);
      }


      setMainMapDimension(masterMap, targetMap);

      Element scriptInit = masterMap.getElementById("init");     
      Node scriptText = scriptInit.getFirstChild();

      JSONObject conf = new JSONObject();     

      JSONArray measures;
      try {
        measures = getMeasuresConfigurationScript(dataMart);
        String selectedMeasureName = getSelectedMeasureName();
        logger.debug("Selected measure [" + selectedMeasureName + "]");
        Assert.assertTrue(selectedMeasureName != null, "default_kpi attribute cannot be null. Please add it to MEASURES tag in your template file");
       
       
        int selectedMeasureIndexIndex = -1;
        for(int i = 0; i < measures.length(); i++) {
          JSONObject measure = (JSONObject)measures.get(i);
          logger.debug("Comparing selected measure [" + selectedMeasureName + "] with measure [" + (String)measure.get("name") + "]");
          String nm = (String)measure.get("name");
          if(selectedMeasureName.equalsIgnoreCase( nm)) {
            logger.debug("Selected measure [" + selectedMeasureName + "] is equal to measure [" + (String)measure.get("name") + "]");
            selectedMeasureIndexIndex = i;
            break;
          }
        }
        logger.debug("Selected measure index [" + selectedMeasureIndexIndex + "]");
        conf.put("selected_measure_index", selectedMeasureIndexIndex);
        conf.put("measures", measures);

        JSONArray layers =  getLayersConfigurationScript(targetMap);
        String targetLayer = datamartProvider.getSelectedLevel().getFeatureName();
        int targetLayerIndex = -1;
        for(int i = 0; i < layers.length(); i++) {
          JSONObject layer = (JSONObject)layers.get(i);

          if(targetLayer.equals( layer.get("name"))) {
            targetLayerIndex = i;
            break;
          }
        }
        conf.put("target_layer_index", targetLayerIndex);
        conf.put("layers", layers);


        JSONObject guiSettings =  getGUIConfigurationScript();
        guiSettings.put("includeChartLayer", getLayer("grafici")!=null);
        guiSettings.put("includeValuesLayer", getLayer("valori")!=null);
        conf.put("gui_settings", guiSettings);

        String execId = (String)this.getEnv().get("SBI_EXECUTION_ID");
        conf.put("execId", execId);

        JSONObject localeJSON =  new JSONObject();
        Locale locale = (Locale) this.getEnv().get(EngineConstants.ENV_LOCALE);
        logger.debug("Current environment locale is: " + locale);
        if (locale == null) {
          logger.debug("Using default english locale");
          locale = Locale.ENGLISH;
        }
        localeJSON.put("language", locale.getLanguage());
        localeJSON.put("country", locale.getCountry());
        DecimalFormatSymbols dfs = new DecimalFormatSymbols(locale);
        localeJSON.put("decimalSeparator", new Character(dfs.getDecimalSeparator()).toString());
        localeJSON.put("groupingSeparator", new Character(dfs.getGroupingSeparator()).toString());
        conf.put("locale", localeJSON);
      } catch (JSONException e1) {
        GeoEngineException geoException;
        logger.error("Impossible to create sbi.geo.conf", e1);
        String description = "Impossible to create sbi.geo.conf";
        geoException = new GeoEngineException("Impossible to create sbi.geo.conf", e1);
        geoException.setDescription(description);
        throw  geoException;
      }

      scriptText.setNodeValue( "sbi = {};\n sbi.geo = {};\n sbi.geo.conf = " + conf.toString() );


      try {
        tmpMap = getTempFile();
      } catch (IOException e) {
        GeoEngineException geoException;
        logger.error("Impossible to create a temporary file", e);
        String description = "Impossible to create a temporary file";
        geoException = new GeoEngineException("Impossible to render map", e);
        geoException.setDescription(description);
        throw  geoException;
      }catch (Throwable t) {
        GeoEngineException geoException;
        logger.error("Impossible to create a temporary file", t);
        String description = "Impossible to create a temporary file";
        geoException = new GeoEngineException("Impossible to render map", t);
        geoException.setDescription(description);
        throw  geoException;
      }       
      try {
        SVGMapSaver.saveMap(masterMap, tmpMap);
      } catch (FileNotFoundException e) {
        GeoEngineException geoException;
        logger.error("Impossible to save map on temporary file " + tmpMap, e);
        String str = e.getMessage()!=null?e.getMessage():e.getClass().getName();
        String description = "Impossible to save map on temporary file " + tmpMap + ". Root cause: " + str;
        geoException = new GeoEngineException("Impossible to render map", e);
        geoException.setDescription(description);
        throw  geoException;
      } catch (TransformerException e) {
        GeoEngineException geoException;
        logger.error("Impossible to save map on temporary file " + tmpMap, e);
        String str = e.getMessage()!=null?e.getMessage():e.getClass().getName();
        String description = "Impossible to save map on temporary file " + tmpMap + ". Root cause: " + str;
        geoException = new GeoEngineException("Impossible to render map",  e);
        geoException.setDescription(description);
        throw  geoException;
      }catch (Throwable t) {
        GeoEngineException geoException;
        logger.error("Impossible to save map on temporary file " + tmpMap, t);
        String str = t.getMessage()!=null?t.getMessage():t.getClass().getName();
        String description = "Impossible to save map on temporary file " + tmpMap + ". Root cause: " + str;
        geoException = new GeoEngineException("Impossible to render map",  t);
        geoException.setDescription(description);
        throw  geoException;
      }
    } finally {
      if(margeAndDecorateMapTotalTimeMonitor != null) margeAndDecorateMapTotalTimeMonitor.stop();
    }
View Full Code Here

    targetMap = mapProvider.getSVGMapDOMDocument();   
    try {
      masterMap = svgMapLoader.loadMapAsDocument(getMasterMapFile(false));
    } catch (IOException e) {
      GeoEngineException geoException;
      logger.error("Impossible to load map from file: " + getMasterMapFile(true));
      String description = "Impossible to load map from file: " + getMasterMapFile(true);
      geoException =  new GeoEngineException("Impossible to render map", e);
      geoException.setDescription(description);
      throw  geoException;
    }

    decorateMap(masterMap, targetMap, datamart);

    SVGMapMerger.margeMap(targetMap, masterMap, null, "targetMap");

    setMainMapDimension(masterMap, targetMap);
    //setMainMapBkgRectDimension(masterMap, targetMap);  

    File tmpMap;
    try {
      tmpMap = getTempFile();
    } catch (IOException e) {
      GeoEngineException geoException;
      logger.error("Impossible to create a temporary file", e);
      String description = "Impossible to create a temporary file";
      geoException = new GeoEngineException("Impossible to render map", e);
      geoException.setDescription(description);
      throw  geoException;
    }       
    try {
      SVGMapSaver.saveMap(masterMap, tmpMap);
    } catch (FileNotFoundException e) {
      GeoEngineException geoException;
      logger.error("Impossible to save map on temporary file " + tmpMap, e);
      String str = e.getMessage()!=null?e.getMessage():e.getClass().getName();
      String description = "Impossible to save map on temporary file " + tmpMap + ". Root cause: " + str;
      geoException = new GeoEngineException("Impossible to render map", e);
      geoException.setDescription(description);
      throw  geoException;
    } catch (TransformerException e) {
      GeoEngineException geoException;
      logger.error("Impossible to save map on temporary file " + tmpMap, e);
      String str = e.getMessage()!=null?e.getMessage():e.getClass().getName();
      String description = "Impossible to save map on temporary file " + tmpMap + ". Root cause: " + str;
      geoException = new GeoEngineException("Impossible to render map", e);
      geoException.setDescription(description);
      throw  geoException;
    }

    return tmpMap;
  }
View Full Code Here

      mainMapBlock = masterMap.getElementById("mainMap");
      mainMapBlock.setAttribute("viewBox", viewBox);
      masterMap.getRootElement().setAttribute("viewBox", 0 + " " + 0 + " 1100 " + mainMapHeight);
    } catch(Throwable t) {
      if(t instanceof GeoEngineException) throw (GeoEngineException)t;
      throw new GeoEngineException("An unpredicted error occurred while setting up main map viewbox attribute");
    } finally {
      logger.debug("OUT");
    }
  }
View Full Code Here

          logger.warn("trying to load data...");
        dataSet.loadData();
        logger.warn("success!!");
      } catch (Throwable e) {
        logger.error("failure!!",e);
        throw new GeoEngineException("Impossible to load data from dataset");
      }
       
      IDataStore dataStore = dataSet.getDataStore();
      IDataStoreMetaData dataStoreMeta = dataStore.getMetaData();
      dataStoreMeta.setIdField( dataStoreMeta.getFieldIndex( getSelectedLevel().getColumnId() ));
   
      dataMart = new DataMart();
      dataMart.setDataStore(dataStore);
      try {

        dataMart.setTargetFeatureName( getSelectedLevel().getFeatureName() );              
            String columnid = getSelectedLevel().getColumnId();           
            String[] measureColumnNames = (String[])getMetaData().getMeasureColumnNames().toArray(new String[0]);       
                      
             
              Iterator it = dataStore.iterator();
              while(it.hasNext()) {
                IRecord record = (IRecord)it.next();
               
                IField field;
               
                field = record.getFieldAt( dataStoreMeta.getFieldIndex(columnid) );
                String id = "" + field.getValue();
                if((id==null) || (id.trim().equals(""))) {
                  continue;
                }
                dataStoreMeta.getFieldMeta( dataStoreMeta.getFieldIndex(columnid) ).setProperty("ROLE", "GEOID");
               
                for(int i = 0; i < measureColumnNames.length; i++) {
                  field = record.getFieldAt( dataStoreMeta.getFieldIndex(measureColumnNames[i]) );
                    String value = "" + field.getValue();
                    if((value==null) || (value.trim().equals(""))) {
                      continue;
                    }
                    dataStoreMeta.getFieldMeta( dataStoreMeta.getFieldIndex(measureColumnNames[i]) ).setProperty("ROLE", "MEASURE");
                   
                }
              }
             
              IDataStoreTransformer dddLinkFieldTransformer = new AddLinkFieldsTransformer(measureColumnNames, getSelectedLevel(), this.getEnv());
              dddLinkFieldTransformer.transform(dataStore);
          } catch (Exception e) { 
        logger.error(e.getMessage());
        throw new GeoEngineException("Impossible to get DataMart");
          }       
      } 
     
      return dataMart;        
    }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.engines.geo.GeoEngineException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.