Thursday 7 November 2013

Setting up the GlassFish and Oracle Maps

Installing GlassFish 

To install Oracle Map Viewer version 11.1.1.7, you have to download the archive from Oracle Website.
- The archived contains GlassFish Sever.
- To download the MapViewer you have to download MapViewer Demo.
- Extract the compressed files
- Go to the config directory "...\glassfish3\glassfish\config" and edit "asenv.bat" and add

      "REM set AS_JAVA=C:\Program Files\Java\jdk1.6.0_04\jre/..
       set AS_JAVA=D:\Java\jdk1.7.0_13"

   at the end of the file.

Hint: this to point to JDK dir

- run the "runMeFirst" patch file which placed in "mapviewer11g_qs"    folder.

 Note: the default user name is "admin" and the password is "welcome1", you can change the password          by visiting the admin page of the GlassFish Server
** GlassFish now should be running, to create service for the domain, loot for my previous posts
** Mvdemo is now running but you need to set up mvdemo DB

Installing Mvdemo DB and configure it
- Make sure you have installed Oracle DB
- Create mvdemo2 DB user and set passowrd
- Download "mvdemo_naturalearth" data
- Download "mvdemo_stormdata" data
- Log into the target database as DBA, then create a DIRECTORY
        object that points to the folder where this dump file is
        located.
- SQL> grant connect, resource, create view to mvdemo2 identified by mvdemo2;
- SQL> create directory dumpdir as 'D:\SW\GIS\mvdemo_naturalearth';
- SQL> grant read, write on DIRECTORY dumpdir to mvdemo2;

- From command line, run the following impdp command:
   
impdp mvdemo2/mvdemo2 remap_schema=nedata:mvdemo2 directory=dumpdir dumpfile=mvdemo_naturalearth.dmp full=y

** You may see some error messages regarding grants and roles. They can be
ignored.

- After the import is complete, log into user mvdemo2, then run these SQL statements:
       
        SQL> insert into user_sdo_styles select * from styles;
        SQL> insert into user_sdo_themes select * from themes;
        SQL> insert into user_sdo_maps select * from basemaps;
        SQL> insert into user_sdo_cached_maps select * from tilelayers;
        SQL> commit;

- Go to bin folder in glassfish directory and run asadmin.bat
- type: "create-jdbc-connection-pool --restype javax.sql.DataSource --datasourceclassname oracle.jdbc.pool.OracleDataSource --property "user=storm:password=storm:url=jdbc\:oracle\:thin\:@127.0.0.1\:1521\:orcl" storm-pool"
- type: create-jdbc-resource --connectionpoolid storm-pool jdbc/storm

- Go to http://localhost:8080/mapviewer/    in your browser, press on Admin which in the top corner of the page, type GlassFish user name and password
press on configurations tab, and create the connection, or copy and past the following script and change the db connection to fit your configurations


 <?xml version="1.0" ?>  

  <MapperConfig>
   <logging log_level="info" log_thread_name="false"
        log_time="true">
     <log_output name="System.err" />
     <log_output name="../log/mapviewer.log" />
   </logging>
   <graphics_config>
     <default_dpi>96</default_dpi>
   </graphics_config>
  <security_config>
   <disable_direct_info_request> false </disable_direct_info_request>
   <proxy_enabled_hosts>
   </proxy_enabled_hosts>
  </security_config>  
   <spatial_data_cache  max_cache_size="64"
              report_stats="false"  
   />
  <ns_data_provider
   id="defaultNSDP"  
   class="oracle.sdovis.NSDataProviderDefault"  
  />
  <s_data_provider
   id="shapefileSDP"  
   class="oracle.sdovis.ShapefileDataProvider"  
   >
   <parameters>
    <parameter name="datadir" value="/temp/data" />
   </parameters>
  </s_data_provider>
    <map_tile_server>
     <tile_storage default_root_path="/tilecache/"/>
   </map_tile_server>
  <map_data_source name="mvdemo"
           jdbc_host="localhost"
           jdbc_sid="orcl"
           jdbc_port="1521"
           jdbc_user="mvdemo2"
           jdbc_password="QJtCtefPmSgV/Yf2V3fTMu6C/54HyL60"  
           jdbc_mode="thin"
           number_of_mappers="3"
           allow_jdbc_theme_based_foi="false"
   />
 <map_data_source name="mvdemo"
           container_ds="jdbc/mvdemo2"
           number_of_mappers="8"
           allow_jdbc_theme_based_foi="false"
           editable="false"
   />
 <map_data_source name="storm"
           jdbc_host="localhost"
           jdbc_sid="orcl"
           jdbc_port="1521"
           jdbc_user="storm"
           jdbc_password="KS66/tDP4taqvV96P8u8LGxv/mU+/gly"  
           jdbc_mode="thin"
           number_of_mappers="3"
           allow_jdbc_theme_based_foi="false"
   />
 <map_data_source name="storm"
           container_ds="jdbc/storm"
           number_of_mappers="8"
           allow_jdbc_theme_based_foi="false"
           editable="false"
   />
 </MapperConfig>


- Press on save and restart button which is at the end of the config
- go to http://localhost:8080/mvdemo/ and you will done!