이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 31. Scripting
JBoss Data Grid includes a method of storing scripts on servers, allowing remote clients to execute scripts locally with the JDK's
javax.script.ScriptEngines
. By default the JDK comes with Nashorn, capable of running JavaScript; however, this may be extended to run any JVM language that offers their own ScriptEngine
.
31.1. Accessing the Script Cache 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Scripts are stored in a special, protected cache entitled
___script_cache
. As this is a protected cache only loopback requests or connections with authorization enabled will be allowed to access the cache.
The following requirements must be met to connect to the
___script_cache
remotely:
- A user has been defined with the
___script_manager
role. - The client has a secure connection to the server; this may be attained by following the instructions in Section 20.7, “Securing Interfaces”.
- Authorization has been enabled on the cache-container.
Example 31.1. Configuring the Server for Access the Script Cache
The following example covers configuring the server to access the script cache, using the
DIGEST-MD5
method of securing the Hot Rod connector.
- Add a user to the server as follows:
- Execute the
$JDG_HOME/bin/add-user.sh
(Linux) or$JDG_HOME\bin\add-user.bat
(Windows) script. - Enter
b
at the first prompt to create anApplicationRealm
user.What type of user do you wish to add? a) Management User (mgmt-users.properties) b) Application User (application-users.properties) (a): b
What type of user do you wish to add? a) Management User (mgmt-users.properties) b) Application User (application-users.properties) (a): b
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Follow the prompts to define the desired username and password for the user.
- When prompted for the groups enter
___script_manager
for this user:What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[ ]: ___script_manager
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[ ]: ___script_manager
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- Secure the communication between the client and server. As this example is using
DIGEST-MD5
the instructions in will be followed. The following snippet demonstrates the necessary xml configuration:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Create the cache manager using the secured connection, as seen in the following code snippet:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow