Re: How to set setEndToEndMetrics through Cayenne

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Jun 12 2007 - 12:59:02 EDT

  • Next message: Fredrik Liden: "Self-join"

    Right, I overlooked that aspect. Still I think you can get access to
    the Oracle connection intercepting the Connection creation in a
    different place. The trick is to use the following PoolManager
    constructor in the factory:

       public PoolManager(ConnectionPoolDataSource, int, int, String,
    String)

    and for ConnectionPoolDataSource do something like this:

        // subclass DriverDataSource to intercept connection creation
        DriverDataSource driverDS = new DriverDataSource(jdbcDriver,
    dataSourceUrl) {
             public Connection getConnection(String userName, String password)
    throws SQLException {
                    OracleConnection c = super.getConnection(userName,
    password);
                    c.setEndToEndMetrics(...);
                    return c;
             }
        }

        ConnectionPoolDataSource poolDS = new PoolDataSource(driverDS);

    Andrus

    On Jun 12, 2007, at 7:32 PM, Daniel Uribe wrote:

    >
    > Andrus,
    >
    > We are pursuing this idea, but unfortunately it seems that the
    > connection
    > object returned from the wrapped data source (in this case, the
    > wrapped data
    > source is a PoolManager) is a ConnectionWrapper object. I can't find a
    > method in that class to retrieve the native OracleConnection to be
    > able to
    > call the 'setEndToEndMetrics' method on it.
    >
    > Any ideas?
    >
    > Thanks,
    > Daniel
    >
    >
    > Andrus Adamchik wrote:
    >>
    >> The other day I posted a DataSource customization advice in reply to
    >> a different question:
    >>
    >> http://objectstyle.org/cayenne/lists/cayenne-user/
    >> 2007/06/0039.html
    >>
    >> This approach (custom DataSourceFactory, that instantiates a
    >> DataSource wrapper that in turn would call 'setEndToEndMetrics' on
    >> every returned connection) is applicable for your case as well.
    >>
    >> Andrus
    >>
    >> P.S. Custom DataSource is a solution to like 80% of the environment
    >> integration problems. Probably need to write a detailed article on
    >> that under the user guide at http://cayenne.apache.org/doc/
    >> customizing.html
    >>
    >>
    >> On Jun 8, 2007, at 8:43 PM, Srinivas Chinthalapudi wrote:
    >>
    >>> Hi,
    >>>
    >>> In our project GLIN we would like to have a debugging mechanism
    >>> and hence
    >>> would like to pass user object or userID to be passed into the
    >>> connection as
    >>> a parameter, this can be done using the method setEndToEndMetrics
    >>> in =
    >>> oracle.jdbc.OracleConnectionWrapper. But I do not find a way in
    >>> Cayenne's
    >>> implementation where I can set these metrics into the
    >>> setEndToEndMetrics
    >>> method. I appreciate if I get some sort of hint or resolution for
    >>> the same.
    >>> --
    >>> Thanks & Regards
    >>> Sri
    >>>
    >>> The Seven Blunders of the World:
    >>>
    >>> * Wealth without work
    >>> * Pleasure without conscience
    >>> * Knowledge without character
    >>> * Commerce without morality
    >>> * Science without humanity
    >>> * Worship without sacrifice
    >>> * Politics without principle
    >>
    >>
    >>
    >
    > --
    > View this message in context: http://www.nabble.com/How-to-set-
    > setEndToEndMetrics-through-Cayenne-tf3891375.html#a11082191
    > Sent from the Cayenne - User mailing list archive at Nabble.com.
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Jun 12 2007 - 12:59:30 EDT