Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxjDT-0007Ri-Gs for pljava-dev@arkaria.postgresql.org; Tue, 21 Jul 2020 03:45:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jxjDS-0006CH-Fg for pljava-dev@arkaria.postgresql.org; Tue, 21 Jul 2020 03:45:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxjDS-0006CA-Ay for pljava-dev@lists.postgresql.org; Tue, 21 Jul 2020 03:45:18 +0000 Received: from anastigmatix.net ([68.171.219.55]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxjDM-0002X3-8A for pljava-dev@lists.postgresql.org; Tue, 21 Jul 2020 03:45:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PGuNX4JuC5D2dqjKrqlaN7QQYu8vqlrKjO4nNIccpr8=; b=jfZQEjqWp9MflhOLkm62LeM/AN LJxoYp7bMLBleyKSg4pnIV7/KTZGW83wdk2/XiBySLnysbQTR0LkUtTuRYKAKvWk8ai/Ue7iUMQCV 7oIGkOM3a5g+IEKl+l9Jan0zMJ8SO1du8eAghyI2NSWZXKbELT3ia9YOI6U7tvYru/TkV7M1KODjz ZzXivzdbOA/LYWo5OyV72LybJWSG1wPCKynWHzQ7uS1/vXQT4p8Food3Sd1nLSoPnPBkRmSNhPbwg /EmK95Sqjk06wPujSglRf2qJN4NXW7Bq4HQPZFf645r/nwReqezaNpWM6UqIuI1ZleBSfGwnYiXWg UNG3JdnQ==; Received: from [184.19.31.139] (port=52450) by bay.acenet.us with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1jxjDK-00HXvG-8n; Mon, 20 Jul 2020 23:45:10 -0400 Subject: Re: PL/Java new build plugin To: Kartik Ohri References: <5F0E3972.5070609@anastigmatix.net> <5F0F2DA2.5090603@anastigmatix.net> <5F12FF49.6090906@anastigmatix.net> <5F12FF80.5020208@anastigmatix.net> <5F1338F8.6030506@anastigmatix.net> <5F135B84.8070302@anastigmatix.net> <5F14C34E.4020704@anastigmatix.net> <5F14E15A.4040202@anastigmatix.net> Cc: pljava-dev@lists.postgresql.org From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5F1664C5.2070700@anastigmatix.net> Date: Mon, 20 Jul 2020 23:45:09 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-95.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 07/20/20 22:51, Kartik Ohri wrote: >> >> > It is possible to have this syntax. We need to specify an executionID in > the executionBlock for that. In the plugin, we can get the entire > configuration XML as a Plexus Xpp3Dom object from which we can retrieve the > attribute from any element. I'll add this. What attribute should be used > though mimetype or engine or allow both and give engine precedence over > mimetype ? I like allowing both; giving engine preference, or just complaining if both are specified. (Or, if both are specified, look up by engine, then complain if its mimetypes don't include mimetype.) By the way, when allowing an attribute to specify the script language, it then becomes trickier to make functions available to the script by eval'ing function definitions for them, as the mojo now does; if those are in JavaScript and somebody wants to write a script block in Tcl, that'll be trouble. (Not that I have any actual plans to add Tcl scripts to this build, but....) The ScriptEngineFactory has useful methods getMethodCallSyntax and getOutputStatement, but it doesn't really have a "getWholeFunctionDeclaration" method to help out there. What I have found does work with Nashorn (haven't tried it with Graal yet) is just engine.put (or getContext().setAttribute()), passing a functional interface instance, e.g.: engine.put("quoteStringForC", (Function)PGXSUtils::quoteStringForC); I'm not sure that works with every script engine out there (but then again, neither would defining the functions as JavaScript). If it does work with both Nashorn and Graal, it seems the cleanest way. Regards, -Chap