Thanks.  Looking to simplify this yet more.  The solution below would still 
require me to modify the datastore setup page in geoserver so the page would 
let  me request a proxy session be created.  And that doesn’t seem like a great 
thing to add to the core product because it’s only relevant to Oracle – i.e. 
Geoserver already has support for proxy sessions as long as the database 
supports the SET SESSION AUTHORIZATION statement, which Oracle does not.

How ‘bad’ would be if I modified the geotools SessionCommandsListener to 
specifically check for SET SESSION AUTHORIZATION being the statement getting 
executed?  When found, this is a directly executed pass-thru for non-Oracle 
dialect but for Oracle this uses their proprietary API to do the equivalent.

Then geoserver stays totally like it is.

Thoughts?

Walter

From: andrea.a...@gmail.com [mailto:andrea.a...@gmail.com] On Behalf Of Andrea 
Aime
Sent: Wednesday, June 15, 2016 12:11 PM
To: Walter Stovall <walter.stov...@byers.com>
Cc: geoserver-devel@lists.sourceforge.net
Subject: Re: [Geoserver-devel] FW: Managing Oracle connections to different 
schemas of the same database instance can't be done with the current geoserver

On Wed, Jun 15, 2016 at 5:28 PM, Walter Stovall 
<walter.stov...@byers.com<mailto:walter.stov...@byers.com>> wrote:
Andrea, based on your note about changing SQLDialect to support starting and 
ending an Oracle proxy session I’m looking for the best place to hook into the 
geotools code for invoking this.

Looking at the JDBCDataStore.createDataStore() method, I see where it creates a 
ConnectionLifecycleListener based on Map entries for 
SQL_ON_BORROW/SQL_ON_CONNECT.  It would seem that at this time, I could check 
for a Map entry that requests a proxy session.  When found, I create 
(potentially another) ConnectionLifecycleListener whose job it is to start/end 
the proxy session.  As you say, actually starting the proxy session would be 
implemented inside the SQLDialect and in my case, the OracleSQLDialect.

Seems like a good approach to me. I'd extend the OracleDataStoreFactory with 
one or more extra parameter that enables proxy connection, and that are given
the name of the env variable(s) you need to pass down, and if those are setup, 
then add your own custom listener to the store:
https://github.com/geotools/geotools/blob/master/modules/plugin/jdbc/jdbc-oracle/src/main/java/org/geotools/data/oracle/OracleNGDataStoreFactory.java

Maybe following this approach you don't even need to modify the SQLDialect class

Ah, you'll need to unwrap the connection from the pool via the Unwrappers, the 
Oracle store contains code already calling them (the pooled connection
wrap the Oracle one, but you need the native one). Given there are many 
connection pools we have an extension point for that.
See: 
https://github.com/geotools/geotools/blob/master/modules/plugin/jdbc/jdbc-oracle/src/main/java/org/geotools/data/oracle/OracleDialect.java#L617

Cheers
Andrea

PS: what you add to the main data store factory should also be added to the 
JNDI one (and probably to the OCI one, although I'm not sure about that one).

--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i 
file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo 
è consentito esclusivamente al destinatario del messaggio, per le finalità 
indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne 
il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di 
procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro 
sistema. Conservare il messaggio stesso, divulgarlo anche in parte, 
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, 
costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.



The information in this message and/or attachments, is intended solely for the 
attention and use of the named addressee(s) and may be confidential or 
proprietary in nature or covered by the provisions of privacy act (Legislative 
Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in 
accord with its purpose, any disclosure, reproduction, copying, distribution, 
or either dissemination, either whole or partial, is strictly forbidden except 
previous formal approval of the named addressee(s). If you are not the intended 
recipient, please contact immediately the sender by telephone, fax or e-mail 
and delete the information in this message that has been received in error. The 
sender does not give any warranty or accept liability as the content, accuracy 
or completeness of sent messages and accepts no responsibility  for changes 
made after they were sent or for other risks which arise as a result of e-mail 
transmission, viruses, etc.

-------------------------------------------------------
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to