Implementation to transfer properties to a stream using templates to define the output format.
Add this dependency to the smartics-properties-maven-plugin:
<plugin> <groupId>de.smartics.properties</groupId> <artifactId>smartics-properties-maven-plugin</artifactId> <version>/add current version here/</version> <executions> ... as shown in the next sections ... </executions> <dependencies> <dependency> <groupId>de.smartics.properties</groupId> <artifactId>smartics-properties-transfer-templatestream</artifactId> <version>0.2.0-SNAPSHOT</version> </dependency> </dependencies> </plugin>
If you have more than one execution, you may move the basic configuration outside the execution block:
<plugin> <groupId>de.smartics.properties</groupId> <artifactId>smartics-properties-maven-plugin</artifactId> <version>/add current version here/</version> <executions> ... as shown in the next sections ... </executions> <dependencies> ... as shown above ... </dependencies> <configuration> <artifactItems> ... OPTIONAL: add any artifacts with property definitions here ... </artifactItems> <definitionConfigParser implementation="de.smartics.properties.impl.config.domain.key.rtaware.TenantUserDefinitionConfigParser" /> </configuration>
Use the Definition Config Parser (used to parse the definition.xml) that suites your needs. The config parser has to match the namespace given in the definition.xml files.
The following configuration generates an SQL script to run on a MySQL database:
<plugin> <groupId>de.smartics.properties</groupId> <artifactId>smartics-properties-maven-plugin</artifactId> <version>/add current version here/</version> <executions> <execution> <id>sql-export</id> <phase>prepare-package</phase> <goals> <goal>properties-transfer</goal> </goals> <configuration> <propertySinkFactory implementation="de.smartics.properties.config.transfer.templatestream.MySqlFactory"> <file>${project.build.directory}/mysql-export.sql</file> </propertySinkFactory> </configuration> </execution> </executions> <dependencies> ... as shown above ... </dependencies> <configuration> ... as shown above ... </configuration> </plugin>
Here is an example output:
-- mail/configuration-mail.properties INSERT INTO config VALUES ('//test:mail/de.smartics.sandbox:mail-server:','mail.server.gui','https://${mail.server.url}/index.html') ON DUPLICATE KEY UPDATE value = 'https://${mail.server.url}/index.html'; INSERT INTO config VALUES ('//test:mail/de.smartics.sandbox:mail-server:','mail.server.url','mail.example.com') ON DUPLICATE KEY UPDATE value = 'mail.example.com'; INSERT INTO config VALUES ('//test:mail/de.smartics.sandbox:mail-server:','mail.mailsPerPage','10') ON DUPLICATE KEY UPDATE value = '10'; -- main/configuration-announce.properties INSERT INTO config VALUES ('//test:main/de.smartics.sandbox:app-server:','announce.directory','C\:Temp') ON DUPLICATE KEY UPDATE value = 'C\:Temp'; INSERT INTO config VALUES ('//test:main/de.smartics.sandbox:app-server:','announce.lookupIntervalMs','0') ON DUPLICATE KEY UPDATE value = '0'; -- de.smartics.sandbox/test-application-1-config/0.1.0/features.properties INSERT INTO config VALUES ('//test:/de.smartics.sandbox:test-application:','mail.fastMail','true') ON DUPLICATE KEY UPDATE value = 'true'; INSERT INTO config VALUES ('//test:/de.smartics.sandbox:test-application:','mail.userDefinedOrder','true') ON DUPLICATE KEY UPDATE value = 'true'; -- de.smartics.sandbox/test-application-1-config/0.1.0/configuration-mail.properties INSERT INTO config VALUES ('//test:/de.smartics.sandbox:test-application:','mail.server.gui','https://${mail.server.url}/index.html') ON DUPLICATE KEY UPDATE value = 'https://${mail.server.url}/index.html'; INSERT INTO config VALUES ('//test:/de.smartics.sandbox:test-application:','mail.server.url','mail-dev.${app.domain}') ON DUPLICATE KEY UPDATE value = 'mail-dev.${app.domain}'; INSERT INTO config VALUES ('//test:/de.smartics.sandbox:test-application:','mail.mailsPerPage','10') ON DUPLICATE KEY UPDATE value = '10'; INSERT INTO config VALUES ('//test:/de.smartics.sandbox:test-application:','mail.server.password','ETLbewAAATzBi7VNABRBRVMvQ0JDL1BLQ1M1UGFkZGluZwCAABAAENTmsLyQX5+JELL3rZbC+R4AAAAQwuGQbT93kEhfOTiTEgkyoQAUhpUXvq+ZXe8CqDOn0EZd+cLAzvg=') ON DUPLICATE KEY UPDATE value = 'ETLbewAAATzBi7VNABRBRVMvQ0JDL1BLQ1M1UGFkZGluZwCAABAAENTmsLyQX5+JELL3rZbC+R4AAAAQwuGQbT93kEhfOTiTEgkyoQAUhpUXvq+ZXe8CqDOn0EZd+cLAzvg='; -- de.smartics.sandbox/test-application-1-config/0.1.0/configuration-announce.properties INSERT INTO config VALUES ('//test:/de.smartics.sandbox:test-application:','announce.directory','C\:Temp') ON DUPLICATE KEY UPDATE value = 'C\:Temp'; INSERT INTO config VALUES ('//test:/de.smartics.sandbox:test-application:','announce.lookupIntervalMs','0') ON DUPLICATE KEY UPDATE value = '0'; -- de.smartics.sandbox/test-application-1-config/0.1.0/configuration.properties INSERT INTO config VALUES ('//test:/de.smartics.sandbox:test-application:','app.additionalUrls','http://www.example.com/Transfer/external') ON DUPLICATE KEY UPDATE value = 'http://www.example.com/Transfer/external'; INSERT INTO config VALUES ('//test:/de.smartics.sandbox:test-application:','app.homePage','${app.server.url}/index.html') ON DUPLICATE KEY UPDATE value = '${app.server.url}/index.html'; INSERT INTO config VALUES ('//test:/de.smartics.sandbox:test-application:','app.server.url','http://localhost') ON DUPLICATE KEY UPDATE value = 'http://localhost'; INSERT INTO config VALUES ('//test:/de.smartics.sandbox:test-application:','app.domain','example.com') ON DUPLICATE KEY UPDATE value = 'example.com'; -- test2/features.properties INSERT INTO config VALUES ('//test2:/::','mail.fastMail','false') ON DUPLICATE KEY UPDATE value = 'false'; INSERT INTO config VALUES ('//test2:/::','mail.userDefinedOrder','false') ON DUPLICATE KEY UPDATE value = 'false'; -- user.jane/features.properties INSERT INTO config VALUES ('user.jane//:/::','mail.fastMail','false') ON DUPLICATE KEY UPDATE value = 'false'; INSERT INTO config VALUES ('user.jane//:/::','mail.userDefinedOrder','true') ON DUPLICATE KEY UPDATE value = 'true';
The following configuration generates an SQL script to run on a HSQL database:
<plugin> <groupId>de.smartics.properties</groupId> <artifactId>smartics-properties-maven-plugin</artifactId> <version>/add current version here/</version> <executions> <execution> <id>sql-export</id> <phase>prepare-package</phase> <goals> <goal>properties-transfer</goal> </goals> <configuration> <propertySinkFactory implementation="de.smartics.properties.config.transfer.templatestream.HSqlFactory"> <file>${project.build.directory}/mysql-export.sql</file> </propertySinkFactory> </configuration> </execution> </executions> <dependencies> ... as shown above ... </dependencies> <configuration> ... as shown above ... </configuration> </plugin>
Here is an example output:
-- mail/configuration-mail.properties MERGE INTO config USING (VALUES '//test:mail/de.smartics.sandbox:mail-server:','mail.server.gui','https://${mail.server.url}/index.html') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'https://${mail.server.url}/index.html' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:mail/de.smartics.sandbox:mail-server:','mail.server.gui','https://${mail.server.url}/index.html'); MERGE INTO config USING (VALUES '//test:mail/de.smartics.sandbox:mail-server:','mail.server.url','mail.example.com') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'mail.example.com' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:mail/de.smartics.sandbox:mail-server:','mail.server.url','mail.example.com'); MERGE INTO config USING (VALUES '//test:mail/de.smartics.sandbox:mail-server:','mail.mailsPerPage','10') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = '10' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:mail/de.smartics.sandbox:mail-server:','mail.mailsPerPage','10'); -- main/configuration-announce.properties MERGE INTO config USING (VALUES '//test:main/de.smartics.sandbox:app-server:','announce.directory','C\:Temp') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'C\:Temp' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:main/de.smartics.sandbox:app-server:','announce.directory','C\:Temp'); MERGE INTO config USING (VALUES '//test:main/de.smartics.sandbox:app-server:','announce.lookupIntervalMs','0') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = '0' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:main/de.smartics.sandbox:app-server:','announce.lookupIntervalMs','0'); -- de.smartics.sandbox/test-application-1-config/0.1.0/features.properties MERGE INTO config USING (VALUES '//test:/de.smartics.sandbox:test-application:','mail.fastMail','true') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'true' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:/de.smartics.sandbox:test-application:','mail.fastMail','true'); MERGE INTO config USING (VALUES '//test:/de.smartics.sandbox:test-application:','mail.userDefinedOrder','true') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'true' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:/de.smartics.sandbox:test-application:','mail.userDefinedOrder','true'); -- de.smartics.sandbox/test-application-1-config/0.1.0/configuration-mail.properties MERGE INTO config USING (VALUES '//test:/de.smartics.sandbox:test-application:','mail.server.gui','https://${mail.server.url}/index.html') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'https://${mail.server.url}/index.html' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:/de.smartics.sandbox:test-application:','mail.server.gui','https://${mail.server.url}/index.html'); MERGE INTO config USING (VALUES '//test:/de.smartics.sandbox:test-application:','mail.server.url','mail-dev.${app.domain}') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'mail-dev.${app.domain}' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:/de.smartics.sandbox:test-application:','mail.server.url','mail-dev.${app.domain}'); MERGE INTO config USING (VALUES '//test:/de.smartics.sandbox:test-application:','mail.mailsPerPage','10') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = '10' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:/de.smartics.sandbox:test-application:','mail.mailsPerPage','10'); MERGE INTO config USING (VALUES '//test:/de.smartics.sandbox:test-application:','mail.server.password','ETLbewAAATzBi7VNABRBRVMvQ0JDL1BLQ1M1UGFkZGluZwCAABAAENTmsLyQX5+JELL3rZbC+R4AAAAQwuGQbT93kEhfOTiTEgkyoQAUhpUXvq+ZXe8CqDOn0EZd+cLAzvg=') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'ETLbewAAATzBi7VNABRBRVMvQ0JDL1BLQ1M1UGFkZGluZwCAABAAENTmsLyQX5+JELL3rZbC+R4AAAAQwuGQbT93kEhfOTiTEgkyoQAUhpUXvq+ZXe8CqDOn0EZd+cLAzvg=' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:/de.smartics.sandbox:test-application:','mail.server.password','ETLbewAAATzBi7VNABRBRVMvQ0JDL1BLQ1M1UGFkZGluZwCAABAAENTmsLyQX5+JELL3rZbC+R4AAAAQwuGQbT93kEhfOTiTEgkyoQAUhpUXvq+ZXe8CqDOn0EZd+cLAzvg='); -- de.smartics.sandbox/test-application-1-config/0.1.0/configuration-announce.properties MERGE INTO config USING (VALUES '//test:/de.smartics.sandbox:test-application:','announce.directory','C\:Temp') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'C\:Temp' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:/de.smartics.sandbox:test-application:','announce.directory','C\:Temp'); MERGE INTO config USING (VALUES '//test:/de.smartics.sandbox:test-application:','announce.lookupIntervalMs','0') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = '0' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:/de.smartics.sandbox:test-application:','announce.lookupIntervalMs','0'); -- de.smartics.sandbox/test-application-1-config/0.1.0/configuration.properties MERGE INTO config USING (VALUES '//test:/de.smartics.sandbox:test-application:','app.additionalUrls','http://www.example.com/Transfer/external') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'http://www.example.com/Transfer/external' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:/de.smartics.sandbox:test-application:','app.additionalUrls','http://www.example.com/Transfer/external'); MERGE INTO config USING (VALUES '//test:/de.smartics.sandbox:test-application:','app.homePage','${app.server.url}/index.html') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = '${app.server.url}/index.html' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:/de.smartics.sandbox:test-application:','app.homePage','${app.server.url}/index.html'); MERGE INTO config USING (VALUES '//test:/de.smartics.sandbox:test-application:','app.server.url','http://localhost') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'http://localhost' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:/de.smartics.sandbox:test-application:','app.server.url','http://localhost'); MERGE INTO config USING (VALUES '//test:/de.smartics.sandbox:test-application:','app.domain','example.com') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'example.com' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test:/de.smartics.sandbox:test-application:','app.domain','example.com'); -- test2/features.properties MERGE INTO config USING (VALUES '//test2:/::','mail.fastMail','false') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'false' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test2:/::','mail.fastMail','false'); MERGE INTO config USING (VALUES '//test2:/::','mail.userDefinedOrder','false') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'false' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('//test2:/::','mail.userDefinedOrder','false'); -- user.jane/features.properties MERGE INTO config USING (VALUES 'user.jane//:/::','mail.fastMail','false') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'false' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('user.jane//:/::','mail.fastMail','false'); MERGE INTO config USING (VALUES 'user.jane//:/::','mail.userDefinedOrder','true') N (c,n,v) ON config.config=N.c AND config.name=N.n WHEN MATCHED THEN UPDATE SET value = 'true' WHEN NOT MATCHED THEN INSERT (config, name, value) VALUES ('user.jane//:/::','mail.userDefinedOrder','true');
The following configuration generates a CSV file:
<plugin> <groupId>de.smartics.properties</groupId> <artifactId>smartics-properties-maven-plugin</artifactId> <version>/add current version here/</version> <executions> <execution> <id>csv-export</id> <phase>prepare-package</phase> <goals> <goal>properties-transfer</goal> </goals> <configuration> <propertySinkFactory implementation="de.smartics.properties.config.transfer.templatestream.CsvFactory"> <file>${project.build.directory}/export.csv</file> <writeHeader>true</writeHeader> <encoding>ISO-8859-1</encoding> </propertySinkFactory> </configuration> </execution> </executions> <dependencies> ... as shown above ... </dependencies> <configuration> ... as shown above ... </configuration> </plugin>
Here is an example output:
config,name,value //test:mail/de.smartics.sandbox:mail-server:,mail.server.gui,https://${mail.server.url}/index.html //test:mail/de.smartics.sandbox:mail-server:,mail.server.url,mail.example.com //test:mail/de.smartics.sandbox:mail-server:,mail.mailsPerPage,10 //test:main/de.smartics.sandbox:app-server:,announce.directory,C\:Temp //test:main/de.smartics.sandbox:app-server:,announce.lookupIntervalMs,0 //test:/de.smartics.sandbox:test-application:,mail.fastMail,true //test:/de.smartics.sandbox:test-application:,mail.userDefinedOrder,true //test:/de.smartics.sandbox:test-application:,mail.server.gui,https://${mail.server.url}/index.html //test:/de.smartics.sandbox:test-application:,mail.server.url,mail-dev.${app.domain} //test:/de.smartics.sandbox:test-application:,mail.mailsPerPage,10 //test:/de.smartics.sandbox:test-application:,mail.server.password,ETLbewAAATzBi7VNABRBRVMvQ0JDL1BLQ1M1UGFkZGluZwCAABAAENTmsLyQX5+JELL3rZbC+R4AAAAQwuGQbT93kEhfOTiTEgkyoQAUhpUXvq+ZXe8CqDOn0EZd+cLAzvg= //test:/de.smartics.sandbox:test-application:,announce.directory,C\:Temp //test:/de.smartics.sandbox:test-application:,announce.lookupIntervalMs,0 //test:/de.smartics.sandbox:test-application:,app.additionalUrls,http://www.example.com/Transfer/external //test:/de.smartics.sandbox:test-application:,app.homePage,${app.server.url}/index.html //test:/de.smartics.sandbox:test-application:,app.server.url,http://localhost //test:/de.smartics.sandbox:test-application:,app.domain,example.com //test2:/::,mail.fastMail,false //test2:/::,mail.userDefinedOrder,false user.jane//:/::,mail.fastMail,false user.jane//:/::,mail.userDefinedOrder,true
The following configuration generates a XML file:
<plugin> <groupId>de.smartics.properties</groupId> <artifactId>smartics-properties-maven-plugin</artifactId> <version>/add current version here/</version> <executions> <execution> <id>xml-export</id> <phase>prepare-package</phase> <goals> <goal>properties-transfer</goal> </goals> <configuration> <propertySinkFactory implementation="de.smartics.properties.config.transfer.templatestream.XmlFactory"> <file>${project.build.directory}/export.xml</file> </propertySinkFactory> </configuration> </execution> </executions> <dependencies> ... as shown above ... </dependencies> <configuration> ... as shown above ... </configuration> </plugin>
Here is an example output:
<?xml version="1.0" encoding="UTF-8"?> <config> <properties from="mail/configuration-mail.properties"> <property config="//test:mail/de.smartics.sandbox:mail-server:" name="mail.server.gui">https://${mail.server.url}/index.html</property> <property config="//test:mail/de.smartics.sandbox:mail-server:" name="mail.server.url">mail.example.com</property> <property config="//test:mail/de.smartics.sandbox:mail-server:" name="mail.mailsPerPage">10</property> </properties> <properties from="main/configuration-announce.properties"> <property config="//test:main/de.smartics.sandbox:app-server:" name="announce.directory">C\:Temp</property> <property config="//test:main/de.smartics.sandbox:app-server:" name="announce.lookupIntervalMs">0</property> </properties> <properties from="de.smartics.sandbox/test-application-1-config/0.1.0/features.properties"> <property config="//test:/de.smartics.sandbox:test-application:" name="mail.fastMail">true</property> <property config="//test:/de.smartics.sandbox:test-application:" name="mail.userDefinedOrder">true</property> </properties> <properties from="de.smartics.sandbox/test-application-1-config/0.1.0/configuration-mail.properties"> <property config="//test:/de.smartics.sandbox:test-application:" name="mail.server.gui">https://${mail.server.url}/index.html</property> <property config="//test:/de.smartics.sandbox:test-application:" name="mail.server.url">mail-dev.${app.domain}</property> <property config="//test:/de.smartics.sandbox:test-application:" name="mail.mailsPerPage">10</property> <property config="//test:/de.smartics.sandbox:test-application:" name="mail.server.password">ETLbewAAATzBi7VNABRBRVMvQ0JDL1BLQ1M1UGFkZGluZwCAABAAENTmsLyQX5+JELL3rZbC+R4AAAAQwuGQbT93kEhfOTiTEgkyoQAUhpUXvq+ZXe8CqDOn0EZd+cLAzvg=</property> </properties> <properties from="de.smartics.sandbox/test-application-1-config/0.1.0/configuration-announce.properties"> <property config="//test:/de.smartics.sandbox:test-application:" name="announce.directory">C\:Temp</property> <property config="//test:/de.smartics.sandbox:test-application:" name="announce.lookupIntervalMs">0</property> </properties> <properties from="de.smartics.sandbox/test-application-1-config/0.1.0/configuration.properties"> <property config="//test:/de.smartics.sandbox:test-application:" name="app.additionalUrls">http://www.example.com/Transfer/external</property> <property config="//test:/de.smartics.sandbox:test-application:" name="app.homePage">${app.server.url}/index.html</property> <property config="//test:/de.smartics.sandbox:test-application:" name="app.server.url">http://localhost</property> <property config="//test:/de.smartics.sandbox:test-application:" name="app.domain">example.com</property> </properties> <properties from="test2/features.properties"> <property config="//test2:/::" name="mail.fastMail">false</property> <property config="//test2:/::" name="mail.userDefinedOrder">false</property> </properties> <properties from="user.jane/features.properties"> <property config="user.jane//:/::" name="mail.fastMail">false</property> <property config="user.jane//:/::" name="mail.userDefinedOrder">true</property> </properties> </config>
You may generate an XML fragment to add to your JBoss 7 configuration so that properties are accessible in JNDI.
The factory provides on additional property:
Property | Description |
---|---|
jndiPrefix | The prefix to prepend. Defaults to java:/smartics-properties/config |
<plugin> <groupId>de.smartics.properties</groupId> <artifactId>smartics-properties-maven-plugin</artifactId> <version>/add current version here/</version> <executions> <execution> <id>jboss7-jndi-export</id> <phase>prepare-package</phase> <goals> <goal>properties-transfer</goal> </goals> <configuration> <propertySinkFactory implementation="de.smartics.properties.config.transfer.templatestream.JBoss7NamingFactory"> <file>/home/sw/.hudson/jobs/smartics-properties-transfer-templatestream-site/workspace/smartics-properties-transfer-templatestream/target/jndi-fragment.xml</file> <!-- <jndiPrefix>java:global</jndiPrefix> --> </propertySinkFactory> </configuration> </execution> </executions> <dependencies> ... as shown above ... </dependencies> <configuration> ... as shown above ... </configuration> </plugin>
Here is an example output:
<!-- Add this XML fragment inside the <subsystem xmlns="urn:jboss:domain:naming:1.1"> <bindings> --> <!-- source: mail/configuration-mail.properties --> <simple name="java:global/||test:mail|de.smartics.sandbox:mail-server:/mail.server.gui" value="https://${mail.server.url}/index.html" type="java.lang.String"/> <simple name="java:global/||test:mail|de.smartics.sandbox:mail-server:/mail.server.url" value="mail.example.com" type="java.lang.String"/> <simple name="java:global/||test:mail|de.smartics.sandbox:mail-server:/mail.mailsPerPage" value="10" type="java.lang.String"/> <!-- source: main/configuration-announce.properties --> <simple name="java:global/||test:main|de.smartics.sandbox:app-server:/announce.directory" value="C\:Temp" type="java.lang.String"/> <simple name="java:global/||test:main|de.smartics.sandbox:app-server:/announce.lookupIntervalMs" value="0" type="java.lang.String"/> <!-- source: de.smartics.sandbox/test-application-1-config/0.1.0/features.properties --> <simple name="java:global/||test:|de.smartics.sandbox:test-application:/mail.fastMail" value="true" type="java.lang.String"/> <simple name="java:global/||test:|de.smartics.sandbox:test-application:/mail.userDefinedOrder" value="true" type="java.lang.String"/> <!-- source: de.smartics.sandbox/test-application-1-config/0.1.0/configuration-mail.properties --> <simple name="java:global/||test:|de.smartics.sandbox:test-application:/mail.server.gui" value="https://${mail.server.url}/index.html" type="java.lang.String"/> <simple name="java:global/||test:|de.smartics.sandbox:test-application:/mail.server.url" value="mail-dev.xxx" type="java.lang.String"/> <simple name="java:global/||test:|de.smartics.sandbox:test-application:/mail.mailsPerPage" value="10" type="java.lang.String"/> <simple name="java:global/||test:|de.smartics.sandbox:test-application:/mail.server.password" value="Kt1uRD0IdYsIAnOR20fUwQ==" type="java.lang.String"/> <!-- source: user.jane/configuration-mail.properties --> <simple name="java:global/jane||:|::/mail.mailsPerPage" value="23" type="java.lang.String"/> <!-- source: de.smartics.sandbox/test-application-1-config/0.1.0/configuration-announce.properties --> <simple name="java:global/||test:|de.smartics.sandbox:test-application:/announce.directory" value="C\:Temp" type="java.lang.String"/> <simple name="java:global/||test:|de.smartics.sandbox:test-application:/announce.lookupIntervalMs" value="0" type="java.lang.String"/> <!-- source: de.smartics.sandbox/test-application-1-config/0.1.0/configuration.properties --> <simple name="java:global/||test:|de.smartics.sandbox:test-application:/app.additionalUrls" value="http://www.example.com/Transfer/external" type="java.lang.String"/> <simple name="java:global/||test:|de.smartics.sandbox:test-application:/app.homePage" value="${app.server.url}/index.html" type="java.lang.String"/> <simple name="java:global/||test:|de.smartics.sandbox:test-application:/app.server.url" value="http://localhost" type="java.lang.String"/> <simple name="java:global/||test:|de.smartics.sandbox:test-application:/app.domain" value="example.com" type="java.lang.String"/> <!-- source: test2/features.properties --> <simple name="java:global/||test2:|::/mail.fastMail" value="false" type="java.lang.String"/> <simple name="java:global/||test2:|::/mail.userDefinedOrder" value="false" type="java.lang.String"/> <!-- source: user.jane/features.properties --> <simple name="java:global/jane||:|::/mail.fastMail" value="false" type="java.lang.String"/> <simple name="java:global/jane||:|::/mail.userDefinedOrder" value="true" type="java.lang.String"/> <!-- </bindings> </subsystem> -->
If none of the above suits your needs, you may use Factory to create a template on your own:
<configuration> <propertySinkFactory implementation="de.smartics.properties.config.transfer.templatestream.Factory"> ... use setters provided by Factory ... </propertySinkFactory> </configuration>
Only setters accepting a String argument are relevant for your configuration.
In your template use the following placeholders:
Placeholder | Description |
---|---|
${table} | The name of the configuration table. |
${configColumn} | The name of the column in the configuration table that contains the configuration key. |
${nameColumn} | The name of the colum in the configuration table that contains the property name. |
${valueColumn} | The name of the colum in the configuration table that contains the property value. |
${location} | The location of the property definitions. |
${configKey} | The configuration key that identifies the configuration the property belongs to. |
${name} | The name of the property. |
${value} | The value of the property. |
${newline} | Inserts a single newline (\n). |
A sample template looks like this:
INSERT INTO ${table} VALUES ('${configKey}','${name}','${value}') ON DUPLICATE KEY UPDATE ${valueColumn} = '${value}';${newline}