Re: [JPP-Devel] Adding other spatial databases support in OJ core

2015-12-17 Thread edgar . soldin
On 17.12.2015 07:21, Rahkonen Jukka (MML) wrote:
> edgar soldin wrote: 
> 
>> just assumed because of
>> https://sourceforge.net/p/jump-pilot/code/HEAD/tree/core/trunk/src/com/vividsolutions/jump/datastore/spatialite/SpatialiteDataStoreDriver.java#l69
>> "new SQLiteConfig().enableLoadExtension(true);"
>> but obviously this just autoloads the sqlite native libs.
> 
> SQLite has two steps for increasing security:
> - If SQLite is compiled with  SQLITE_OMIT_LOAD_EXTENSION it will be 
> impossible to load extensions
> - If the use of LOAD_EXTENSION is allowed "enableLoadExtension()" must still 
> be called first
> - Only after that it is possible to load extension. There are couple of ways 
> to do that including SELECT load_extension(). The setting is off by default. 
> Notice that end user can also enter SQL with "SELECT load_extension()". 
> 
> Enabling load_extension is only on or off and when when OpenJUMP enables 
> loading mod_spatialite it allows loading any other extension to the same 
> connection as well. It is hard to see that as a security risk for OpenJUMP. 
> 
> http://www.sqlite.org/loadext.html
> http://www.sqlite.org/c3ref/enable_load_extension.html

thanks, well explained.. ede

--
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] SVN: [4630] core/trunk/src/com/vividsolutions/jump

2015-12-17 Thread jump-pilot-svn
Revision: 4630
  http://sourceforge.net/p/jump-pilot/code/4630
Author:   edso
Date: 2015-12-17 18:58:28 + (Thu, 17 Dec 2015)
Log Message:
---
allow loading of jdbc drivers from lib/ext/

Modified Paths:
--

core/trunk/src/com/vividsolutions/jump/datastore/oracle/OracleValueConverterFactory.java

core/trunk/src/com/vividsolutions/jump/datastore/spatialdatabases/SpatialDatabasesDataStoreDriver.java

core/trunk/src/com/vividsolutions/jump/datastore/spatialite/SpatialiteDataStoreDriver.java
core/trunk/src/com/vividsolutions/jump/workbench/plugin/PlugInManager.java

Added Paths:
---
core/trunk/src/com/vividsolutions/jump/datastore/jdbc/DelegatingDriver.java

Added: 
core/trunk/src/com/vividsolutions/jump/datastore/jdbc/DelegatingDriver.java
===
--- core/trunk/src/com/vividsolutions/jump/datastore/jdbc/DelegatingDriver.java 
(rev 0)
+++ core/trunk/src/com/vividsolutions/jump/datastore/jdbc/DelegatingDriver.java 
2015-12-17 18:58:28 UTC (rev 4630)
@@ -0,0 +1,59 @@
+package com.vividsolutions.jump.datastore.jdbc;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+/**
+ * a jdbc driver wrapper to allow loading the driver with custon classloader
+ * from an arbitrary location during runtime. 
+ * DatabaseManager.registerDriver() only registers drivers loaded with the
+ * system classloader so we trick it into accepting our driver by wrapping it
+ * into this one.
+ *
+ * @see
+ *   
https://stackoverflow.com/questions/288828/how-to-use-a-jdbc-driver-from-an-arbitrary-location
+ */
+public class DelegatingDriver implements Driver {
+  private final Driver driver;
+
+  public DelegatingDriver(Driver driver) {
+if (driver == null) {
+  throw new IllegalArgumentException("Driver must not be null.");
+}
+this.driver = driver;
+  }
+
+  public Connection connect(String url, Properties info) throws SQLException {
+return driver.connect(url, info);
+  }
+
+  public boolean acceptsURL(String url) throws SQLException {
+return driver.acceptsURL(url);
+  }
+
+  public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
+  throws SQLException {
+return driver.getPropertyInfo(url, info);
+  }
+
+  public int getMajorVersion() {
+return driver.getMajorVersion();
+  }
+
+  public int getMinorVersion() {
+return driver.getMinorVersion();
+  }
+
+  public boolean jdbcCompliant() {
+return driver.jdbcCompliant();
+  }
+
+  public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+return driver.getParentLogger();
+  }
+}
\ No newline at end of file


