|
Summary: Overwriting schema values using system properties and attributes in the space URL.
OverviewThe built-in schemas configuration covers most of the common scenarios. Overwriting Schema Values Through System PropertiesVariables are usually provided in the following form: In the schema file: <some element>..${com.gs.home}...<some element> In the script that runs, Gigaspaces will set the value for this variable in the following format: Java ... -Dcom.gs.home=./ ...
Setting Initial List of VariablesThe list of variables in the configuration can be relatively long and often requires changes to the command line arguments. To simplify that process, it is possible to load all of the variables required during instantiation of a specific GigaSpaces instance through a configuration property file. For example: <jndi> <!-- true if enabled, false otherwise --> <enabled>true</enabled> <url>localhost:10098</url> </jndi> To set the <url> value with the JVM property, modify it as follows: <url>${com.xx.localhost}</url> This value is interpreted, when parsed by GigaSpaces, to contain the value of the property com.xx.localhost. The same result can be achieved without setting this system property, but instead setting the Xpath key in the properties file/object: com.j_spaces.core.container.directory_services.jndi.url=localhost:10098 SpaceURL new ?properties optionWhile passing the ?properties=MyProps attribute to the Space URL (it does not have to come together with the ?schema= option), the system will search for the MyProps.properties file under /config/MyProps.properties according to the classpath. CLI / APIA Properties object can be created and passed to the CLI (via -properties new option) or any of the SpaceFinder.find() methods. A Properties object also can be passed via the existing JSpaceAttributes object. Jini ServiceStarterWhen the Jini ServiceStarter, JSpaceServiceImpl wrapper is used, you can pass a "properties=" together with the "schema=" attributes via the /config/services/gigaspaces.config file. The container.xml file (which is created if multiple spaces are loaded in the same container) has a new <properties> tag in case a user wants to specify a properties file with details to overwrite the space <schema> details, e.g : <?xml version="1.0"?> <container1> <JSpaces> <sp1> <schema>cache</schema> <properties>myOverwrittenProps</properties> <load-on-startup>true</load-on-startup> </sp1> <sp2> <schema>persistent</schema> <properties>sp2</properties> <load-on-startup>true</load-on-startup> </sp2> ... Default gs.properties File ExampleWhen specifying a space URL, you may use the properties file or have as part of the container file the <properties> tag. This should include a properties file location with a list of properties that override the cluster, container, and space default values. # ================================================================================== # GigaSpaces configuration overwriting file, used for overwrite # the space and container schema properties as well as other system properties. # If client has requested to load a properties file (or passed a Properties java object), we attempt to load the properties file # from <GS dir>/config (if <GS dir> is in the classpath) or from an http url. # if it is found, we load it to the system, set these attributes to the SpaceURL # properties data structure. # Any system property set overwrites any other settings; the Properties file (or user defined # custom Properties object which might be passed) is then parsed, its properties are injected to the system # and later used to override the space/container/cluster configurations, as well as other VM system properties. # # The following types of properties are supported as part of the properties object/file: # ====================================================================================== # 1. space/container configuration - the prop key is the XPath of the element as it set in the space/ container schema xml file. # e.g. For space config: space-config.lrmi-stub-handler.protocol-name=rmi # e.g. For container config: com.j_spaces.core.container.directory_services.jini_lus.enabled=false # # 2. cluster configuration - the prop key is the system property set into the ${elementname} in the cluster schema xml file. # 3. System properties - the key must start with -D, and indicates the system to set that key/value as a system property. # 4. SpaceURL attributes - the key must start with gs.space.url.arg.<atribute name> e.g. gs.space.url.arg. total_members=111 # or gs.space.url.arg_line=schema=persistent&cluster_schema=async_replicated&total_members= 3&id=2&nowritelease=true&fifo=true&create # - The space url args should be all in lower case. # - Usage of the ${xxx} setting via a system property is valid in any scenario, but that will be overwritten if option number 1 is used. # # # #=================================================== # Space and container XPath PROPERTIES: #=================================================== ## Cluster config related settings: # To enable the cluster #space-config.cluster.enabled=true #The static members cluster xml file needs to be located in <root dir>/config folder, e.g. #c:/myFloder/config/multi-site and the c:/myFloder needs to be added #space-config.cluster.config-url=/config/multi-site #### Examples for other optional cluster config urls: #space-config.cluster.config-url=/config/gershonsTest-cluster-config.xml/config/gershonsTest-cluster.xml #space-config.cluster.config-url=D:\\GigaSpacesEAG4.1\\config\\default-cluster.xml #space-config.cluster.config-url=/config/default #space-config.cluster.config-url=/config/myAsyncRepl-cluster.xml # Moving GigaSpaces Log into debug level [5] #com.j_spaces.kernel.log.cache.detail_level=5 ## Types of supported loggers com.j_spaces.kernel.log.FileLogDriver;System.out; com.j_spaces.kernel.log.Log4jDriver #com.j_spaces.kernel.log.cache.output.classes=com.j_spaces.kernel.log.FileLogDriver;System.out #com.j_spaces.kernel.log.enabled=false # To disable GigaSpaces shutdown hook #com.j_spaces.core.container.shutdown_hook=false ##### Jini Lookup service container config related: #com.j_spaces.core.container.directory_services.jini_lus.start-embedded-lus=false #com.j_spaces.core.container.directory_services.jini_lus.enabled=false #com.j_spaces.core.container.directory_services.jini_lus.unicast_discovery.enabled=true #com.j_spaces.core.container.directory_services.jini_lus.unicast_discovery.lus_host=host:port #to overwrite the space config implicit-indexes just add the line: #space-config.number-implicit-indexes=-1 #to overwrite the space config lrmi protocol #space-config.lrmi-stub-handler.protocol-name=rmi #to overwrite the space config serialization-type just add the line: #space-config.serialization-type=0 #=================================================== # SYSTEM PROPERTIES: #=================================================== # RECOMMENDED: Common RMI related system properties settings # #When it is necessary to ensure that DGC clean calls for unreachable remote references #are delivered in a timely fashion, the value of this property represents the maximum interval #(in milliseconds) that the Java RMI runtime will allow between garbage collections of the local heap. #The default value is 60000 milliseconds (60 seconds). -Dsun.rmi.dgc.client.gcInterval=600000 -Dsun.rmi.dgc.server.gcInterval=600000 #-Djava.rmi.server.RMIClassLoaderSpi=default #if this value is true, incoming calls and exceptions thrown from incoming calls will be logged to System.err. #Setting this property to true will greatly assist you in debugging your RMI programs. #-Djava.rmi.server.logCalls=true #If this value is true, details of rmid's logging activity are sent to System.err. #-Dsun.rmi.log.debug=true #-Dcom.gs.onewaywrite=true ## Common debugging logging options: # RECOMMENDED: To turn on the Webster HTTP web server logging #-Dorg.jini.rio.tools.webster.debug=true # RECOMMENDED: set to true to see the cluster configuration debug output #-Dcom.gs.clusterXML.debug=true # RECOMMENDED: To enable client side logging #-Dcom.gs.client.debug=true # RECOMMENDED:setting the system property of the jini Java logging file location. Use it to enable finest logging trubelshooting. #-Djava.util.logging.config.file=${com.gs.home}/config/services/gs_jini_logging.properties #set the cluster member url's prefix #-Dcom.gs.cluster.url-protocol-prefix=rmi://localhost:10098 #to set the license key #-Dcom.gs.licensekey= #-Dcom.gs.home=C:\GigaSpacesCache5.0 #=================================================== # Space URL attributes: #=================================================== #gs.space.url.arg.total_members=10 #gs.space.url.arg.id=2 #gs.space.url.arg.schema=persistent #gs.space.url.arg.nowritelease=true #Other optional attributes (add each to the gs.space.url.arg. prefix): #backup_id, clustergroup, clustername, cluster, cluster_schema, groups, fifo #updatemode, versioned, uselocalcache, timeout, securitymanager, nocache, create, destroy # Example how to set a list of Space URL attributes: #gs.space.url.arg_line=schema=persistent&id=2&total_members=10&Create |
Wiki Content Tree
Your Feedback Needed!
We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at techw@gigaspaces.com. Please provide a link to the wiki page you are referring to.
Add Comment