Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEODE-5032: Update cluster configuration objects for more intuitive consumption #1848

Closed
wants to merge 10 commits into from
35 changes: 35 additions & 0 deletions etc/example-bindings.xjb
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<jxb:bindings version="2.1"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc">
<jxb:bindings schemaLocation="your-extensions.xsd">
<!--
Your generated configuration class should be implement CacheElement.
Since CacheElement extends Serializable, we generate a UID as well.
For preference, <xjc:simple/> expands "choice" elements for individual method reference,
as well as using the plural name for any "sequence" elements.
-->
<jxb:globalBindings fixedAttributeAsConstantProperty="true" choiceContentProperty="true">
<xjc:superInterface name="org.apache.geode.cache.configuration.CacheElement"/>
<xjc:serializable uid="1"/>
<xjc:simple/>
</jxb:globalBindings>
</jxb:bindings>
</jxb:bindings>
20 changes: 20 additions & 0 deletions etc/geode-connectors.episode
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<bindings version="2.1" xmlns="http://java.sun.com/xml/ns/jaxb">
<!--

This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
Any modifications to this file will be lost upon recompilation of the source schema.
Generated on: 2018.04.23 at 04:18:22 PM PDT

-->
<bindings scd="x-schema::tns" xmlns:tns="http://geode.apache.org/schema/jdbc">
<schemaBindings map="false">
<package name="org.apache.geode.cache.configuration"/>
</schemaBindings>
<bindings scd="tns:connector-service">
<class ref="org.apache.geode.cache.configuration.ConnectorService"/>
</bindings>
</bindings>
</bindings>

98 changes: 98 additions & 0 deletions etc/geode-core.episode
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<bindings version="2.1" xmlns="http://java.sun.com/xml/ns/jaxb">
<!--

This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
Any modifications to this file will be lost upon recompilation of the source schema.
Generated on: 2018.04.23 at 04:18:21 PM PDT

-->
<bindings scd="x-schema::tns" xmlns:tns="http://geode.apache.org/schema/cache">
<schemaBindings map="false">
<package name="org.apache.geode.cache.configuration"/>
</schemaBindings>
<bindings scd="~tns:region-attributes-type">
<class ref="org.apache.geode.cache.configuration.RegionAttributesType"/>
</bindings>
<bindings scd="~tns:pool-type">
<class ref="org.apache.geode.cache.configuration.PoolType"/>
</bindings>
<bindings scd="~tns:function-service-type">
<class ref="org.apache.geode.cache.configuration.FunctionServiceType"/>
</bindings>
<bindings scd="~tns:jndi-bindings-type">
<class ref="org.apache.geode.cache.configuration.JndiBindingsType"/>
</bindings>
<bindings scd="~tns:region-type">
<class ref="org.apache.geode.cache.configuration.RegionConfig"/>
</bindings>
<bindings scd="~tns:serialization-registration-type">
<class ref="org.apache.geode.cache.configuration.SerializationRegistrationType"/>
</bindings>
<bindings scd="~tns:expiration-attributes-type">
<class ref="org.apache.geode.cache.configuration.ExpirationAttributesType"/>
</bindings>
<bindings scd="~tns:server-type">
<class ref="org.apache.geode.cache.configuration.ServerType"/>
</bindings>
<bindings scd="~tns:pdx-type">
<class ref="org.apache.geode.cache.configuration.PdxType"/>
</bindings>
<bindings scd="~tns:cache-transaction-manager-type">
<class ref="org.apache.geode.cache.configuration.CacheTransactionManagerType"/>
</bindings>
<bindings scd="tns:cache">
<class ref="org.apache.geode.cache.configuration.CacheConfig"/>
</bindings>
<bindings scd="~tns:cache-writer-type">
<class ref="org.apache.geode.cache.configuration.CacheWriterType"/>
</bindings>
<bindings scd="~tns:disk-dirs-type">
<class ref="org.apache.geode.cache.configuration.DiskDirsType"/>
</bindings>
<bindings scd="~tns:string-type">
<class ref="org.apache.geode.cache.configuration.StringType"/>
</bindings>
<bindings scd="~tns:parameter-type">
<class ref="org.apache.geode.cache.configuration.ParameterType"/>
</bindings>
<bindings scd="~tns:class-with-parameters-type">
<class ref="org.apache.geode.cache.configuration.ClassWithParametersType"/>
</bindings>
<bindings scd="~tns:initializer-type">
<class ref="org.apache.geode.cache.configuration.InitializerType"/>
</bindings>
<bindings scd="~tns:declarable-type">
<class ref="org.apache.geode.cache.configuration.DeclarableType"/>
</bindings>
<bindings scd="~tns:cache-loader-type">
<class ref="org.apache.geode.cache.configuration.CacheLoaderType"/>
</bindings>
<bindings scd="~tns:disk-dir-type">
<class ref="org.apache.geode.cache.configuration.DiskDirType"/>
</bindings>
<bindings scd="~tns:disk-store-type">
<class ref="org.apache.geode.cache.configuration.DiskStoreType"/>
</bindings>
<bindings scd="~tns:region-attributesScope">
<typesafeEnumClass ref="org.apache.geode.cache.configuration.RegionAttributesScope"/>
</bindings>
<bindings scd="~tns:enum-action-destroy-overflow">
<typesafeEnumClass ref="org.apache.geode.cache.configuration.EnumActionDestroyOverflow"/>
</bindings>
<bindings scd="~tns:region-attributesMirror-type">
<typesafeEnumClass ref="org.apache.geode.cache.configuration.RegionAttributesMirrorType"/>
</bindings>
<bindings scd="~tns:region-attributesData-policy">
<typesafeEnumClass ref="org.apache.geode.cache.configuration.RegionAttributesDataPolicy"/>
</bindings>
<bindings scd="~tns:enum-readable-writable">
<typesafeEnumClass ref="org.apache.geode.cache.configuration.EnumReadableWritable"/>
</bindings>
<bindings scd="~tns:region-attributesIndex-update-type">
<typesafeEnumClass ref="org.apache.geode.cache.configuration.RegionAttributesIndexUpdateType"/>
</bindings>
</bindings>
</bindings>

20 changes: 20 additions & 0 deletions etc/geode-lucene.episode
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<bindings version="2.1" xmlns="http://java.sun.com/xml/ns/jaxb">
<!--

This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
Any modifications to this file will be lost upon recompilation of the source schema.
Generated on: 2018.04.23 at 04:18:22 PM PDT

-->
<bindings scd="x-schema::tns" xmlns:tns="http://geode.apache.org/schema/lucene">
<schemaBindings map="false">
<package name="org.apache.geode.cache.configuration"/>
</schemaBindings>
<bindings scd="tns:index">
<class ref="org.apache.geode.cache.configuration.Index"/>
</bindings>
</bindings>
</bindings>

33 changes: 33 additions & 0 deletions geode-connectors/build.gradle
Expand Up @@ -41,4 +41,37 @@ dependencies {
testCompile files(project(':geode-old-versions').sourceSets.main.output)
}



task xjc (type: Exec){
description 'Generates initial, incomplete POJO configuration objects using JAXB / xjc. ' +
'Use this task as a reference to keep etc/example-bindings.xjb ' +
'and the etc/*.episode files up to date. ' +
'Intended as an internal developer tool only.'
dependsOn(':geode-core:xjc')

def sourceXsd = "${projectDir}/src/main/resources/META-INF/schemas/geode.apache.org/schema/jdbc/jdbc-1.0.xsd"
def jaxBindings = "${projectDir}/src/main/resources/META-INF/schemas/geode.apache.org/schema/jdbc/bindings.xjb"
def classPath = "${projectDir}/../geode-core/src/main/java"

// It is not currently needed (and is currently breaking) to pass the core episode to this task.
// If it does become necessary, pass it as a binding (an additional -b) in the xjc command.
def coreEpisode = "${projectDir}/../etc/geode-core.episode"

def outputDir = "${projectDir}/build/generated-src/main/"
def outputPackage = "org.apache.geode.cache.configuration"
def outputEpisode = "${projectDir}/../etc/geode-connectors.episode"

doFirst{
workingDir projectDir
mkdir outputDir
}

workingDir projectDir
commandLine 'sh', '-c',
"xjc -extension -p ${outputPackage} -d ${outputDir} -episode ${outputEpisode} " +
"-no-header -b ${jaxBindings} -classpath ${classPath} -contentForWildcard -npa ${sourceXsd}"

}

integrationTest.forkEvery 0
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<jxb:bindings version="2.1"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc">
<jxb:bindings schemaLocation="jdbc-1.0.xsd">
<!--
Your generated configuration class should be implement CacheElement.
Since CacheElement extends Serializable, we generate a UID as well.
For preference, <xjc:simple/> expands "choice" elements for individual method reference,
as well as using the plural name for any "sequence" elements.
-->
<jxb:globalBindings fixedAttributeAsConstantProperty="true" choiceContentProperty="true">
<xjc:superInterface name="org.apache.geode.cache.configuration.CacheElement"/>
<xjc:serializable uid="1"/>
<xjc:simple/>
</jxb:globalBindings>
</jxb:bindings>
</jxb:bindings>
27 changes: 25 additions & 2 deletions geode-core/build.gradle
Expand Up @@ -26,8 +26,6 @@ sourceSets {
}
}



configurations {
//declaring new configuration that will be used to associate with artifacts
archives
Expand Down Expand Up @@ -242,3 +240,28 @@ dependencies {

tasks.eclipse.dependsOn(generateGrammarSource)

task xjc (type: Exec){
description 'Generates initial, incomplete POJO configuration objects using JAXB / xjc. ' +
'Use this task as a reference to keep etc/example-bindings.xjb ' +
'and the etc/*.episode files up to date. ' +
'Intended as an internal developer tool only.'

def sourceXsd = "${projectDir}/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/configurationService.xsd"
def classPath = "${projectDir}/src/main/java"
def jaxBindings = "${projectDir}//src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/bindings.xjb"

def outputDir = "${projectDir}/build/generated-src/main/"
def outputPackage = "org.apache.geode.cache.configuration"
def outputEpisode = "${projectDir}/../etc/geode-core.episode"

doFirst{
workingDir projectDir
mkdir outputDir
}

workingDir projectDir
commandLine 'sh', '-c',
"xjc -extension -p ${outputPackage} -d ${outputDir} -episode ${outputEpisode} " +
"-no-header -b ${jaxBindings} -classpath ${classPath} -contentForWildcard -npa ${sourceXsd}"

}