Property changes on: 
core/trunk/src/com/vividsolutions/jump/datastore/jdbc/DelegatingDriver.java
___
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: 
core/trunk/src/com/vividsolutions/jump/datastore/oracle/OracleValueConverterFactory.java
===
--- 
core/trunk/src/com/vividsolutions/jump/datastore/oracle/OracleValueConverterFactory.java
2015-12-16 12:15:55 UTC (rev 4629)
+++ 
core/trunk/src/com/vividsolutions/jump/datastore/oracle/OracleValueConverterFactory.java
2015-12-17 18:58:28 UTC (rev 4630)
@@ -5,6 +5,8 @@
 import com.vividsolutions.jump.datastore.jdbc.ValueConverterFactory;
 import 
com.vividsolutions.jump.datastore.spatialdatabases.SpatialDatabasesValueConverterFactory;
 import com.vividsolutions.jump.feature.AttributeType;
+import com.vividsolutions.jump.workbench.JUMPWorkbench;
+
 import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
@@ -33,20 +35,29 @@
 IllegalAccessException, IllegalArgumentException,
 InvocationTargetException {
   Object geometryObject = rs.getObject(columnIndex);
-  Class converterClazz = Class
-  .forName("org.geotools.data.oracle.sdo.GeometryConverter");
-  Class connectionClazz = Class.forName("oracle.jdbc.OracleConnection");
-  Class structClazz = Class.forName("oracle.sql.STRUCT");
+
+  // we need to use the plugin classloader to find the dependenciy
+  // jars under lib/ext// , additionally we apply some
+  // reflection to allow the dependencies to be only available
+  // during runtime
+  ClassLoader cl = JUMPWorkbench.getInstance().getPlugInManager()
+  .getClassLoader();
+  Class converterClazz = Class.forName(
+  "org.geotools.data.oracle.sdo.GeometryConverter", true, cl);
+  Class connectionClazz = Class.forName("oracle.jdbc.OracleConnection",
+  true, cl);
+  Class structClazz = Class.forName("oracle

Re: [JPP-Devel] New improvement on Raster Style by Alberto

2015-12-17 Thread Giuseppe Aruta
Hi Alberto,
I did a couple of tests, following this schema
a) I opened  a jump project
b) loaded one or two raster and applied different color simbologies
c) saved and closed the project
d) loaded the project again
It seems that everything works fine.
Very nice work
Best regards (from Chile)
Peppe

2015-12-16 11:04 GMT+01:00 :

> On 15.12.2015 18:54, Alberto De Luca wrote:
> > Hi there.
> >
> > I've added today the capability to save the raster symbology in the
> OpenJUMP project file. I'd like to ask you a couple of things though:
> > - is it too late to add it now? I'm not sure, but I might have read in
> some posts that the features are frozen by now;
>
> i called  it a soft freeze;).. so nothing made out of stone. generally, as
> the next release is around the corner, we should clean up, translate and do
> not start big reworks.
>
> adding features (alas not perfect) or fixing bugs is totally fine. we can
> easily release a maintenance version when users stumble over show stoppers.
>
> i plan to release during the holidays, but hey, if it gets january because
> we fixed/added some more that's fine for everybody i guess.
>
> so, no problemo.. ede
>
> > - if the answer is no, would someone be so kind (Peppe!!!) to test the
> feature a bit before I commit the changes? I had to modify a few classes,
> I'd like to be sure I haven't broken anything... If so, you can find the
> compiled openjump jar here:
> >
> >
> > https://www.dropbox.com/s/zf1eshbiuucohck/OpenJUMP-0.0.0-rnull.jar?dl=0
> >
> >
> > Cheers
> > Alberto
> >
> > On 19 November 2015 at 21:56, Alberto De Luca  > wrote:
> >
> > Hey Peppe,
> >
> > thank you. I know having the raster symbologies saved with the
> project would be nice. I haven't had the chance to work on it yet and
> honestly I've no idea about how much effort it'd required... I'll have a
> look at it.
> >
> > Alberto
> >
> >
> > On Thu, 19 Nov 2015 19:12 Giuseppe Aruta  > wrote:
> >
> > Nice addiction to Raster Style, Alberto!
> > There are new color palettes and the possibility to save raster
> styles as SLD files (I saw the code. I  think I will  add this option also
> to Export file to raster plugins).
> > I was studying your code using RasterColorEditorPanel as a test.
> I think we can deactivate this class on next OJ realize as this last is a
> duplicate but yours is better working.
> > We also should start to translate before the new OJ realize
> > Just a question: do you think it is possible for you to add the
> capability to save raster styles also to OpenJUMP file project?
> > Best regards and thanks
> > Peppe
> >
>  
> --
> > ___
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net  Jump-pilot-devel@lists.sourceforge.net>
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
> >
> >
> >
> >
> --
> >
> >
> >
> > ___
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
>
>
> --
> ___
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
--
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel