From 5eccbd739653c5ea43767646adc65859bf9a6263 Mon Sep 17 00:00:00 2001 From: berryware Date: Thu, 11 Dec 2025 16:15:02 -0500 Subject: [PATCH] Replace xmlbeans with jaxb. Jaxb does not build the schema validation into the generated classes, so the xsds have been moved to the resource directory for validation use at runtime. The config xsds have been merged to one. The meta xsds have been merged to one. This makes validation easier, and also gets around a problem of inheritence not working across files. The jars are now about 200kb smaller in total. --- cpo-cassandra/pom.xml | 9 +- .../cpo/cassandra/ClusterDataSourceInfo.java | 11 +- .../config/CassandraCpoConfigProcessor.java | 116 ++-- .../CassandraMetaXmlObjectExporter.java | 30 +- .../meta/CassandraCpoMetaAdapter.java | 4 +- .../cpo/cassandra/XmlValidationTest.java | 51 +- .../src/test/resources/badConfig.xml | 28 +- .../src/test/resources/cassandraMetaData.xml | 131 ++-- .../src/test/resources/cpoConfig.xml | 86 ++- .../src/test/resources/hotDeployMetaData.xml | 4 +- cpo-core/pom.xml | 47 +- .../cpo/CpoAdapterFactoryManager.java | 109 ++-- .../cpo/config/CpoConfigProcessor.java | 2 +- .../exporter/CoreMetaXmlObjectExporter.java | 59 +- .../cpo/exporter/MetaXmlObjectExporter.java | 4 +- .../cpo/helper/XmlBeansHelper.java | 92 --- .../org/synchronoss/cpo/helper/XmlHelper.java | 116 ++++ .../cpo/meta/AbstractCpoMetaAdapter.java | 43 +- .../cpo/meta/CpoMetaDescriptor.java | 242 ++++---- cpo-core/src/main/resources/xsd/CpoConfig.xsd | 586 ++++++++++++++++++ .../xsd/CpoMeta.xsd} | 87 ++- .../{ => resources}/xsd/CpoUtilConfig.xsd | 4 +- cpo-core/src/main/xsd/CpoCassandraConfig.xsd | 446 ------------- cpo-core/src/main/xsd/CpoCassandraMeta.xsd | 28 - cpo-core/src/main/xsd/CpoConfig.xsd | 13 - cpo-core/src/main/xsd/CpoCoreConfig.xsd | 71 --- cpo-core/src/main/xsd/CpoJdbcConfig.xsd | 82 --- cpo-core/src/main/xsd/CpoJdbcMeta.xsd | 40 -- .../java/org/synchronoss/cpo/xml/XmlTest.java | 45 ++ cpo-core/src/test/resources/testCoreMeta.xml | 102 +++ cpo-jdbc/pom.xml | 19 +- .../jdbc/config/JdbcCpoConfigProcessor.java | 30 +- .../exporter/JdbcMetaXmlObjectExporter.java | 42 +- .../cpo/jdbc/meta/JdbcCpoMetaAdapter.java | 8 +- .../cpo/jdbc/adapter/HotDeployTest.java | 4 +- .../cpo/jdbc/adapter/XmlValidationTest.java | 54 +- .../cpo/jdbc/exporter/ExporterTest.java | 16 +- .../cpo/jdbc/jmeter/CpoJavaSamplerClient.java | 9 +- cpo-jdbc/src/test/resources/badConfig.xml | 19 +- .../src/test/resources/common/LobMetaData.xml | 50 +- .../resources/common/ValueCaseMetaData.xml | 198 +++--- .../test/resources/common/ValueMetaData.xml | 248 ++++---- .../src/test/resources/emptyClassMetaData.xml | 2 +- cpo-jdbc/src/test/resources/emptyMetaData.xml | 2 +- cpo-jdbc/src/test/resources/h2/cpoConfig.xml | 334 +++++----- .../src/test/resources/hotDeployMetaData.xml | 2 +- .../src/test/resources/mariadb/cpoConfig.xml | 334 +++++----- .../src/test/resources/mysql/cpoConfig.xml | 334 +++++----- .../oracle/classdef/oracleLobMetaData.xml | 2 +- .../classdef/oracleValueCaseMetaData.xml | 2 +- .../oracle/classdef/oracleValueMetaData.xml | 2 +- .../src/test/resources/oracle/cpoConfig.xml | 334 +++++----- .../src/test/resources/postgres/cpoConfig.xml | 334 +++++----- pom.xml | 34 +- 54 files changed, 2584 insertions(+), 2517 deletions(-) delete mode 100644 cpo-core/src/main/java/org/synchronoss/cpo/helper/XmlBeansHelper.java create mode 100644 cpo-core/src/main/java/org/synchronoss/cpo/helper/XmlHelper.java create mode 100644 cpo-core/src/main/resources/xsd/CpoConfig.xsd rename cpo-core/src/main/{xsd/CpoCoreMeta.xsd => resources/xsd/CpoMeta.xsd} (50%) rename cpo-core/src/main/{ => resources}/xsd/CpoUtilConfig.xsd (87%) delete mode 100644 cpo-core/src/main/xsd/CpoCassandraConfig.xsd delete mode 100644 cpo-core/src/main/xsd/CpoCassandraMeta.xsd delete mode 100644 cpo-core/src/main/xsd/CpoConfig.xsd delete mode 100644 cpo-core/src/main/xsd/CpoCoreConfig.xsd delete mode 100644 cpo-core/src/main/xsd/CpoJdbcConfig.xsd delete mode 100644 cpo-core/src/main/xsd/CpoJdbcMeta.xsd create mode 100644 cpo-core/src/test/java/org/synchronoss/cpo/xml/XmlTest.java create mode 100644 cpo-core/src/test/resources/testCoreMeta.xml diff --git a/cpo-cassandra/pom.xml b/cpo-cassandra/pom.xml index 979ffdac8..cdfb8a93c 100644 --- a/cpo-cassandra/pom.xml +++ b/cpo-cassandra/pom.xml @@ -126,14 +126,9 @@ ${logbackVersion} test - - org.apache.logging.log4j - log4j-to-slf4j - - - org.apache.xmlbeans - xmlbeans + jakarta.xml.bind + jakarta.xml.bind-api com.datastax.cassandra diff --git a/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/ClusterDataSourceInfo.java b/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/ClusterDataSourceInfo.java index 4a8228783..2b2aff1e9 100644 --- a/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/ClusterDataSourceInfo.java +++ b/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/ClusterDataSourceInfo.java @@ -25,6 +25,7 @@ import com.datastax.driver.core.*; import com.datastax.driver.core.policies.*; import java.util.Collection; +import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.synchronoss.cpo.AbstractDataSourceInfo; @@ -37,7 +38,7 @@ */ public class ClusterDataSourceInfo extends AbstractDataSourceInfo { private static final Logger logger = LoggerFactory.getLogger(ClusterDataSourceInfo.class); - private String[] contactPoints; + private List contactPoints; private String keySpace; private String clusterName; private Integer maxSchemaAgreementWaitSeconds; @@ -71,7 +72,11 @@ public class ClusterDataSourceInfo extends AbstractDataSourceInfo contactPoints, + int fetchSize, + int batchSize) { super(buildDataSourceName(clusterName, keySpace, contactPoints), fetchSize, batchSize); this.keySpace = keySpace; this.clusterName = clusterName; @@ -576,7 +581,7 @@ protected ClusterDataSource createDataSource() throws CpoException { } private static String buildDataSourceName( - String clusterName, String keySpace, String[] contactPoints) { + String clusterName, String keySpace, List contactPoints) { StringBuilder sb = new StringBuilder(); sb.append(clusterName); sb.append(keySpace); diff --git a/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/config/CassandraCpoConfigProcessor.java b/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/config/CassandraCpoConfigProcessor.java index f545e940d..7da252c0b 100644 --- a/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/config/CassandraCpoConfigProcessor.java +++ b/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/config/CassandraCpoConfigProcessor.java @@ -32,10 +32,9 @@ import org.synchronoss.cpo.cassandra.CassandraCpoAdapter; import org.synchronoss.cpo.cassandra.CassandraCpoAdapterFactory; import org.synchronoss.cpo.cassandra.ClusterDataSourceInfo; -import org.synchronoss.cpo.cassandra.cpoCassandraConfig.*; import org.synchronoss.cpo.cassandra.meta.CassandraCpoMetaDescriptor; import org.synchronoss.cpo.config.CpoConfigProcessor; -import org.synchronoss.cpo.core.cpoCoreConfig.CtDataSourceConfig; +import org.synchronoss.cpo.cpoconfig.*; import org.synchronoss.cpo.meta.CpoMetaDescriptor; /** @@ -66,7 +65,7 @@ public CpoAdapterFactory processCpoConfig(CtDataSourceConfig cpoConfig) throws C CpoMetaDescriptor.getInstance(cassandraConfig.getMetaDescriptorName()); // build the cluster information - if (cassandraConfig.isSetReadWriteConfig()) { + if (cassandraConfig.getReadWriteConfig() != null) { ClusterDataSourceInfo clusterInfo = buildDataSourceInfo( cassandraConfig.getName(), @@ -118,113 +117,120 @@ private ClusterDataSourceInfo buildDataSourceInfo( new ClusterDataSourceInfo( dataConfigName, readWriteConfig.getKeySpace(), - readWriteConfig.getContactPointArray(), + readWriteConfig.getContactPoint(), fetchSize, batchSize); // add clusterName - if (readWriteConfig.isSetClusterName()) - clusterInfo.setClusterName(readWriteConfig.getClusterName()); + clusterInfo.setClusterName(readWriteConfig.getClusterName()); // add maxSchemaAgreementWaitSeconds - if (readWriteConfig.isSetMaxSchemaAgreementWaitSeconds()) - clusterInfo.setMaxSchemaAgreementWaitSeconds( - readWriteConfig.getMaxSchemaAgreementWaitSeconds()); + clusterInfo.setMaxSchemaAgreementWaitSeconds( + readWriteConfig.getMaxSchemaAgreementWaitSeconds()); // add port - if (readWriteConfig.isSetPort()) clusterInfo.setPort(readWriteConfig.getPort()); + if (readWriteConfig.getPort() != null) clusterInfo.setPort(readWriteConfig.getPort()); // add loadBalancing - if (readWriteConfig.isSetLoadBalancingPolicy()) { + if (readWriteConfig.getLoadBalancingPolicy() != null + && !readWriteConfig.getLoadBalancingPolicy().isBlank()) { clusterInfo.setLoadBalancingPolicy( new ConfigInstantiator() .instantiate(readWriteConfig.getLoadBalancingPolicy())); } // add reconnectionPolicy - if (readWriteConfig.isSetReconnectionPolicy()) + if (readWriteConfig.getReconnectionPolicy() != null + && !readWriteConfig.getReconnectionPolicy().isBlank()) clusterInfo.setReconnectionPolicy( new ConfigInstantiator() .instantiate(readWriteConfig.getReconnectionPolicy())); // add retryPolicy - if (readWriteConfig.isSetRetryPolicy()) + if (readWriteConfig.getRetryPolicy() != null && !readWriteConfig.getRetryPolicy().isBlank()) clusterInfo.setRetryPolicy( new ConfigInstantiator().instantiate(readWriteConfig.getRetryPolicy())); // add credentials - if (readWriteConfig.isSetCredentials()) { + if (readWriteConfig.getCredentials() != null) { clusterInfo.setHasCredentials(true); clusterInfo.setUserName(readWriteConfig.getCredentials().getUser()); clusterInfo.setPassword(readWriteConfig.getCredentials().getUser()); } // add addressTranslater - if (readWriteConfig.isSetAddressTranslater()) + if (readWriteConfig.getAddressTranslater() != null + && !readWriteConfig.getAddressTranslater().isBlank()) clusterInfo.setAddressTranslater( new ConfigInstantiator() .instantiate(readWriteConfig.getAddressTranslater())); // add AuthProvider - if (readWriteConfig.isSetAuthProvider()) + if (readWriteConfig.getAuthProvider() != null && !readWriteConfig.getAuthProvider().isBlank()) clusterInfo.setAuthProvider( new ConfigInstantiator().instantiate(readWriteConfig.getAuthProvider())); // add Compression - if (readWriteConfig.isSetCompression()) + if (readWriteConfig.getCompression() != null) clusterInfo.setCompressionType( ProtocolOptions.Compression.valueOf(readWriteConfig.getCompression().toString())); // add NettyOptions - if (readWriteConfig.isSetNettyOptions()) + if (readWriteConfig.getNettyOptions() != null && !readWriteConfig.getNettyOptions().isBlank()) clusterInfo.setNettyOptions( new ConfigInstantiator().instantiate(readWriteConfig.getNettyOptions())); // add Metrics - if (readWriteConfig.isSetMetrics()) clusterInfo.setUseMetrics(readWriteConfig.getMetrics()); + if (readWriteConfig.isMetrics() != null) clusterInfo.setUseMetrics(readWriteConfig.isMetrics()); // add SSL - if (readWriteConfig.isSetSslOptions() && !readWriteConfig.isNilSslOptions()) { + if (readWriteConfig.getSslOptions() != null + && readWriteConfig.getSslOptions().getValue() != null + && !readWriteConfig.getSslOptions().getValue().isBlank()) { clusterInfo.setSslOptions( - new ConfigInstantiator().instantiate(readWriteConfig.getSslOptions())); + new ConfigInstantiator() + .instantiate(readWriteConfig.getSslOptions().getValue())); } // add Listeners - if (readWriteConfig.isSetInitialListeners()) { + if (readWriteConfig.getInitialListeners() != null + && !readWriteConfig.getInitialListeners().isBlank()) { clusterInfo.setListeners( new ConfigInstantiator>() .instantiate(readWriteConfig.getInitialListeners())); } // add JMX Reporting - if (readWriteConfig.isSetJmxReporting()) - clusterInfo.setUseJmxReporting(readWriteConfig.getJmxReporting()); + if (readWriteConfig.isJmxReporting() != null) + clusterInfo.setUseJmxReporting(readWriteConfig.isJmxReporting()); // add protocolVersion - if (readWriteConfig.isSetProtocolVersion()) + if (readWriteConfig.getProtocolVersion() != null) clusterInfo.setProtocolVersion( ProtocolVersion.valueOf(readWriteConfig.getProtocolVersion().toString())); // add pooling options - if (readWriteConfig.isSetPoolingOptions()) + if (readWriteConfig.getPoolingOptions() != null) clusterInfo.setPoolingOptions(buildPoolingOptions(readWriteConfig.getPoolingOptions())); // add socket options - if (readWriteConfig.isSetSocketOptions()) + if (readWriteConfig.getSocketOptions() != null) clusterInfo.setSocketOptions(buildSocketOptions(readWriteConfig.getSocketOptions())); // add query Options - if (readWriteConfig.isSetQueryOptions()) + if (readWriteConfig.getQueryOptions() != null) clusterInfo.setQueryOptions(buildQueryOptions(readWriteConfig.getQueryOptions())); // add speculativeExecutionPolicy - if (readWriteConfig.isSetSpeculativeExecutionPolicy()) + if (readWriteConfig.getSpeculativeExecutionPolicy() != null + && !readWriteConfig.getSpeculativeExecutionPolicy().isBlank()) clusterInfo.setSpeculativeExecutionPolicy( new ConfigInstantiator() .instantiate(readWriteConfig.getSpeculativeExecutionPolicy())); // add TimestampGenerator - if (readWriteConfig.isSetTimestampGenerator()) + if (readWriteConfig.getTimestampGenerator() != null + && !readWriteConfig.getTimestampGenerator().isBlank()) clusterInfo.setTimestampGenerator( new ConfigInstantiator() .instantiate(readWriteConfig.getTimestampGenerator())); @@ -236,45 +242,45 @@ private ClusterDataSourceInfo buildDataSourceInfo( private PoolingOptions buildPoolingOptions(CtPoolingOptions ctPoolingOptions) { PoolingOptions poolingOptions = new PoolingOptions(); - if (ctPoolingOptions.isSetConnectionsPerHost()) { + if (ctPoolingOptions.getConnectionsPerHost() != null) { CtConnectionsPerHost cph = ctPoolingOptions.getConnectionsPerHost(); poolingOptions.setConnectionsPerHost( HostDistance.valueOf(cph.getDistance().toString()), cph.getCore(), cph.getMax()); } - if (ctPoolingOptions.isSetCoreConnectionsPerHost()) { + if (ctPoolingOptions.getCoreConnectionsPerHost() != null) { CtHostDistanceAndThreshold hdt = ctPoolingOptions.getCoreConnectionsPerHost(); poolingOptions.setCoreConnectionsPerHost( HostDistance.valueOf(hdt.getDistance().toString()), hdt.getThreshold()); } - if (ctPoolingOptions.isSetHeartbeatIntervalSeconds()) { + if (ctPoolingOptions.getHeartbeatIntervalSeconds() != null) { poolingOptions.setHeartbeatIntervalSeconds(ctPoolingOptions.getHeartbeatIntervalSeconds()); } - if (ctPoolingOptions.isSetIdleTimeoutSeconds()) { + if (ctPoolingOptions.getIdleTimeoutSeconds() != null) { poolingOptions.setIdleTimeoutSeconds(ctPoolingOptions.getIdleTimeoutSeconds()); } - if (ctPoolingOptions.isSetMaxConnectionsPerHost()) { + if (ctPoolingOptions.getMaxConnectionsPerHost() != null) { CtHostDistanceAndThreshold hdt = ctPoolingOptions.getMaxConnectionsPerHost(); poolingOptions.setMaxConnectionsPerHost( HostDistance.valueOf(hdt.getDistance().toString()), hdt.getThreshold()); } - if (ctPoolingOptions.isSetMaxRequestsPerConnection()) { + if (ctPoolingOptions.getMaxRequestsPerConnection() != null) { CtHostDistanceAndThreshold hdt = ctPoolingOptions.getMaxRequestsPerConnection(); poolingOptions.setMaxRequestsPerConnection( HostDistance.valueOf(hdt.getDistance().toString()), hdt.getThreshold()); } - if (ctPoolingOptions.isSetNewConnectionThreshold()) { + if (ctPoolingOptions.getNewConnectionThreshold() != null) { CtHostDistanceAndThreshold hdt = ctPoolingOptions.getNewConnectionThreshold(); poolingOptions.setNewConnectionThreshold( HostDistance.valueOf(hdt.getDistance().toString()), hdt.getThreshold()); } - if (ctPoolingOptions.isSetPoolTimeoutMillis()) { + if (ctPoolingOptions.getPoolTimeoutMillis() != null) { poolingOptions.setPoolTimeoutMillis(ctPoolingOptions.getPoolTimeoutMillis()); } @@ -284,16 +290,17 @@ private PoolingOptions buildPoolingOptions(CtPoolingOptions ctPoolingOptions) { private QueryOptions buildQueryOptions(CtQueryOptions ctQueryOptions) { QueryOptions queryOptions = new QueryOptions(); - if (ctQueryOptions.isSetConsistencyLevel()) + if (ctQueryOptions.getConsistencyLevel() != null) queryOptions.setConsistencyLevel( ConsistencyLevel.valueOf(ctQueryOptions.getConsistencyLevel().toString())); - if (ctQueryOptions.isSetDefaultIdempotence()) - queryOptions.setDefaultIdempotence(ctQueryOptions.getDefaultIdempotence()); + if (ctQueryOptions.isDefaultIdempotence() != null) + queryOptions.setDefaultIdempotence(ctQueryOptions.isDefaultIdempotence()); - if (ctQueryOptions.isSetFetchSize()) queryOptions.setFetchSize(ctQueryOptions.getFetchSize()); + if (ctQueryOptions.getFetchSize() != null) + queryOptions.setFetchSize(ctQueryOptions.getFetchSize()); - if (ctQueryOptions.isSetSerialConsistencyLevel()) + if (ctQueryOptions.getSerialConsistencyLevel() != null) queryOptions.setSerialConsistencyLevel( ConsistencyLevel.valueOf(ctQueryOptions.getSerialConsistencyLevel().toString())); @@ -303,28 +310,29 @@ private QueryOptions buildQueryOptions(CtQueryOptions ctQueryOptions) { private SocketOptions buildSocketOptions(CtSocketOptions ctSocketOptions) { SocketOptions socketOptions = new SocketOptions(); - if (ctSocketOptions.isSetConnectionTimeoutMillis()) + if (ctSocketOptions.getConnectionTimeoutMillis() != null) socketOptions.setConnectTimeoutMillis(ctSocketOptions.getConnectionTimeoutMillis()); - if (ctSocketOptions.isSetKeepAlive()) - socketOptions.setKeepAlive(ctSocketOptions.getKeepAlive()); + if (ctSocketOptions.isKeepAlive() != null) + socketOptions.setKeepAlive(ctSocketOptions.isKeepAlive()); - if (ctSocketOptions.isSetReadTimeoutMillis()) + if (ctSocketOptions.getReadTimeoutMillis() != null) socketOptions.setReadTimeoutMillis(ctSocketOptions.getReadTimeoutMillis()); - if (ctSocketOptions.isSetReceiveBufferSize()) + if (ctSocketOptions.getReceiveBufferSize() != null) socketOptions.setReceiveBufferSize(ctSocketOptions.getReceiveBufferSize()); - if (ctSocketOptions.isSetReuseAddress()) - socketOptions.setReuseAddress(ctSocketOptions.getReuseAddress()); + if (ctSocketOptions.isReuseAddress() != null) + socketOptions.setReuseAddress(ctSocketOptions.isReuseAddress()); - if (ctSocketOptions.isSetSendBufferSize()) + if (ctSocketOptions.getSendBufferSize() != null) socketOptions.setSendBufferSize(ctSocketOptions.getSendBufferSize()); - if (ctSocketOptions.isSetSoLinger()) socketOptions.setSoLinger(ctSocketOptions.getSoLinger()); + if (ctSocketOptions.getSoLinger() != null) + socketOptions.setSoLinger(ctSocketOptions.getSoLinger()); - if (ctSocketOptions.isSetTcpNoDelay()) - socketOptions.setTcpNoDelay(ctSocketOptions.getTcpNoDelay()); + if (ctSocketOptions.isTcpNoDelay() != null) + socketOptions.setTcpNoDelay(ctSocketOptions.isTcpNoDelay()); return socketOptions; } diff --git a/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/exporter/CassandraMetaXmlObjectExporter.java b/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/exporter/CassandraMetaXmlObjectExporter.java index 187c53ca4..238eff32b 100644 --- a/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/exporter/CassandraMetaXmlObjectExporter.java +++ b/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/exporter/CassandraMetaXmlObjectExporter.java @@ -22,11 +22,10 @@ * ]] */ -import org.synchronoss.cpo.cassandra.cpoCassandraMeta.CtCassandraArgument; -import org.synchronoss.cpo.cassandra.cpoCassandraMeta.CtCassandraAttribute; import org.synchronoss.cpo.cassandra.meta.CassandraCpoAttribute; -import org.synchronoss.cpo.core.cpoCoreMeta.CtArgument; -import org.synchronoss.cpo.core.cpoCoreMeta.CtAttribute; +import org.synchronoss.cpo.cpometa.CtCassandraArgument; +import org.synchronoss.cpo.cpometa.CtCassandraAttribute; +import org.synchronoss.cpo.cpometa.ObjectFactory; import org.synchronoss.cpo.exporter.CoreMetaXmlObjectExporter; import org.synchronoss.cpo.exporter.MetaXmlObjectExporter; import org.synchronoss.cpo.meta.CpoMetaDescriptor; @@ -40,6 +39,9 @@ */ public class CassandraMetaXmlObjectExporter extends CoreMetaXmlObjectExporter implements MetaXmlObjectExporter { + + private final ObjectFactory objectFactory = new ObjectFactory(); + /** * Constructs the CassandraMetaXmlObjectExporter * @@ -64,7 +66,7 @@ public void visit(CpoAttribute cpoAttribute) { // CtClass.addNewCpoAttribute() can't be used here because it returns a CtAttribute, not a // CtJdbcAttribute - CtCassandraAttribute ctCassandraAttribute = CtCassandraAttribute.Factory.newInstance(); + CtCassandraAttribute ctCassandraAttribute = new CtCassandraAttribute(); ctCassandraAttribute.setJavaName(cassAttribute.getJavaName()); ctCassandraAttribute.setJavaType(cassAttribute.getJavaType()); @@ -72,11 +74,11 @@ public void visit(CpoAttribute cpoAttribute) { ctCassandraAttribute.setDataType(cassAttribute.getDataType()); if (cassAttribute.getTransformClassName() != null - && cassAttribute.getTransformClassName().length() > 0) { + && !cassAttribute.getTransformClassName().isEmpty()) { ctCassandraAttribute.setTransformClass(cassAttribute.getTransformClassName()); } - if (cassAttribute.getDescription() != null && cassAttribute.getDescription().length() > 0) { + if (cassAttribute.getDescription() != null && !cassAttribute.getDescription().isEmpty()) { ctCassandraAttribute.setDescription(cassAttribute.getDescription()); } @@ -89,8 +91,9 @@ public void visit(CpoAttribute cpoAttribute) { } // add it to the class - CtAttribute ctAttribute = currentCtClass.addNewCpoAttribute(); - ctAttribute.set(ctCassandraAttribute); + currentCtClass + .getCpoAttribute() + .add(objectFactory.createCassandraAttribute(ctCassandraAttribute)); } } @@ -101,16 +104,17 @@ public void visit(CpoArgument cpoArgument) { // CtFunction.addNewCpoArgument() can't be used here because it returns a CtArgument, not a // ctCassandraArgument - CtCassandraArgument ctCassandraArgument = CtCassandraArgument.Factory.newInstance(); + CtCassandraArgument ctCassandraArgument = new CtCassandraArgument(); ctCassandraArgument.setAttributeName(cpoArgument.getName()); - if (cpoArgument.getDescription() != null && cpoArgument.getDescription().length() > 0) { + if (cpoArgument.getDescription() != null && !cpoArgument.getDescription().isEmpty()) { ctCassandraArgument.setDescription(cpoArgument.getDescription()); } - CtArgument ctArgument = currentCtFunction.addNewCpoArgument(); - ctArgument.set(ctCassandraArgument); + currentCtFunction + .getCpoArgument() + .add(objectFactory.createCassandraArgument(ctCassandraArgument)); } } } diff --git a/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/meta/CassandraCpoMetaAdapter.java b/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/meta/CassandraCpoMetaAdapter.java index d53a19807..62b5fb3b8 100644 --- a/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/meta/CassandraCpoMetaAdapter.java +++ b/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/meta/CassandraCpoMetaAdapter.java @@ -34,8 +34,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.synchronoss.cpo.CpoException; -import org.synchronoss.cpo.cassandra.cpoCassandraMeta.CtCassandraAttribute; -import org.synchronoss.cpo.core.cpoCoreMeta.CtAttribute; +import org.synchronoss.cpo.cpometa.CtAttribute; +import org.synchronoss.cpo.cpometa.CtCassandraAttribute; import org.synchronoss.cpo.meta.AbstractCpoMetaAdapter; import org.synchronoss.cpo.meta.DataTypeMapEntry; import org.synchronoss.cpo.meta.DataTypeMapper; diff --git a/cpo-cassandra/src/test/java/org/synchronoss/cpo/cassandra/XmlValidationTest.java b/cpo-cassandra/src/test/java/org/synchronoss/cpo/cassandra/XmlValidationTest.java index ed4e8211b..2b63e4e5e 100644 --- a/cpo-cassandra/src/test/java/org/synchronoss/cpo/cassandra/XmlValidationTest.java +++ b/cpo-cassandra/src/test/java/org/synchronoss/cpo/cassandra/XmlValidationTest.java @@ -22,16 +22,11 @@ * ]] */ -import static org.testng.Assert.fail; - -import java.io.IOException; -import java.io.InputStream; -import org.apache.xmlbeans.XmlException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.synchronoss.cpo.core.cpoCoreConfig.CpoConfigDocument; -import org.synchronoss.cpo.helper.CpoClassLoader; -import org.synchronoss.cpo.helper.XmlBeansHelper; +import org.synchronoss.cpo.cpoconfig.CtCpoConfig; +import org.synchronoss.cpo.helper.XmlHelper; +import org.testng.Assert; import org.testng.annotations.Test; /** @@ -45,37 +40,23 @@ public class XmlValidationTest { @Test public void testBadXml() { - InputStream is = CpoClassLoader.getResourceAsStream(BAD_CPO_CONFIG_XML); + var errBuilder = new StringBuilder(); - try { - CpoConfigDocument configDoc = CpoConfigDocument.Factory.parse(is); - String errMsg = XmlBeansHelper.validateXml(configDoc); - if (errMsg == null) { - fail("Should have received an error message"); - } else { - logger.debug(errMsg); - } - } catch (IOException ioe) { - fail("Could not read config xml"); - } catch (XmlException xe) { - fail("Config xml was not well formed"); - } + CtCpoConfig cpoConfig = + XmlHelper.unmarshalXmlObject( + XmlHelper.CPO_CONFIG_XSD, BAD_CPO_CONFIG_XML, CtCpoConfig.class, errBuilder); + Assert.assertFalse(errBuilder.isEmpty(), "Should have received an error message"); } @Test public void testGoodXml() { - InputStream is = CpoClassLoader.getResourceAsStream(CPO_CONFIG_XML); - - try { - CpoConfigDocument configDoc = CpoConfigDocument.Factory.parse(is); - String errMsg = XmlBeansHelper.validateXml(configDoc); - if (errMsg != null) { - fail("Should have received an error message:" + errMsg); - } - } catch (IOException ioe) { - fail("Could not read config xml"); - } catch (XmlException xe) { - fail("Config xml was not well formed"); - } + var errBuilder = new StringBuilder(); + + CtCpoConfig cpoConfig = + XmlHelper.unmarshalXmlObject( + XmlHelper.CPO_CONFIG_XSD, CPO_CONFIG_XML, CtCpoConfig.class, errBuilder); + Assert.assertTrue( + errBuilder.isEmpty(), + "Should not have received an error message: " + errBuilder.toString()); } } diff --git a/cpo-cassandra/src/test/resources/badConfig.xml b/cpo-cassandra/src/test/resources/badConfig.xml index 21720824b..2aa2e312c 100644 --- a/cpo-cassandra/src/test/resources/badConfig.xml +++ b/cpo-cassandra/src/test/resources/badConfig.xml @@ -21,22 +21,20 @@ ]] --> - - - /cassandraMetaData.xml - + + /cassandraMetaData.xml + - - cassandraMeta - org.synchronoss.cpo.cassandra.config.CassandraCpoConfigProcessor - - ${cpo.cassandra.contactPoint} - - - + + cassandraMeta + org.synchronoss.cpo.cassandra.config.CassandraCpoConfigProcessor + + ${cpo.cassandra.contactPoint} + + + diff --git a/cpo-cassandra/src/test/resources/cassandraMetaData.xml b/cpo-cassandra/src/test/resources/cassandraMetaData.xml index 08b7d4b99..727306887 100644 --- a/cpo-cassandra/src/test/resources/cassandraMetaData.xml +++ b/cpo-cassandra/src/test/resources/cassandraMetaData.xml @@ -22,137 +22,136 @@ --> - + id int id INT - + attrAscii java.lang.String attr_ascii ASCII - + attrBigInt long attr_bigint BIGINT - + attrBlob java.nio.ByteBuffer attr_blob BLOB - + attrBlob2 java.nio.ByteBuffer attr_blob2 BLOB - + attrBool boolean attr_bool BOOLEAN - + attrCounter long attr_counter COUNTER - + attrDecimal java.math.BigDecimal attr_decimal DECIMAL - + attrDouble double attr_double DOUBLE - + attrFloat float attr_float FLOAT - + attrInet java.net.InetAddress attr_inet INET - + attrInt int attr_int INT org.synchronoss.cpo.cassandra.transform.TransformNoOp - + attrList java.util.List attr_list LIST - java.lang.String + java.lang.String - + attrMap java.util.Map attr_map MAP - java.lang.String - java.lang.String + java.lang.String + java.lang.String - + attrSet java.util.Set attr_set SET - java.lang.String + java.lang.String - + attrText java.lang.String attr_text TEXT - + attrTimeUUID java.util.UUID attr_timeuuid TIMEUUID - + attrTimestamp java.util.Date attr_timestamp TIMESTAMP - + attrUUID java.util.UUID attr_uuid UUID - + attrVarChar java.lang.String attr_varchar VARCHAR - + attrVarInt java.math.BigInteger attr_varint @@ -161,61 +160,61 @@ insert into value_object(id, attr_ascii, attr_bigint, attr_blob, attr_bool, attr_decimal, attr_double, attr_float, attr_inet, attr_int, attr_text, attr_timestamp, attr_timeuuid, attr_uuid, attr_varchar, attr_varint, attr_list, attr_set, attr_map) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) - + id - + attrAscii - + attrBigInt - + attrBlob - + attrBool - + attrDecimal - + attrDouble - + attrFloat - + attrInet - + attrInt - + attrText - + attrTimestamp - + attrTimeUUID - + attrUUID - + attrVarChar - + attrVarInt - + attrList - + attrSet - + attrMap @@ -223,13 +222,13 @@ insert into value_object (id,attr_varchar,attr_int) values (?,?,?) - + id - + attrVarChar - + attrInt @@ -237,7 +236,7 @@ delete from value_object where id = ? - + id @@ -245,7 +244,7 @@ delete from value_object where id = ? - + id @@ -253,7 +252,7 @@ select count(1) from value_object where id = ? - + id @@ -266,10 +265,10 @@ select * from value_object where attr_varchar=? __CPO_WHERE__ and attr_int=? - + attrVarChar - + attrInt @@ -287,7 +286,7 @@ select * from value_object where id = ? - + id @@ -295,7 +294,7 @@ Select * from value_object where id = ? - + id @@ -303,7 +302,7 @@ update value_object set attr_int=? - + attrInt @@ -311,13 +310,13 @@ insert into value_object (id, attr_blob, attr_blob2) values (?,?,?) - + id - + attrBlob - + attrBlob2 @@ -325,7 +324,7 @@ delete from value_object where id = ? - + id @@ -333,7 +332,7 @@ select * from value_object where id = ? - + id @@ -341,13 +340,13 @@ update value_object set attr_blob=?, attr_blob2=? where id = ? - + attrBlob - + attrBlob2 - + id diff --git a/cpo-cassandra/src/test/resources/cpoConfig.xml b/cpo-cassandra/src/test/resources/cpoConfig.xml index 1c7ef8d90..19af15406 100644 --- a/cpo-cassandra/src/test/resources/cpoConfig.xml +++ b/cpo-cassandra/src/test/resources/cpoConfig.xml @@ -21,51 +21,49 @@ ]] --> - - - ${cassandra.metaXml} - - - ${cassandra.metaXml} - - - ${cassandra.metaXml} - + + ${cassandra.metaXml} + + + ${cassandra.metaXml} + + + ${cassandra.metaXml} + - - cassandraMeta - org.synchronoss.cpo.cassandra.config.CassandraCpoConfigProcessor - - ${cassandra.keyspace} - ${cassandra.contactPoint} - ${cassandra.nativeport} - - - - - - - caseSensitive - org.synchronoss.cpo.cassandra.config.CassandraCpoConfigProcessor - - ${cassandra.keyspace} - ${cassandra.contactPoint} - ${cassandra.nativeport} - - - - caseInsensitive - org.synchronoss.cpo.cassandra.config.CassandraCpoConfigProcessor - - ${cassandra.keyspace} - ${cassandra.contactPoint} - ${cassandra.nativeport} - - - + + cassandraMeta + org.synchronoss.cpo.cassandra.config.CassandraCpoConfigProcessor + + ${cassandra.keyspace} + ${cassandra.contactPoint} + ${cassandra.nativeport} + + + + + + + caseSensitive + org.synchronoss.cpo.cassandra.config.CassandraCpoConfigProcessor + + ${cassandra.keyspace} + ${cassandra.contactPoint} + ${cassandra.nativeport} + + + + caseInsensitive + org.synchronoss.cpo.cassandra.config.CassandraCpoConfigProcessor + + ${cassandra.keyspace} + ${cassandra.contactPoint} + ${cassandra.nativeport} + + + diff --git a/cpo-cassandra/src/test/resources/hotDeployMetaData.xml b/cpo-cassandra/src/test/resources/hotDeployMetaData.xml index 642c13006..64c27bab4 100644 --- a/cpo-cassandra/src/test/resources/hotDeployMetaData.xml +++ b/cpo-cassandra/src/test/resources/hotDeployMetaData.xml @@ -21,8 +21,8 @@ ]] --> - + diff --git a/cpo-core/pom.xml b/cpo-core/pom.xml index 1283fe79a..b33e16760 100644 --- a/cpo-core/pom.xml +++ b/cpo-core/pom.xml @@ -49,11 +49,6 @@ javax.servlet javax.servlet-api - - - org.apache.logging.log4j - log4j-to-slf4j - ch.qos.logback @@ -67,23 +62,37 @@ ${logbackVersion} test - - org.apache.xmlbeans - xmlbeans - + + jakarta.xml.bind + jakarta.xml.bind-api + + + org.glassfish.jaxb + jaxb-runtime + runtime + - - org.apache.xmlbeans - xmlbeans - - ${project.basedir}/src/main/xsd - ${project.build.directory}/generated-sources/xmlbeans - ${project.groupId}.${project.name}.metadata - ${project.name} - - + + org.codehaus.mojo + jaxb2-maven-plugin + 4.0.0 + + + xjc-schema1 + + xjc + + + + + src/main/resources/xsd + + + + + diff --git a/cpo-core/src/main/java/org/synchronoss/cpo/CpoAdapterFactoryManager.java b/cpo-core/src/main/java/org/synchronoss/cpo/CpoAdapterFactoryManager.java index 1c88837de..e19b5d0fc 100644 --- a/cpo-core/src/main/java/org/synchronoss/cpo/CpoAdapterFactoryManager.java +++ b/cpo-core/src/main/java/org/synchronoss/cpo/CpoAdapterFactoryManager.java @@ -22,22 +22,18 @@ * ]] */ -import java.io.IOException; -import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.util.concurrent.locks.ReentrantLock; -import org.apache.xmlbeans.XmlException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.synchronoss.cpo.cache.CpoAdapterFactoryCache; import org.synchronoss.cpo.config.CpoConfigProcessor; -import org.synchronoss.cpo.core.cpoCoreConfig.CpoConfigDocument; -import org.synchronoss.cpo.core.cpoCoreConfig.CtCpoConfig; -import org.synchronoss.cpo.core.cpoCoreConfig.CtDataSourceConfig; -import org.synchronoss.cpo.core.cpoCoreConfig.CtMetaDescriptor; +import org.synchronoss.cpo.cpoconfig.CtCpoConfig; +import org.synchronoss.cpo.cpoconfig.CtDataSourceConfig; +import org.synchronoss.cpo.cpoconfig.CtMetaDescriptor; import org.synchronoss.cpo.helper.CpoClassLoader; import org.synchronoss.cpo.helper.ExceptionHelper; -import org.synchronoss.cpo.helper.XmlBeansHelper; +import org.synchronoss.cpo.helper.XmlHelper; import org.synchronoss.cpo.jta.CpoXaResource; import org.synchronoss.cpo.meta.CpoMetaDescriptor; @@ -115,68 +111,47 @@ private static void loadAdapters(String cpoConfig) { lock.lock(); try { var errBuilder = new StringBuilder(); - try (InputStream is = XmlBeansHelper.loadXmlStream(cpoConfig, errBuilder)) { - CpoConfigDocument configDoc; - if (is == null) { - // See if the config is sent in as a string - try { - configDoc = CpoConfigDocument.Factory.parse(cpoConfig); - } catch (XmlException e) { - throw new CpoException(errBuilder.toString(), e); - } - } else { - configDoc = CpoConfigDocument.Factory.parse(is); - } + CtCpoConfig ctCpoConfig = + XmlHelper.unmarshalXmlObject( + XmlHelper.CPO_CONFIG_XSD, cpoConfig, CtCpoConfig.class, errBuilder); + if (!errBuilder.isEmpty()) { + throw new RuntimeException("Error parsing CPO config XML: " + errBuilder.toString()); + } + logger.info("Processing Config File: " + cpoConfig); + // Moving the clear to here to make sure we get a good file before we just blow away all + // the + // adapters. + // We are doing a load clear all the caches first, in case the load gets called more than + // once. + CpoMetaDescriptor.clearAllInstances(); + clearCpoAdapterFactoryCache(); + + // Set the default context. + defaultContext = ctCpoConfig.getDefaultConfig(); + if (defaultContext == null) { + // make the first listed config the default. + defaultContext = ctCpoConfig.getDataConfig().getFirst().getValue().getName(); + } + + for (CtMetaDescriptor metaDescriptor : ctCpoConfig.getMetaConfig()) { + boolean caseSensitive = true; + caseSensitive = metaDescriptor.isCaseSensitive(); + + // this will create and cache, so we don't need the return + CpoMetaDescriptor.getInstance( + metaDescriptor.getName(), metaDescriptor.getMetaXml(), caseSensitive); + } - String errMsg = XmlBeansHelper.validateXml(configDoc); - if (errMsg != null) { - logger.error("Invalid CPO Config file: " + cpoConfig + ":" + errMsg); - } else { - logger.info("Processing Config File: " + cpoConfig); - // Moving the clear to here to make sure we get a good file before we just blow away all - // the - // adapters. - // We are doing a load clear all the caches first, in case the load gets called more than - // once. - CpoMetaDescriptor.clearAllInstances(); - clearCpoAdapterFactoryCache(); - - CtCpoConfig ctCpoConfig = configDoc.getCpoConfig(); - - // Set the default context. - if (ctCpoConfig.isSetDefaultConfig()) { - defaultContext = ctCpoConfig.getDefaultConfig(); - } else { - // make the first listed config the default. - defaultContext = ctCpoConfig.getDataConfigArray(0).getName(); - } - - for (CtMetaDescriptor metaDescriptor : ctCpoConfig.getMetaConfigArray()) { - boolean caseSensitive = true; - if (metaDescriptor.isSetCaseSensitive()) { - caseSensitive = metaDescriptor.getCaseSensitive(); - } - - // this will create and cache, so we don't need the return - CpoMetaDescriptor.getInstance( - metaDescriptor.getName(), metaDescriptor.getMetaXmlArray(), caseSensitive); - } - - // now lets loop through all the adapters and get them cached. - for (CtDataSourceConfig dataSourceConfig : ctCpoConfig.getDataConfigArray()) { - CpoAdapterFactory cpoAdapterFactory = makeCpoAdapterFactory(dataSourceConfig); - if (cpoAdapterFactory != null) { - addCpoAdapterFactory(dataSourceConfig.getName(), cpoAdapterFactory); - } - } + // now lets loop through all the adapters and get them cached. + for (var jaxbElement : ctCpoConfig.getDataConfig()) { + CtDataSourceConfig dataSourceConfig = jaxbElement.getValue(); + CpoAdapterFactory cpoAdapterFactory = makeCpoAdapterFactory(dataSourceConfig); + if (cpoAdapterFactory != null) { + addCpoAdapterFactory(dataSourceConfig.getName(), cpoAdapterFactory); } - } catch (IOException ioe) { - logger.error("Error reading " + cpoConfig + ": ", ioe); - } catch (XmlException xe) { - logger.error("Error processing " + cpoConfig + ": Invalid XML", xe); - } catch (CpoException ce) { - logger.error("Error processing " + cpoConfig + ": ", ce); } + } catch (Exception e) { + logger.error("Error unmarshalling XML " + cpoConfig + ": ", e); } finally { lock.unlock(); } diff --git a/cpo-core/src/main/java/org/synchronoss/cpo/config/CpoConfigProcessor.java b/cpo-core/src/main/java/org/synchronoss/cpo/config/CpoConfigProcessor.java index 33bb68ea7..9da8ffc5a 100644 --- a/cpo-core/src/main/java/org/synchronoss/cpo/config/CpoConfigProcessor.java +++ b/cpo-core/src/main/java/org/synchronoss/cpo/config/CpoConfigProcessor.java @@ -24,7 +24,7 @@ import org.synchronoss.cpo.CpoAdapterFactory; import org.synchronoss.cpo.CpoException; -import org.synchronoss.cpo.core.cpoCoreConfig.CtDataSourceConfig; +import org.synchronoss.cpo.cpoconfig.CtDataSourceConfig; /** * @author dberry diff --git a/cpo-core/src/main/java/org/synchronoss/cpo/exporter/CoreMetaXmlObjectExporter.java b/cpo-core/src/main/java/org/synchronoss/cpo/exporter/CoreMetaXmlObjectExporter.java index 895a4f12e..b5919a873 100644 --- a/cpo-core/src/main/java/org/synchronoss/cpo/exporter/CoreMetaXmlObjectExporter.java +++ b/cpo-core/src/main/java/org/synchronoss/cpo/exporter/CoreMetaXmlObjectExporter.java @@ -23,20 +23,9 @@ */ import org.synchronoss.cpo.MetaVisitor; -import org.synchronoss.cpo.core.cpoCoreMeta.CpoMetaDataDocument; -import org.synchronoss.cpo.core.cpoCoreMeta.CtArgument; -import org.synchronoss.cpo.core.cpoCoreMeta.CtAttribute; -import org.synchronoss.cpo.core.cpoCoreMeta.CtClass; -import org.synchronoss.cpo.core.cpoCoreMeta.CtCpoMetaData; -import org.synchronoss.cpo.core.cpoCoreMeta.CtFunction; -import org.synchronoss.cpo.core.cpoCoreMeta.CtFunctionGroup; -import org.synchronoss.cpo.core.cpoCoreMeta.StFunctionGroupType; +import org.synchronoss.cpo.cpometa.*; import org.synchronoss.cpo.meta.CpoMetaDescriptor; -import org.synchronoss.cpo.meta.domain.CpoArgument; -import org.synchronoss.cpo.meta.domain.CpoAttribute; -import org.synchronoss.cpo.meta.domain.CpoClass; -import org.synchronoss.cpo.meta.domain.CpoFunction; -import org.synchronoss.cpo.meta.domain.CpoFunctionGroup; +import org.synchronoss.cpo.meta.domain.*; /** * XmlObject exporter for meta objects @@ -46,29 +35,31 @@ */ public class CoreMetaXmlObjectExporter implements MetaXmlObjectExporter, MetaVisitor { - protected CpoMetaDataDocument cpoMetaDataDocument = null; + protected CtCpoMetaData ctCpoMetaData = null; protected CtClass currentCtClass; protected CtFunctionGroup currentCtFunctionGroup; protected CtFunction currentCtFunction; + protected ObjectFactory objectFactory = new ObjectFactory(); public CoreMetaXmlObjectExporter(CpoMetaDescriptor metaDescriptor) { - cpoMetaDataDocument = CpoMetaDataDocument.Factory.newInstance(); - CtCpoMetaData ctCpoMetaData = cpoMetaDataDocument.addNewCpoMetaData(); + ctCpoMetaData = new CtCpoMetaData(); ctCpoMetaData.setMetaDescriptor(metaDescriptor.getClass().getName()); ctCpoMetaData.setDefaultPackageName(metaDescriptor.getDefaultPackageName()); } @Override - public CpoMetaDataDocument getCpoMetaDataDocument() { - return cpoMetaDataDocument; + public CtCpoMetaData getCpoMetaData() { + return ctCpoMetaData; } @Override public void visit(CpoClass cpoClass) { - CtClass ctClass = cpoMetaDataDocument.getCpoMetaData().addNewCpoClass(); + CtClass ctClass = new CtClass(); + ctCpoMetaData.getCpoClass().add(ctClass); + ctClass.setName(cpoClass.getName()); - if (cpoClass.getDescription() != null && cpoClass.getDescription().length() > 0) { + if (cpoClass.getDescription() != null && !cpoClass.getDescription().isEmpty()) { ctClass.setDescription(cpoClass.getDescription()); } @@ -79,7 +70,9 @@ public void visit(CpoClass cpoClass) { @Override public void visit(CpoAttribute cpoAttribute) { if (currentCtClass != null) { - CtAttribute ctAttribute = currentCtClass.addNewCpoAttribute(); + CtAttribute ctAttribute = new CtAttribute(); + var jaxbElement = objectFactory.createCpoAttribute(ctAttribute); + currentCtClass.getCpoAttribute().add(jaxbElement); ctAttribute.setJavaName(cpoAttribute.getJavaName()); ctAttribute.setJavaType(cpoAttribute.getJavaType()); @@ -87,11 +80,11 @@ public void visit(CpoAttribute cpoAttribute) { ctAttribute.setDataType(cpoAttribute.getDataType()); if (cpoAttribute.getTransformClassName() != null - && cpoAttribute.getTransformClassName().length() > 0) { + && !cpoAttribute.getTransformClassName().isEmpty()) { ctAttribute.setTransformClass(cpoAttribute.getTransformClassName()); } - if (cpoAttribute.getDescription() != null && cpoAttribute.getDescription().length() > 0) { + if (cpoAttribute.getDescription() != null && !cpoAttribute.getDescription().isEmpty()) { ctAttribute.setDescription(cpoAttribute.getDescription()); } } @@ -100,16 +93,17 @@ public void visit(CpoAttribute cpoAttribute) { @Override public void visit(CpoFunctionGroup cpoFunctionGroup) { if (currentCtClass != null) { - CtFunctionGroup ctFunctionGroup = currentCtClass.addNewCpoFunctionGroup(); + CtFunctionGroup ctFunctionGroup = new CtFunctionGroup(); + currentCtClass.getCpoFunctionGroup().add(ctFunctionGroup); - if (cpoFunctionGroup.getName() != null && cpoFunctionGroup.getName().length() > 0) { + if (cpoFunctionGroup.getName() != null && !cpoFunctionGroup.getName().isEmpty()) { ctFunctionGroup.setName(cpoFunctionGroup.getName()); } - ctFunctionGroup.setType(StFunctionGroupType.Enum.forString(cpoFunctionGroup.getType())); + ctFunctionGroup.setType(StFunctionGroupType.fromValue(cpoFunctionGroup.getType())); if (cpoFunctionGroup.getDescription() != null - && cpoFunctionGroup.getDescription().length() > 0) { + && !cpoFunctionGroup.getDescription().isEmpty()) { ctFunctionGroup.setDescription(cpoFunctionGroup.getDescription()); } @@ -121,12 +115,13 @@ public void visit(CpoFunctionGroup cpoFunctionGroup) { @Override public void visit(CpoFunction cpoFunction) { if (currentCtFunctionGroup != null) { - CtFunction ctFunction = currentCtFunctionGroup.addNewCpoFunction(); + CtFunction ctFunction = new CtFunction(); + currentCtFunctionGroup.getCpoFunction().add(ctFunction); ctFunction.setName(cpoFunction.getName()); ctFunction.setExpression(cpoFunction.getExpression()); - if (cpoFunction.getDescription() != null && cpoFunction.getDescription().length() > 0) { + if (cpoFunction.getDescription() != null && !cpoFunction.getDescription().isEmpty()) { ctFunction.setDescription(cpoFunction.getDescription()); } @@ -138,11 +133,13 @@ public void visit(CpoFunction cpoFunction) { @Override public void visit(CpoArgument cpoArgument) { if (currentCtFunction != null) { - CtArgument ctArgument = currentCtFunction.addNewCpoArgument(); + CtArgument ctArgument = new CtArgument(); + var jaxbElement = objectFactory.createCpoArgument(ctArgument); + currentCtFunction.getCpoArgument().add(jaxbElement); ctArgument.setAttributeName(cpoArgument.getAttribute().getJavaName()); - if (cpoArgument.getDescription() != null && cpoArgument.getDescription().length() > 0) { + if (cpoArgument.getDescription() != null && !cpoArgument.getDescription().isEmpty()) { ctArgument.setDescription(cpoArgument.getDescription()); } } diff --git a/cpo-core/src/main/java/org/synchronoss/cpo/exporter/MetaXmlObjectExporter.java b/cpo-core/src/main/java/org/synchronoss/cpo/exporter/MetaXmlObjectExporter.java index bd69ec025..3b1c26d95 100644 --- a/cpo-core/src/main/java/org/synchronoss/cpo/exporter/MetaXmlObjectExporter.java +++ b/cpo-core/src/main/java/org/synchronoss/cpo/exporter/MetaXmlObjectExporter.java @@ -23,7 +23,7 @@ */ import org.synchronoss.cpo.MetaVisitor; -import org.synchronoss.cpo.core.cpoCoreMeta.CpoMetaDataDocument; +import org.synchronoss.cpo.cpometa.CtCpoMetaData; /** * XmlObject exporter for meta objects @@ -33,5 +33,5 @@ */ public interface MetaXmlObjectExporter extends MetaVisitor { - CpoMetaDataDocument getCpoMetaDataDocument(); + CtCpoMetaData getCpoMetaData(); } diff --git a/cpo-core/src/main/java/org/synchronoss/cpo/helper/XmlBeansHelper.java b/cpo-core/src/main/java/org/synchronoss/cpo/helper/XmlBeansHelper.java deleted file mode 100644 index 597685049..000000000 --- a/cpo-core/src/main/java/org/synchronoss/cpo/helper/XmlBeansHelper.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.synchronoss.cpo.helper; - -/*- - * [[ - * core - * == - * Copyright (C) 2003 - 2025 David E. Berry - * == - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * . - * ]] - */ - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.ArrayList; -import org.apache.xmlbeans.XmlError; -import org.apache.xmlbeans.XmlObject; -import org.apache.xmlbeans.XmlOptions; - -/** - * @author dberry - */ -public class XmlBeansHelper { - public static String validateXml(XmlObject xmlObj) { - StringBuilder sb = new StringBuilder(); - String errMsg = null; - ArrayList validationErrors = new ArrayList<>(); - XmlOptions validationOptions = new XmlOptions(); - validationOptions.setErrorListener(validationErrors); - boolean isValid = - xmlObj.validate(validationOptions); // to display error we should pass options. - if (!isValid) { - for (XmlError es : validationErrors) { - sb.append(es.getMessage()); - } - if (sb.length() > 0) errMsg = sb.toString(); - } - return errMsg; - } - - public static XmlOptions getXmlOptions() { - XmlOptions xo = new XmlOptions(); - xo.setCharacterEncoding("utf-8"); - xo.setSaveAggressiveNamespaces(); - xo.setSaveNamespacesFirst(); - xo.setSavePrettyPrint(); - xo.setUseDefaultNamespace(); - return xo; - } - - public static InputStream loadXmlStream(String xmlStr, StringBuilder errorBuilder) { - InputStream is = null; - // See if the file is a uri - try { - URL cpoConfigUrl = new URL(xmlStr); - is = cpoConfigUrl.openStream(); - } catch (IOException e) { - errorBuilder.append("Uri Not Found: ").append(xmlStr).append("\n"); - } - - // See if the file is a resource in the jar - if (is == null) is = CpoClassLoader.getResourceAsStream(xmlStr); - - if (is == null) { - errorBuilder.append("Resource Not Found: ").append(xmlStr).append("\n"); - try { - // See if the file is a local file on the server - is = new FileInputStream(xmlStr); - } catch (FileNotFoundException fnfe) { - errorBuilder.append("File Not Found: ").append(xmlStr).append("\n"); - is = null; - } - } - - return is; - } -} diff --git a/cpo-core/src/main/java/org/synchronoss/cpo/helper/XmlHelper.java b/cpo-core/src/main/java/org/synchronoss/cpo/helper/XmlHelper.java new file mode 100644 index 000000000..29dea4266 --- /dev/null +++ b/cpo-core/src/main/java/org/synchronoss/cpo/helper/XmlHelper.java @@ -0,0 +1,116 @@ +package org.synchronoss.cpo.helper; + +/*- + * [[ + * core + * == + * Copyright (C) 2003 - 2025 David E. Berry + * == + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * . + * ]] + */ + +import jakarta.xml.bind.*; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import javax.xml.XMLConstants; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; + +/** + * @author dberry + */ +public class XmlHelper { + public static final String CPO_META_XSD = "xsd/CpoMeta.xsd"; + public static final String CPO_CONFIG_XSD = "xsd/CpoConfig.xsd"; + + public static InputStream loadXmlStream(String xmlStr, StringBuilder errorBuilder) { + InputStream is = null; + int errBuilderLen = errorBuilder.length(); + + // See if the file is a uri + try { + URL cpoConfigUrl = new URL(xmlStr); + is = cpoConfigUrl.openStream(); + } catch (IOException e) { + errorBuilder.append("Uri Not Found: ").append(xmlStr).append("\n"); + } + + // See if the file is a resource in the jar + if (is == null) is = CpoClassLoader.getResourceAsStream(xmlStr); + + if (is == null) { + errorBuilder.append("Resource Not Found: ").append(xmlStr).append("\n"); + try { + // See if the file is a local file on the server + is = new FileInputStream(xmlStr); + } catch (FileNotFoundException fnfe) { + errorBuilder.append("File Not Found: ").append(xmlStr).append("\n"); + is = null; + } + } + if (is != null) errorBuilder.setLength(errBuilderLen); + + return is; + } + + public static void setMarshallerProperties(Marshaller marshaller) throws PropertyException { + marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + } + + public static T unmarshalXmlObject( + String xsd, String xml, Class objClass, StringBuilder errorBuilder) { + try (var xsdStream = loadXmlStream(xsd, errorBuilder); + var xmlStream = loadXmlStream(xml, errorBuilder)) { + StreamSource configSource = new StreamSource(xsdStream); + SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + Schema schema = schemaFactory.newSchema(configSource); + + JAXBContext jaxbContext = JAXBContext.newInstance(objClass); + Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); + unmarshaller.setSchema(schema); + unmarshaller.setEventHandler( + (ValidationEventHandler) + event -> { + ValidationEventLocator locator = event.getLocator(); + errorBuilder.append("Validation Error: " + event.getMessage() + "\n"); + errorBuilder.append( + "Line: " + + locator.getLineNumber() + + ", Column: " + + locator.getColumnNumber() + + "\n"); + return true; // Return true to continue processing, false to stop + }); + + Object xmlObject = unmarshaller.unmarshal(xmlStream); + @SuppressWarnings("unchecked") + T obj = + (xmlObject instanceof JAXBElement) + ? (T) ((JAXBElement) xmlObject).getValue() + : (T) xmlObject; + + return obj; + } catch (Exception e) { + errorBuilder.append("Could not reading config xml " + xml + "or xsd " + xsd + "\n"); + } + return null; + } +} diff --git a/cpo-core/src/main/java/org/synchronoss/cpo/meta/AbstractCpoMetaAdapter.java b/cpo-core/src/main/java/org/synchronoss/cpo/meta/AbstractCpoMetaAdapter.java index 367d47a5c..530e0731d 100644 --- a/cpo-core/src/main/java/org/synchronoss/cpo/meta/AbstractCpoMetaAdapter.java +++ b/cpo-core/src/main/java/org/synchronoss/cpo/meta/AbstractCpoMetaAdapter.java @@ -26,20 +26,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.synchronoss.cpo.CpoException; -import org.synchronoss.cpo.core.cpoCoreMeta.CpoMetaDataDocument; -import org.synchronoss.cpo.core.cpoCoreMeta.CtArgument; -import org.synchronoss.cpo.core.cpoCoreMeta.CtAttribute; -import org.synchronoss.cpo.core.cpoCoreMeta.CtClass; -import org.synchronoss.cpo.core.cpoCoreMeta.CtFunction; -import org.synchronoss.cpo.core.cpoCoreMeta.CtFunctionGroup; +import org.synchronoss.cpo.cpometa.*; import org.synchronoss.cpo.enums.Crud; -import org.synchronoss.cpo.meta.domain.CpoArgument; -import org.synchronoss.cpo.meta.domain.CpoAttribute; -import org.synchronoss.cpo.meta.domain.CpoClass; -import org.synchronoss.cpo.meta.domain.CpoClassCaseInsensitive; -import org.synchronoss.cpo.meta.domain.CpoClassCaseSensitive; -import org.synchronoss.cpo.meta.domain.CpoFunction; -import org.synchronoss.cpo.meta.domain.CpoFunctionGroup; +import org.synchronoss.cpo.meta.domain.*; /** * @author dberry @@ -163,9 +152,9 @@ public List getAllowableDataTypes() throws CpoException { protected abstract DataTypeMapper getDataTypeMapper(); - protected void loadCpoMetaDataDocument(CpoMetaDataDocument metaDataDoc, boolean caseSensitive) + protected void loadCpoMetaDataDocument(CtCpoMetaData ctCpoMetaData, boolean caseSensitive) throws CpoException { - for (CtClass ctClass : metaDataDoc.getCpoMetaData().getCpoClassArray()) { + for (CtClass ctClass : ctCpoMetaData.getCpoClass()) { CpoClass cpoClass = getCpoClass(ctClass.getName()); if (cpoClass == null) { @@ -185,19 +174,28 @@ protected void loadCpoClass(CpoClass cpoClass, CtClass ctClass) throws CpoExcept currentClass = cpoClass; - for (CtAttribute ctAttribute : ctClass.getCpoAttributeArray()) { + logger.debug("Loading " + ctClass.getCpoAttribute().size() + " attributes "); + + for (var jaxbElement : ctClass.getCpoAttribute()) { + CtAttribute ctAttribute = jaxbElement.getValue(); + logger.debug("ctAttribute: " + ctAttribute); + logger.debug("ctAttribute.getValue(): " + ctAttribute); + logger.debug("ctAttribute.getValue().getJavaName(): " + ctAttribute.getJavaName()); CpoAttribute cpoAttribute = cpoClass.getAttributeJava(ctAttribute.getJavaName()); + logger.debug("cpoAttribute: " + cpoAttribute); if (cpoAttribute == null) { cpoAttribute = createCpoAttribute(); + logger.debug("loading attribute: " + ctAttribute.getJavaName()); loadCpoAttribute(cpoAttribute, ctAttribute); + logger.debug("loaded attribute: " + ctAttribute.getJavaName()); cpoClass.addAttribute(cpoAttribute); } else { loadCpoAttribute(cpoAttribute, ctAttribute); } } - for (CtFunctionGroup ctFunctionGroup : ctClass.getCpoFunctionGroupArray()) { + for (CtFunctionGroup ctFunctionGroup : ctClass.getCpoFunctionGroup()) { CpoFunctionGroup functionGroup = null; try { @@ -235,12 +233,10 @@ protected void loadCpoAttribute(CpoAttribute cpoAttribute, CtAttribute ctAttribu protected void loadCpoFunctionGroup( CpoFunctionGroup cpoFunctionGroup, CtFunctionGroup ctFunctionGroup) { cpoFunctionGroup.setDescription(ctFunctionGroup.getDescription()); - if (ctFunctionGroup.isSetName()) { - cpoFunctionGroup.setName(ctFunctionGroup.getName()); - } + cpoFunctionGroup.setName(ctFunctionGroup.getName()); cpoFunctionGroup.setType(ctFunctionGroup.getType().toString()); - for (CtFunction ctFunction : ctFunctionGroup.getCpoFunctionArray()) { + for (CtFunction ctFunction : ctFunctionGroup.getCpoFunction()) { CpoFunction cpoFunction = createCpoFunction(); cpoFunctionGroup.addFunction(cpoFunction); loadCpoFunction(cpoFunction, ctFunction); @@ -252,10 +248,13 @@ protected void loadCpoFunction(CpoFunction cpoFunction, CtFunction ctFunction) { cpoFunction.setExpression(ctFunction.getExpression()); cpoFunction.setDescription(ctFunction.getDescription()); - for (CtArgument ctArgument : ctFunction.getCpoArgumentArray()) { + for (var jaxbElement : ctFunction.getCpoArgument()) { + CtArgument ctArgument = jaxbElement.getValue(); CpoArgument cpoArgument = createCpoArgument(); cpoFunction.addArgument(cpoArgument); + logger.debug("loading argument: " + ctArgument.getAttributeName()); loadCpoArgument(cpoArgument, ctArgument); + logger.debug("loaded argument: " + ctArgument.getAttributeName()); } } diff --git a/cpo-core/src/main/java/org/synchronoss/cpo/meta/CpoMetaDescriptor.java b/cpo-core/src/main/java/org/synchronoss/cpo/meta/CpoMetaDescriptor.java index 51861a81d..af888e982 100644 --- a/cpo-core/src/main/java/org/synchronoss/cpo/meta/CpoMetaDescriptor.java +++ b/cpo-core/src/main/java/org/synchronoss/cpo/meta/CpoMetaDescriptor.java @@ -22,29 +22,31 @@ * ]] */ -import java.io.*; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import java.io.File; +import java.io.OutputStream; +import java.io.Writer; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; -import org.apache.xmlbeans.XmlException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.synchronoss.cpo.CpoException; import org.synchronoss.cpo.cache.CpoMetaDescriptorCache; -import org.synchronoss.cpo.core.cpoCoreMeta.CpoMetaDataDocument; +import org.synchronoss.cpo.cpometa.CtCpoMetaData; +import org.synchronoss.cpo.cpometa.ObjectFactory; import org.synchronoss.cpo.exporter.CoreMetaXmlObjectExporter; import org.synchronoss.cpo.exporter.MetaXmlObjectExporter; import org.synchronoss.cpo.helper.CpoClassLoader; import org.synchronoss.cpo.helper.ExceptionHelper; -import org.synchronoss.cpo.helper.XmlBeansHelper; -import org.synchronoss.cpo.meta.domain.CpoArgument; -import org.synchronoss.cpo.meta.domain.CpoAttribute; -import org.synchronoss.cpo.meta.domain.CpoClass; -import org.synchronoss.cpo.meta.domain.CpoFunction; -import org.synchronoss.cpo.meta.domain.CpoFunctionGroup; +import org.synchronoss.cpo.helper.XmlHelper; +import org.synchronoss.cpo.meta.domain.*; import org.synchronoss.cpo.parser.ExpressionParser; /** @@ -165,109 +167,94 @@ protected static CpoMetaDescriptor createUpdateInstance( String metaDescriptorClassName = null; var errBuilder = new StringBuilder(); - for (String metaXml : metaXmls) { - - try (InputStream is = XmlBeansHelper.loadXmlStream(metaXml, errBuilder)) { - CpoMetaDataDocument metaDataDoc; - if (is == null) { - // See if the config is sent in as a string - try { - metaDataDoc = CpoMetaDataDocument.Factory.parse(metaXml); - } catch (XmlException e) { - throw new CpoException(errBuilder.toString(), e); - } - } else { - metaDataDoc = CpoMetaDataDocument.Factory.parse(is); + try { + logger.debug("CpoMetaDescriptor: " + metaDescriptor); + + for (String metaXml : metaXmls) { + logger.debug("Processing: " + metaXml); + errBuilder.setLength(0); + CtCpoMetaData ctCpoMetaData = + XmlHelper.unmarshalXmlObject( + XmlHelper.CPO_META_XSD, metaXml, CtCpoMetaData.class, errBuilder); + if (!errBuilder.isEmpty()) { + throw new RuntimeException("Error parsing CPO meta XML: " + errBuilder.toString()); } - String errMsg = XmlBeansHelper.validateXml(metaDataDoc); - if (errMsg != null) { - throw new CpoException("Invalid metaXml: " + metaXml + ":" + errMsg); - } + try { + if (metaDescriptor == null) { + logger.debug("Getting descriptor name"); + metaDescriptorClassName = ctCpoMetaData.getMetaDescriptor(); + logger.debug("Getting the Class"); + Class clazz = CpoClassLoader.forName(metaDescriptorClassName); + logger.debug("Getting the Constructor"); + Constructor cons = clazz.getConstructor(String.class, boolean.class); + logger.debug("Creating the instance"); + metaDescriptor = (CpoMetaDescriptor) cons.newInstance(name, caseSensitive); + logger.debug("Adding the MetaDescriptor"); + addCpoMetaDescriptor(metaDescriptor); + } else if (!metaDescriptor + .getClass() + .getName() + .equals(ctCpoMetaData.getMetaDescriptor())) { + throw new CpoException( + "Error processing multiple metaXml files. All files must have the same" + + " CpoMetaDescriptor class name."); + } - if (metaDescriptor == null) { - logger.debug("Getting descriptor name"); - metaDescriptorClassName = metaDataDoc.getCpoMetaData().getMetaDescriptor(); - logger.debug("Getting the Class"); - Class clazz = CpoClassLoader.forName(metaDescriptorClassName); - logger.debug("Getting the Constructor"); - Constructor cons = clazz.getConstructor(String.class, boolean.class); - logger.debug("Creating the instance"); - metaDescriptor = (CpoMetaDescriptor) cons.newInstance(name, caseSensitive); - logger.debug("Adding the MetaDescriptor"); - addCpoMetaDescriptor(metaDescriptor); - } else if (!metaDescriptor - .getClass() - .getName() - .equals(metaDataDoc.getCpoMetaData().getMetaDescriptor())) { + metaDescriptor.setDefaultPackageName(ctCpoMetaData.getDefaultPackageName()); + metaDescriptor.getCpoMetaAdapter().loadCpoMetaDataDocument(ctCpoMetaData, caseSensitive); + } catch (ClassNotFoundException cnfe) { + throw new CpoException( + "CpoMetaAdapter not found: " + + metaDescriptorClassName + + ": " + + ExceptionHelper.getLocalizedMessage(cnfe)); + } catch (IllegalAccessException iae) { + throw new CpoException( + "Could not access CpoMetaAdapter: " + + metaDescriptorClassName + + ": " + + ExceptionHelper.getLocalizedMessage(iae)); + } catch (InstantiationException ie) { + throw new CpoException( + "Could not instantiate CpoMetaAdapter: " + + metaDescriptorClassName + + ": " + + ExceptionHelper.getLocalizedMessage(ie)); + } catch (InvocationTargetException ite) { + throw new CpoException( + "Could not invoke constructor: " + + metaDescriptorClassName + + ": " + + ExceptionHelper.getLocalizedMessage(ite)); + } catch (IllegalArgumentException iae) { throw new CpoException( - "Error processing multiple metaXml files. All files must have the same" - + " CpoMetaDescriptor class name."); + "Illegal Argument to constructor: " + + metaDescriptorClassName + + ": " + + ExceptionHelper.getLocalizedMessage(iae)); + } catch (NoSuchMethodException nsme) { + throw new CpoException( + "Could not find constructor: " + + metaDescriptorClassName + + ": " + + ExceptionHelper.getLocalizedMessage(nsme)); + } catch (SecurityException se) { + throw new CpoException( + "Not allowed to access constructor: " + + metaDescriptorClassName + + ": " + + ExceptionHelper.getLocalizedMessage(se)); + } catch (ClassCastException cce) { + throw new CpoException( + "Class is not instance of CpoMetaDescriptor: " + + metaDescriptorClassName + + ":" + + ExceptionHelper.getLocalizedMessage(cce)); } - - metaDescriptor.setDefaultPackageName(metaDataDoc.getCpoMetaData().getDefaultPackageName()); - metaDescriptor.getCpoMetaAdapter().loadCpoMetaDataDocument(metaDataDoc, caseSensitive); - } catch (IOException ioe) { - throw new CpoException( - "Error processing metaData from InputStream: " - + metaXml - + ": " - + ExceptionHelper.getLocalizedMessage(ioe)); - } catch (XmlException xe) { - throw new CpoException( - "Error processing metaData from String: " - + metaXml - + ": " - + ExceptionHelper.getLocalizedMessage(xe)); - } catch (ClassNotFoundException cnfe) { - throw new CpoException( - "CpoMetaAdapter not found: " - + metaDescriptorClassName - + ": " - + ExceptionHelper.getLocalizedMessage(cnfe)); - } catch (IllegalAccessException iae) { - throw new CpoException( - "Could not access CpoMetaAdapter: " - + metaDescriptorClassName - + ": " - + ExceptionHelper.getLocalizedMessage(iae)); - } catch (InstantiationException ie) { - throw new CpoException( - "Could not instantiate CpoMetaAdapter: " - + metaDescriptorClassName - + ": " - + ExceptionHelper.getLocalizedMessage(ie)); - } catch (InvocationTargetException ite) { - throw new CpoException( - "Could not invoke constructor: " - + metaDescriptorClassName - + ": " - + ExceptionHelper.getLocalizedMessage(ite)); - } catch (IllegalArgumentException iae) { - throw new CpoException( - "Illegal Argument to constructor: " - + metaDescriptorClassName - + ": " - + ExceptionHelper.getLocalizedMessage(iae)); - } catch (NoSuchMethodException nsme) { - throw new CpoException( - "Could not find constructor: " - + metaDescriptorClassName - + ": " - + ExceptionHelper.getLocalizedMessage(nsme)); - } catch (SecurityException se) { - throw new CpoException( - "Not allowed to access constructor: " - + metaDescriptorClassName - + ": " - + ExceptionHelper.getLocalizedMessage(se)); - } catch (ClassCastException cce) { - throw new CpoException( - "Class is not instance of CpoMetaDescriptor: " - + metaDescriptorClassName - + ":" - + ExceptionHelper.getLocalizedMessage(cce)); } + } catch (Exception e) { + throw new CpoException(e); } return metaDescriptor; @@ -376,7 +363,7 @@ protected MetaXmlObjectExporter getMetaXmlObjectExporter() { return new CoreMetaXmlObjectExporter(this); } - protected final CpoMetaDataDocument export() { + protected final CtCpoMetaData buildCpoMetaData() { MetaXmlObjectExporter metaXmlObjectExporter = getMetaXmlObjectExporter(); // need these sorted @@ -386,33 +373,48 @@ protected final CpoMetaDataDocument export() { for (CpoClass cpoClass : classList) { cpoClass.acceptMetaDFVisitor(metaXmlObjectExporter); } - return metaXmlObjectExporter.getCpoMetaDataDocument(); + return metaXmlObjectExporter.getCpoMetaData(); + } + + private JAXBElement getJaxbElement(CtCpoMetaData ctCpoMetaData) { + ObjectFactory factory = new ObjectFactory(); + return factory.createCpoMetaData(ctCpoMetaData); + } + + private Marshaller createMarshaller() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(CtCpoMetaData.class); + Marshaller marshaller = jaxbContext.createMarshaller(); + XmlHelper.setMarshallerProperties(marshaller); + return marshaller; } public final void export(File file) throws CpoException { try { - CpoMetaDataDocument doc = export(); - doc.save(file, XmlBeansHelper.getXmlOptions()); - } catch (IOException ex) { - throw new CpoException(ex.getMessage(), ex); + CtCpoMetaData ctCpoMetaData = buildCpoMetaData(); + Marshaller marshaller = createMarshaller(); + marshaller.marshal(getJaxbElement(ctCpoMetaData), file); + } catch (Exception ex) { + throw new CpoException(ex); } } public final void export(Writer writer) throws CpoException { try { - CpoMetaDataDocument doc = export(); - doc.save(writer, XmlBeansHelper.getXmlOptions()); - } catch (IOException ex) { - throw new CpoException(ex.getMessage(), ex); + CtCpoMetaData ctCpoMetaData = buildCpoMetaData(); + Marshaller marshaller = createMarshaller(); + marshaller.marshal(getJaxbElement(ctCpoMetaData), writer); + } catch (Exception ex) { + throw new CpoException(ex); } } public final void export(OutputStream outputStream) throws CpoException { try { - CpoMetaDataDocument doc = export(); - doc.save(outputStream, XmlBeansHelper.getXmlOptions()); - } catch (IOException ex) { - throw new CpoException(ex.getMessage(), ex); + CtCpoMetaData ctCpoMetaData = buildCpoMetaData(); + Marshaller marshaller = createMarshaller(); + marshaller.marshal(getJaxbElement(ctCpoMetaData), outputStream); + } catch (Exception ex) { + throw new CpoException(ex); } } diff --git a/cpo-core/src/main/resources/xsd/CpoConfig.xsd b/cpo-core/src/main/resources/xsd/CpoConfig.xsd new file mode 100644 index 000000000..f90710898 --- /dev/null +++ b/cpo-core/src/main/resources/xsd/CpoConfig.xsd @@ -0,0 +1,586 @@ + + + + + + + + + + + + + + + Specifies the name of the default configuration. If the default config does not exist, the first config in the file will be used. + + + + + + + + + The Descriptor for the metadata to load up for the class + + + + + This is the classname of a class that implements CpoConfigProcessor (ie, JdbcConfigProcessor, or CassandraConfigProcessor). The actual classname will be provided in the .xsd that defines the concrete config. + + + + + + This is the context name to be used when requesting a CpoAdapter. The context name will be used to look up this config info and create the appropriate CpoAdapter + + + + + The batchSize that cpo will use when sending data to the datasource + + + + + The fetchsize that the Streams will use when fetching data from the datasource. The datasource may require additional configuration to not fetch all the data at once. + + + + + + + + + A list containing resource or filenames that contain meta information. If this descriptor was already defined in a previous config, then only the name needs to be supplied so that is can find the previously loaded files. + + + + + + This is the descriptor name that will be used to identify this metadata from within CPO. Only one meta descriptor can have this name. Last in wins. + + + + + This tells CPO whether to treat dataNames as caseSensitive or to ignore case. Default is caseSensitive=true + + + + + + + + + + + + + + + + + + + + + + + + + + + The jndi name of the datasource to use to connect to the target database + + + + + + + The classname for the DataSource provided by the database vendor. + Use a ConnectionPoolDataSource class if available or a DataSource class if not use a DataSource class. + ie: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource + oracle.jdbc.pool.OracleConnectionPoolDataSource + org.hsqldb.jdbc.JDBCDataSource + + + + + + Deprecated. Use dataSourceClassName. The classname for the jdbc driver provided by the database vendor. + ie: oracle.jdbc.driver.OracleDriver + com.mysql.jdbc.Driver + org.hsqldb.jdbcDriver + + + + + + + This is the url to the jdbc database. + + + + + + + This is the user to log into the data source. If the user is supplied in the url, this element should not be included. + + + + + This is the password to log into the data source. If the password is supplied in the url, this element should not be included. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is the keyspace in the cluster that this config is pointing at. + + + + + + + Adds a contact point aka the address of the node to connect to. Contact points are addresses of Cassandra nodes that the driver uses to discover the cluster topology. + Only one contact point is required (the driver will retrieve the address of the other nodes automatically), + but it is usually a good idea to provide more than one contact point, because if that single contact point is unavailable, + the driver cannot initialize itself correctly. + + + + + + + An optional name for the create cluster. Defaults to the name of the core:dataConfig + Note: this is not related to the Cassandra cluster name (though you are free to provide the same name). See Cluster.getClusterName() for details. + If you use this method and create more than one Cluster instance in the same JVM (which should be avoided unless you need to connect to multiple Cassandra clusters), + you should make sure each Cluster instance get a unique name or you may have a problem with JMX reporting. + + + + + + + Sets the maximum time to wait for schema agreement before returning from a DDL query. + + + + + + + The port to use to connect to the Cassandra host. If not set through this method, the default port (9042) will be used instead. + + + + + + + Configures the load balancing policy to use for the new cluster. + Add in the fully qualified class name for a LoadBalancingPolicyFactory + If no load balancing policy is set through this method, Policies.defaultLoadBalancingPolicy() will be used instead. + + + + + + + Configures the reconnection policy to use for the new cluster. + Add in the fully qualified class name for a ReconnectionPolicyFactory + If no reconnection policy is set through this method, Policies.DEFAULT_RECONNECTION_POLICY will be used instead. + + + + + + + Configures the retry policy to use for the new cluster. + Add in the fully qualified class name for a RetryPolicyFactory + If no retry policy is set through this method, Policies.DEFAULT_RETRY_POLICY will be used instead. + + + + + + + + Uses the provided credentials when connecting to Cassandra hosts. + This should be used if the Cassandra cluster has been configured to use the PasswordAuthenticator. + If the the default AllowAllAuthenticator is used instead, using this method has no effect. + + + + + + + Use the specified AuthProvider when connecting to Cassandra hosts. + Add in the fully qualified class name for a AuthProviderFactory + Use this method when a custom authentication scheme is in place. You shouldn't call both this method and withCredentials + on the same Builder instance as one will supercede the other + + + + + + + + Sets the compression to use for the transport. + + + + + + + The native protocol version to use. + + + + + + + Disables metrics collection for the created cluster (metrics are enabled by default otherwise). + + + + + + + Enables the use of SSL for the created Cluster. The string is either nil which uses the default ssl or the full class path of a SSLOptionsFactory. + Calling this method will use default SSL options (see SSLOptions.SSLOptions()). This is thus a shortcut for withSSL(new SSLOptions()). + Note that if SSL is enabled, the driver will not connect to any Cassandra nodes that doesn't have SSL enabled and it is strongly advised to + enable SSL on every Cassandra node if you plan on using SSL in the driver. + + + + + + + Register the provided listeners in the newly created cluster. + Add in the fully qualified class name for a ListenerFactory + Note: repeated calls to this method will override the previous ones. + + + + + + + Disables JMX reporting of the metrics. + JMX reporting is enabled by default (see Metrics) but can be disabled using this option. If metrics are disabled, this is a no-op. + + + + + + + Options related to connection pooling. + The driver uses connections in an asynchronous manner, meaning that multiple requests can be submitted + on the same connection at the same time. Therefore only a relatively small number of connections is needed. + For each host, the driver uses a connection pool that may have a variable size (it will automatically adjust to the current load). + + With ProtocolVersion#V2 or below, there are at most 128 simultaneous requests per connection, so the pool defaults to a variable size. + You will typically raise the maximum capacity by adding more connections with setMaxRequestsPerConnection(HostDistance, int). + + With ProtocolVersion#V3 or above, there are up to 32768 requests per connection, and the pool defaults to a fixed size of 1. + You will typically raise the maximum capacity by allowing more simultaneous requests per connection + (setMaxRequestsPerConnection(HostDistance, int)). + + All parameters can be separately set for LOCAL and REMOTE hosts (HostDistance). For IGNORED hosts, no connections are created so + these settings cannot be changed. + + + + + + + Sets the SocketOptions to use for the newly created Cluster. + If no socket options are set through this method, default socket options will be used. + + + + + + + Sets the QueryOptions to use for the newly created Cluster. + If no query options are set through this method, default query options will be used. + + + + + + + Configures the address translater to use for the new cluster. + The string is full class path of a AddressTranslaterFactory. + + + + + + + Set the NettyOptions to use for the newly created Cluster. + The string is full class path of a NettyOptionsFactory. + + + + + + + Configures the speculative execution policy to use for the new cluster. + The string is full class path of a SpeculativeExecutionPolicyFactory. + + + + + + + Configures the generator that will produce the client-side timestamp sent with each query. + The string is full class path of a TimestampGeneratorFactory. + + + + + + + + + + + This is the user to log into the data source. If the user is supplied in the url, this element should not be included. + + + + + This is the password to log into the data source. If the password is supplied in the url, this element should not be included. + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sets the core and maximum number of connections per host in one call. + + + + + Sets the core number of connections per host. + + + + + Sets the heart beat interval, after which a message is sent on an idle connection to make sure it's still alive. + + + + + Sets the timeout before an idle connection is removed. + + + + + Sets the maximum number of connections per host. + + + + + Sets the maximum number of requests per connection. + + + + + Sets the threshold that triggers the creation of a new connection to a host. + + + + + Sets the timeout when trying to acquire a connection from a host's pool. + + + + + + + + + + The HostDistance for which to set these threshold. + + + + + the core number of connections. + + + + + the max number of connections. + + + + + + + + + + The HostDistance for which to set these threshold. + + + + + the new threshold. + + + + + + + + + + + + + + + + + + + Sets the default consistency level to use for queries. + + + + + Sets the default idempotence for queries. + + + + + Sets the default fetch size to use for SELECT queries. + + + + + Sets the default serial consistency level to use for queries. + + + + + + + + + + + + + + + + + + + + + + + + + + + Sets the connection timeout in milliseconds. + + + + + Sets whether to enable TCP keepalive. + + + + + Sets the per-host read timeout in milliseconds. + + + + + Sets a hint to the size of the underlying buffers for incoming network I/O. + + + + + Sets whether to enable reuse-address. + + + + + Sets a hint to the size of the underlying buffers for outgoing network I/O. + + + + + Sets the linger-on-close timeout. + + + + + Sets whether to disable Nagle's algorithm. + + + + + + \ No newline at end of file diff --git a/cpo-core/src/main/xsd/CpoCoreMeta.xsd b/cpo-core/src/main/resources/xsd/CpoMeta.xsd similarity index 50% rename from cpo-core/src/main/xsd/CpoCoreMeta.xsd rename to cpo-core/src/main/resources/xsd/CpoMeta.xsd index 799bb2389..fd7f9d425 100644 --- a/cpo-core/src/main/xsd/CpoCoreMeta.xsd +++ b/cpo-core/src/main/resources/xsd/CpoMeta.xsd @@ -1,7 +1,7 @@ @@ -15,10 +15,10 @@ - + - + @@ -46,7 +46,9 @@ - + + + @@ -60,17 +62,80 @@ - + - - - + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cpo-core/src/main/xsd/CpoUtilConfig.xsd b/cpo-core/src/main/resources/xsd/CpoUtilConfig.xsd similarity index 87% rename from cpo-core/src/main/xsd/CpoUtilConfig.xsd rename to cpo-core/src/main/resources/xsd/CpoUtilConfig.xsd index 1d5d44d82..7e47720b8 100644 --- a/cpo-core/src/main/xsd/CpoUtilConfig.xsd +++ b/cpo-core/src/main/resources/xsd/CpoUtilConfig.xsd @@ -1,11 +1,11 @@ - + diff --git a/cpo-core/src/main/xsd/CpoCassandraConfig.xsd b/cpo-core/src/main/xsd/CpoCassandraConfig.xsd deleted file mode 100644 index f6eb1206a..000000000 --- a/cpo-core/src/main/xsd/CpoCassandraConfig.xsd +++ /dev/null @@ -1,446 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - This is the keyspace in the cluster that this config is pointing at. - - - - - - - Adds a contact point aka the address of the node to connect to. Contact points are addresses of Cassandra nodes that the driver uses to discover the cluster topology. - Only one contact point is required (the driver will retrieve the address of the other nodes automatically), - but it is usually a good idea to provide more than one contact point, because if that single contact point is unavailable, - the driver cannot initialize itself correctly. - - - - - - - An optional name for the create cluster. Defaults to the name of the core:dataConfig - Note: this is not related to the Cassandra cluster name (though you are free to provide the same name). See Cluster.getClusterName() for details. - If you use this method and create more than one Cluster instance in the same JVM (which should be avoided unless you need to connect to multiple Cassandra clusters), - you should make sure each Cluster instance get a unique name or you may have a problem with JMX reporting. - - - - - - - Sets the maximum time to wait for schema agreement before returning from a DDL query. - - - - - - - The port to use to connect to the Cassandra host. If not set through this method, the default port (9042) will be used instead. - - - - - - - Configures the load balancing policy to use for the new cluster. - Add in the fully qualified class name for a LoadBalancingPolicyFactory - If no load balancing policy is set through this method, Policies.defaultLoadBalancingPolicy() will be used instead. - - - - - - - Configures the reconnection policy to use for the new cluster. - Add in the fully qualified class name for a ReconnectionPolicyFactory - If no reconnection policy is set through this method, Policies.DEFAULT_RECONNECTION_POLICY will be used instead. - - - - - - - Configures the retry policy to use for the new cluster. - Add in the fully qualified class name for a RetryPolicyFactory - If no retry policy is set through this method, Policies.DEFAULT_RETRY_POLICY will be used instead. - - - - - - - - Uses the provided credentials when connecting to Cassandra hosts. - This should be used if the Cassandra cluster has been configured to use the PasswordAuthenticator. - If the the default AllowAllAuthenticator is used instead, using this method has no effect. - - - - - - - Use the specified AuthProvider when connecting to Cassandra hosts. - Add in the fully qualified class name for a AuthProviderFactory - Use this method when a custom authentication scheme is in place. You shouldn't call both this method and withCredentials - on the same Builder instance as one will supercede the other - - - - - - - - Sets the compression to use for the transport. - - - - - - - The native protocol version to use. - - - - - - - Disables metrics collection for the created cluster (metrics are enabled by default otherwise). - - - - - - - Enables the use of SSL for the created Cluster. The string is either nil which uses the default ssl or the full class path of a SSLOptionsFactory. - Calling this method will use default SSL options (see SSLOptions.SSLOptions()). This is thus a shortcut for withSSL(new SSLOptions()). - Note that if SSL is enabled, the driver will not connect to any Cassandra nodes that doesn't have SSL enabled and it is strongly advised to - enable SSL on every Cassandra node if you plan on using SSL in the driver. - - - - - - - Register the provided listeners in the newly created cluster. - Add in the fully qualified class name for a ListenerFactory - Note: repeated calls to this method will override the previous ones. - - - - - - - Disables JMX reporting of the metrics. - JMX reporting is enabled by default (see Metrics) but can be disabled using this option. If metrics are disabled, this is a no-op. - - - - - - - Options related to connection pooling. - The driver uses connections in an asynchronous manner, meaning that multiple requests can be submitted - on the same connection at the same time. Therefore only a relatively small number of connections is needed. - For each host, the driver uses a connection pool that may have a variable size (it will automatically adjust to the current load). - - With ProtocolVersion#V2 or below, there are at most 128 simultaneous requests per connection, so the pool defaults to a variable size. - You will typically raise the maximum capacity by adding more connections with setMaxRequestsPerConnection(HostDistance, int). - - With ProtocolVersion#V3 or above, there are up to 32768 requests per connection, and the pool defaults to a fixed size of 1. - You will typically raise the maximum capacity by allowing more simultaneous requests per connection - (setMaxRequestsPerConnection(HostDistance, int)). - - All parameters can be separately set for LOCAL and REMOTE hosts (HostDistance). For IGNORED hosts, no connections are created so - these settings cannot be changed. - - - - - - - Sets the SocketOptions to use for the newly created Cluster. - If no socket options are set through this method, default socket options will be used. - - - - - - - Sets the QueryOptions to use for the newly created Cluster. - If no query options are set through this method, default query options will be used. - - - - - - - Configures the address translater to use for the new cluster. - The string is full class path of a AddressTranslaterFactory. - - - - - - - Set the NettyOptions to use for the newly created Cluster. - The string is full class path of a NettyOptionsFactory. - - - - - - - Configures the speculative execution policy to use for the new cluster. - The string is full class path of a SpeculativeExecutionPolicyFactory. - - - - - - - Configures the generator that will produce the client-side timestamp sent with each query. - The string is full class path of a TimestampGeneratorFactory. - - - - - - - - - - - This is the user to log into the data source. If the user is supplied in the url, this element should not be included. - - - - - This is the password to log into the data source. If the password is supplied in the url, this element should not be included. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Sets the core and maximum number of connections per host in one call. - - - - - Sets the core number of connections per host. - - - - - Sets the heart beat interval, after which a message is sent on an idle connection to make sure it's still alive. - - - - - Sets the timeout before an idle connection is removed. - - - - - Sets the maximum number of connections per host. - - - - - Sets the maximum number of requests per connection. - - - - - Sets the threshold that triggers the creation of a new connection to a host. - - - - - Sets the timeout when trying to acquire a connection from a host's pool. - - - - - - - - - - The HostDistance for which to set these threshold. - - - - - the core number of connections. - - - - - the max number of connections. - - - - - - - - - - The HostDistance for which to set these threshold. - - - - - the new threshold. - - - - - - - - - - - - - - - - - - - Sets the default consistency level to use for queries. - - - - - Sets the default idempotence for queries. - - - - - Sets the default fetch size to use for SELECT queries. - - - - - Sets the default serial consistency level to use for queries. - - - - - - - - - - - - - - - - - - - - - - - - - - - Sets the connection timeout in milliseconds. - - - - - Sets whether to enable TCP keepalive. - - - - - Sets the per-host read timeout in milliseconds. - - - - - Sets a hint to the size of the underlying buffers for incoming network I/O. - - - - - Sets whether to enable reuse-address. - - - - - Sets a hint to the size of the underlying buffers for outgoing network I/O. - - - - - Sets the linger-on-close timeout. - - - - - Sets whether to disable Nagle's algorithm. - - - - - - - - \ No newline at end of file diff --git a/cpo-core/src/main/xsd/CpoCassandraMeta.xsd b/cpo-core/src/main/xsd/CpoCassandraMeta.xsd deleted file mode 100644 index c4f4d7f7e..000000000 --- a/cpo-core/src/main/xsd/CpoCassandraMeta.xsd +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/cpo-core/src/main/xsd/CpoConfig.xsd b/cpo-core/src/main/xsd/CpoConfig.xsd deleted file mode 100644 index dbe2fa16d..000000000 --- a/cpo-core/src/main/xsd/CpoConfig.xsd +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/cpo-core/src/main/xsd/CpoCoreConfig.xsd b/cpo-core/src/main/xsd/CpoCoreConfig.xsd deleted file mode 100644 index 5f567f963..000000000 --- a/cpo-core/src/main/xsd/CpoCoreConfig.xsd +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - Specifies the name of the default configuration. If the default config does not exist, the first config in the file will be used. - - - - - - - - - The Descriptor for the metadata to load up for the class - - - - - This is the classname of a class that implements CpoConfigProcessor (ie, JdbcConfigProcessor, or CassandraConfigProcessor). The actual classname will be provided in the .xsd that defines the concrete config. - - - - - - This is the context name to be used when requesting a CpoAdapter. The context name will be used to look up this config info and create the appropriate CpoAdapter - - - - - The batchSize that cpo will use when sending data to the datasource - - - - - The fetchsize that the Streams will use when fetching data from the datasource. The datasource may require additional configuration to not fetch all the data at once. - - - - - - - - - A list containing resource or filenames that contain meta information. If this descriptor was already defined in a previous config, then only the name needs to be supplied so that is can find the previously loaded files. - - - - - - This is the descriptor name that will be used to identify this metadata from within CPO. Only one meta descriptor can have this name. Last in wins. - - - - - This tells CPO whether to treat dataNames as caseSensitive or to ignore case. Default is caseSensitive=true - - - - - \ No newline at end of file diff --git a/cpo-core/src/main/xsd/CpoJdbcConfig.xsd b/cpo-core/src/main/xsd/CpoJdbcConfig.xsd deleted file mode 100644 index a1d9c1c76..000000000 --- a/cpo-core/src/main/xsd/CpoJdbcConfig.xsd +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - The jndi name of the datasource to use to connect to the target database - - - - - - - The classname for the DataSource provided by the database vendor. - Use a ConnectionPoolDataSource class if available or a DataSource class if not use a DataSource class. - ie: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource - oracle.jdbc.pool.OracleConnectionPoolDataSource - org.hsqldb.jdbc.JDBCDataSource - - - - - - Deprecated. Use dataSourceClassName. The classname for the jdbc driver provided by the database vendor. - ie: oracle.jdbc.driver.OracleDriver - com.mysql.jdbc.Driver - org.hsqldb.jdbcDriver - - - - - - - This is the url to the jdbc database. - - - - - - - This is the user to log into the data source. If the user is supplied in the url, this element should not be included. - - - - - This is the password to log into the data source. If the password is supplied in the url, this element should not be included. - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/cpo-core/src/main/xsd/CpoJdbcMeta.xsd b/cpo-core/src/main/xsd/CpoJdbcMeta.xsd deleted file mode 100644 index 6e230c6e2..000000000 --- a/cpo-core/src/main/xsd/CpoJdbcMeta.xsd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/cpo-core/src/test/java/org/synchronoss/cpo/xml/XmlTest.java b/cpo-core/src/test/java/org/synchronoss/cpo/xml/XmlTest.java new file mode 100644 index 000000000..0c24e3b8d --- /dev/null +++ b/cpo-core/src/test/java/org/synchronoss/cpo/xml/XmlTest.java @@ -0,0 +1,45 @@ +package org.synchronoss.cpo.xml; + +/*- + * [[ + * core + * == + * Copyright (C) 2003 - 2025 David E. Berry + * == + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * . + * ]] + */ + +import org.synchronoss.cpo.CpoException; +import org.synchronoss.cpo.cpometa.CtCpoMetaData; +import org.synchronoss.cpo.helper.XmlHelper; +import org.testng.Assert; +import org.testng.annotations.Test; + +public class XmlTest { + + @Test + public void testCpoMetaDataXml() throws CpoException { + var errBuilder = new StringBuilder(); + var metaXml = "testCoreMeta.xml"; + + CtCpoMetaData ctCpoMeta = + XmlHelper.unmarshalXmlObject( + XmlHelper.CPO_META_XSD, metaXml, CtCpoMetaData.class, errBuilder); + Assert.assertTrue( + errBuilder.isEmpty(), + "Should not have received an error message: " + errBuilder.toString()); + } +} diff --git a/cpo-core/src/test/resources/testCoreMeta.xml b/cpo-core/src/test/resources/testCoreMeta.xml new file mode 100644 index 000000000..641aca8f5 --- /dev/null +++ b/cpo-core/src/test/resources/testCoreMeta.xml @@ -0,0 +1,102 @@ + + + + + + bLob + byte[] + B_LOB + LONGVARBINARY + org.synchronoss.cpo.transform.jdbc.TransformGZipBytes + + + bLob2 + byte[] + B_LOB2 + LONGVARBINARY + + + lobId + int + LOB_ID + INTEGER + + + cLob + char[] + C_LOB + LONGVARCHAR + org.synchronoss.cpo.transform.jdbc.TransformStringChar + + + + delete from lob_test where lob_id = ? + + lobId + + + + + + insert into lob_test (lob_id, b_lob, c_lob, b_lob2) values (?,?,?,?) + + lobId + + + bLob + + + cLob + + + bLob2 + + + + + + update lob_test set b_lob=?, c_lob=?, b_lob2=? where lob_id = ? + + bLob + + + cLob + + + bLob2 + + + lobId + + + + + + select * from lob_test where lob_id = ? + + lobId + + + + + diff --git a/cpo-jdbc/pom.xml b/cpo-jdbc/pom.xml index eee6f8b4a..359452c82 100644 --- a/cpo-jdbc/pom.xml +++ b/cpo-jdbc/pom.xml @@ -248,11 +248,6 @@ org.slf4j slf4j-api - - - org.apache.logging.log4j - log4j-to-slf4j - ch.qos.logback @@ -266,11 +261,15 @@ ${logbackVersion} test - - org.apache.xmlbeans - xmlbeans - - + + jakarta.xml.bind + jakarta.xml.bind-api + + + org.glassfish.jaxb + jaxb-runtime + runtime + diff --git a/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/config/JdbcCpoConfigProcessor.java b/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/config/JdbcCpoConfigProcessor.java index 169b001f7..de120dd73 100644 --- a/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/config/JdbcCpoConfigProcessor.java +++ b/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/config/JdbcCpoConfigProcessor.java @@ -31,11 +31,11 @@ import org.synchronoss.cpo.CpoException; import org.synchronoss.cpo.DataSourceInfo; import org.synchronoss.cpo.config.CpoConfigProcessor; -import org.synchronoss.cpo.core.cpoCoreConfig.CtDataSourceConfig; +import org.synchronoss.cpo.cpoconfig.CtDataSourceConfig; +import org.synchronoss.cpo.cpoconfig.CtJdbcConfig; +import org.synchronoss.cpo.cpoconfig.CtJdbcReadWriteConfig; +import org.synchronoss.cpo.cpoconfig.CtProperty; import org.synchronoss.cpo.jdbc.*; -import org.synchronoss.cpo.jdbc.cpoJdbcConfig.CtJdbcConfig; -import org.synchronoss.cpo.jdbc.cpoJdbcConfig.CtJdbcReadWriteConfig; -import org.synchronoss.cpo.jdbc.cpoJdbcConfig.CtProperty; import org.synchronoss.cpo.jdbc.meta.JdbcCpoMetaDescriptor; import org.synchronoss.cpo.meta.CpoMetaDescriptor; @@ -73,7 +73,7 @@ public CpoAdapterFactory processCpoConfig(CtDataSourceConfig cpoConfig) throws C int batchSize = jdbcConfig.getBatchSize().intValue(); // build a datasource info - if (jdbcConfig.isSetReadWriteConfig()) { + if (jdbcConfig.getReadWriteConfig() != null) { DataSourceInfo dataSourceInfo = buildDataSourceInfo(jdbcConfig.getReadWriteConfig(), fetchSize, batchSize); cpoAdapterFactory = @@ -95,26 +95,26 @@ private DataSourceInfo buildDataSourceInfo( CtJdbcReadWriteConfig readWriteConfig, int fetchSize, int batchSize) throws CpoException { DataSourceInfo dataSourceInfo = null; - if (readWriteConfig.isSetJndiName()) { + if (readWriteConfig.getJndiName() != null) { dataSourceInfo = new JndiJdbcDataSourceInfo(readWriteConfig.getJndiName(), fetchSize, batchSize); - } else if (readWriteConfig.isSetDataSourceClassName()) { + } else if (readWriteConfig.getDataSourceClassName() != null) { SortedMap props = new TreeMap<>(); - if (readWriteConfig.isSetUrl()) { + if (readWriteConfig.getUrl() != null) { props.put(PROP_URL1, readWriteConfig.getUrl()); props.put(PROP_URL2, readWriteConfig.getUrl()); } - if (readWriteConfig.isSetUser()) { + if (readWriteConfig.getUser() != null) { props.put(PROP_USER, readWriteConfig.getUser()); } - if (readWriteConfig.isSetPassword()) { + if (readWriteConfig.getPassword() != null) { props.put(PROP_PASSWORD, readWriteConfig.getPassword()); } - for (CtProperty property : readWriteConfig.getPropertyArray()) { + for (CtProperty property : readWriteConfig.getProperty()) { props.put(property.getName(), property.getValue()); logger.debug("Adding property " + property.getName() + "=" + property.getValue()); } @@ -122,8 +122,8 @@ private DataSourceInfo buildDataSourceInfo( dataSourceInfo = new ClassJdbcDataSourceInfo( readWriteConfig.getDataSourceClassName(), props, fetchSize, batchSize); - } else if (readWriteConfig.isSetDriverClassName()) { - if (readWriteConfig.isSetUser()) { + } else if (readWriteConfig.getDriverClassName() != null) { + if (readWriteConfig.getUser() != null) { dataSourceInfo = new DriverJdbcDataSourceInfo( readWriteConfig.getDriverClassName(), @@ -132,9 +132,9 @@ private DataSourceInfo buildDataSourceInfo( readWriteConfig.getPassword(), fetchSize, batchSize); - } else if (readWriteConfig.getPropertyArray().length > 0) { + } else if (!readWriteConfig.getProperty().isEmpty()) { Properties props = new Properties(); - for (CtProperty property : readWriteConfig.getPropertyArray()) { + for (CtProperty property : readWriteConfig.getProperty()) { props.put(property.getName(), property.getValue()); } dataSourceInfo = diff --git a/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/exporter/JdbcMetaXmlObjectExporter.java b/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/exporter/JdbcMetaXmlObjectExporter.java index 575237789..0838c0b0a 100644 --- a/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/exporter/JdbcMetaXmlObjectExporter.java +++ b/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/exporter/JdbcMetaXmlObjectExporter.java @@ -22,14 +22,14 @@ * ]] */ -import org.synchronoss.cpo.core.cpoCoreMeta.CtArgument; -import org.synchronoss.cpo.core.cpoCoreMeta.CtAttribute; +import org.synchronoss.cpo.cpometa.CtJdbcArgument; +import org.synchronoss.cpo.cpometa.CtJdbcAttribute; +import org.synchronoss.cpo.cpometa.ObjectFactory; +import org.synchronoss.cpo.cpometa.StArgumentScope; import org.synchronoss.cpo.exporter.CoreMetaXmlObjectExporter; import org.synchronoss.cpo.exporter.MetaXmlObjectExporter; import org.synchronoss.cpo.jdbc.JdbcCpoArgument; import org.synchronoss.cpo.jdbc.JdbcCpoAttribute; -import org.synchronoss.cpo.jdbc.cpoJdbcMeta.CtJdbcArgument; -import org.synchronoss.cpo.jdbc.cpoJdbcMeta.CtJdbcAttribute; import org.synchronoss.cpo.meta.CpoMetaDescriptor; import org.synchronoss.cpo.meta.domain.CpoArgument; import org.synchronoss.cpo.meta.domain.CpoAttribute; @@ -43,6 +43,8 @@ public class JdbcMetaXmlObjectExporter extends CoreMetaXmlObjectExporter implements MetaXmlObjectExporter { + protected ObjectFactory objectFactory = new ObjectFactory(); + /** * Constructs a JdbcMetaXmlObjectExporter object. * @@ -67,7 +69,10 @@ public void visit(CpoAttribute cpoAttribute) { // CtClass.addNewCpoAttribute() can't be used here because it returns a CtAttribute, not a // CtJdbcAttribute - CtJdbcAttribute ctJdbcAttribute = CtJdbcAttribute.Factory.newInstance(); + CtJdbcAttribute ctJdbcAttribute = new CtJdbcAttribute(); + var jaxbElement = objectFactory.createJdbcAttribute(ctJdbcAttribute); + // add it to the class + currentCtClass.getCpoAttribute().add(jaxbElement); ctJdbcAttribute.setJavaName(jdbcAttribute.getJavaName()); ctJdbcAttribute.setJavaType(jdbcAttribute.getJavaType()); @@ -75,25 +80,21 @@ public void visit(CpoAttribute cpoAttribute) { ctJdbcAttribute.setDataType(jdbcAttribute.getDataType()); if (jdbcAttribute.getTransformClassName() != null - && jdbcAttribute.getTransformClassName().length() > 0) { + && !jdbcAttribute.getTransformClassName().isEmpty()) { ctJdbcAttribute.setTransformClass(jdbcAttribute.getTransformClassName()); } - if (jdbcAttribute.getDescription() != null && jdbcAttribute.getDescription().length() > 0) { + if (jdbcAttribute.getDescription() != null && !jdbcAttribute.getDescription().isEmpty()) { ctJdbcAttribute.setDescription(jdbcAttribute.getDescription()); } - if (jdbcAttribute.getDbTable() != null && jdbcAttribute.getDbTable().length() > 0) { + if (jdbcAttribute.getDbTable() != null && !jdbcAttribute.getDbTable().isEmpty()) { ctJdbcAttribute.setDbTable(jdbcAttribute.getDbTable()); } - if (jdbcAttribute.getDbColumn() != null && jdbcAttribute.getDbColumn().length() > 0) { + if (jdbcAttribute.getDbColumn() != null && !jdbcAttribute.getDbColumn().isEmpty()) { ctJdbcAttribute.setDbColumn(jdbcAttribute.getDbColumn()); } - - // add it to the class - CtAttribute ctAttribute = currentCtClass.addNewCpoAttribute(); - ctAttribute.set(ctJdbcAttribute); } } @@ -112,28 +113,27 @@ public void visit(CpoArgument cpoArgument) { // CtFunction.addNewCpoArgument() can't be used here because it returns a CtArgument, not a // CtJdbcArgument - CtJdbcArgument ctJdbcArgument = CtJdbcArgument.Factory.newInstance(); + CtJdbcArgument ctJdbcArgument = new CtJdbcArgument(); + var jaxbElement = objectFactory.createJdbcArgument(ctJdbcArgument); + currentCtFunction.getCpoArgument().add(jaxbElement); ctJdbcArgument.setAttributeName(jdbcArgument.getName()); - if (jdbcArgument.getDescription() != null && jdbcArgument.getDescription().length() > 0) { + if (jdbcArgument.getDescription() != null && !jdbcArgument.getDescription().isEmpty()) { ctJdbcArgument.setDescription(jdbcArgument.getDescription()); } if (jdbcArgument.isInParameter() && jdbcArgument.isOutParameter()) { - ctJdbcArgument.setScope(CtJdbcArgument.Scope.BOTH); + ctJdbcArgument.setScope(StArgumentScope.BOTH); } else if (jdbcArgument.isInParameter()) { - ctJdbcArgument.setScope(CtJdbcArgument.Scope.IN); + ctJdbcArgument.setScope(StArgumentScope.IN); } else if (jdbcArgument.isOutParameter()) { - ctJdbcArgument.setScope(CtJdbcArgument.Scope.OUT); + ctJdbcArgument.setScope(StArgumentScope.OUT); } if (jdbcArgument.getTypeInfo() != null && !jdbcArgument.getTypeInfo().isEmpty()) { ctJdbcArgument.setTypeInfo(jdbcArgument.getTypeInfo()); } - - CtArgument ctArgument = currentCtFunction.addNewCpoArgument(); - ctArgument.set(ctJdbcArgument); } } } diff --git a/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/meta/JdbcCpoMetaAdapter.java b/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/meta/JdbcCpoMetaAdapter.java index ed6eec289..b9537e61a 100644 --- a/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/meta/JdbcCpoMetaAdapter.java +++ b/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/meta/JdbcCpoMetaAdapter.java @@ -26,12 +26,12 @@ import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.synchronoss.cpo.core.cpoCoreMeta.CtArgument; -import org.synchronoss.cpo.core.cpoCoreMeta.CtAttribute; +import org.synchronoss.cpo.cpometa.CtArgument; +import org.synchronoss.cpo.cpometa.CtAttribute; +import org.synchronoss.cpo.cpometa.CtJdbcArgument; +import org.synchronoss.cpo.cpometa.CtJdbcAttribute; import org.synchronoss.cpo.jdbc.JdbcCpoArgument; import org.synchronoss.cpo.jdbc.JdbcCpoAttribute; -import org.synchronoss.cpo.jdbc.cpoJdbcMeta.CtJdbcArgument; -import org.synchronoss.cpo.jdbc.cpoJdbcMeta.CtJdbcAttribute; import org.synchronoss.cpo.meta.AbstractCpoMetaAdapter; import org.synchronoss.cpo.meta.DataTypeMapEntry; import org.synchronoss.cpo.meta.DataTypeMapper; diff --git a/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/adapter/HotDeployTest.java b/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/adapter/HotDeployTest.java index 0164ceaf1..94b812496 100644 --- a/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/adapter/HotDeployTest.java +++ b/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/adapter/HotDeployTest.java @@ -67,8 +67,10 @@ public void setUp() { try { cpoAdapter = CpoAdapterFactoryManager.getCpoAdapter(JdbcStatics.ADAPTER_CONTEXT_JDBC); assertNotNull(cpoAdapter, method + "cpoAdapter is null"); + var metaDescriptor = cpoAdapter.getCpoMetaDescriptor(); + assertNotNull(metaDescriptor, method + "metaDescriptor is null"); // lets save the existing config before we monkey with it - cpoAdapter.getCpoMetaDescriptor().export(metaFile); + metaDescriptor.export(metaFile); } catch (Exception e) { fail(method + e.getMessage()); } diff --git a/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/adapter/XmlValidationTest.java b/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/adapter/XmlValidationTest.java index 16529d347..50a7c5981 100644 --- a/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/adapter/XmlValidationTest.java +++ b/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/adapter/XmlValidationTest.java @@ -22,16 +22,9 @@ * ]] */ -import static org.testng.Assert.fail; - -import java.io.IOException; -import java.io.InputStream; -import org.apache.xmlbeans.XmlException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.synchronoss.cpo.core.cpoCoreConfig.CpoConfigDocument; -import org.synchronoss.cpo.helper.CpoClassLoader; -import org.synchronoss.cpo.helper.XmlBeansHelper; +import org.synchronoss.cpo.cpoconfig.CtCpoConfig; +import org.synchronoss.cpo.helper.XmlHelper; +import org.testng.Assert; import org.testng.annotations.Test; /** @@ -39,7 +32,6 @@ */ public class XmlValidationTest { - private static final Logger logger = LoggerFactory.getLogger(XmlValidationTest.class); static final String CPO_CONFIG_XML = "/h2/cpoConfig.xml"; static final String BAD_CPO_CONFIG_XML = "/badConfig.xml"; @@ -47,37 +39,23 @@ public XmlValidationTest() {} @Test public void testBadXml() { - InputStream is = CpoClassLoader.getResourceAsStream(BAD_CPO_CONFIG_XML); + var errBuilder = new StringBuilder(); - try { - CpoConfigDocument configDoc = CpoConfigDocument.Factory.parse(is); - String errMsg = XmlBeansHelper.validateXml(configDoc); - if (errMsg == null) { - fail("Should have received an error message"); - } else { - logger.debug(errMsg); - } - } catch (IOException ioe) { - fail("Could not read config xml"); - } catch (XmlException xe) { - fail("Config xml was not well formed"); - } + CtCpoConfig cpoConfig = + XmlHelper.unmarshalXmlObject( + XmlHelper.CPO_CONFIG_XSD, BAD_CPO_CONFIG_XML, CtCpoConfig.class, errBuilder); + Assert.assertFalse(errBuilder.isEmpty(), "Should have received an error message"); } @Test public void testGoodXml() { - InputStream is = CpoClassLoader.getResourceAsStream(CPO_CONFIG_XML); - - try { - CpoConfigDocument configDoc = CpoConfigDocument.Factory.parse(is); - String errMsg = XmlBeansHelper.validateXml(configDoc); - if (errMsg != null) { - fail("Should have received an error message:" + errMsg); - } - } catch (IOException ioe) { - fail("Could not read config xml"); - } catch (XmlException xe) { - fail("Config xml was not well formed"); - } + var errBuilder = new StringBuilder(); + + CtCpoConfig cpoConfig = + XmlHelper.unmarshalXmlObject( + XmlHelper.CPO_CONFIG_XSD, CPO_CONFIG_XML, CtCpoConfig.class, errBuilder); + Assert.assertTrue( + errBuilder.isEmpty(), + "Should not have received an error message: " + errBuilder.toString()); } } diff --git a/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/exporter/ExporterTest.java b/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/exporter/ExporterTest.java index 8e6f1c3c6..1af48d26d 100644 --- a/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/exporter/ExporterTest.java +++ b/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/exporter/ExporterTest.java @@ -36,8 +36,8 @@ import org.synchronoss.cpo.CpoAdapter; import org.synchronoss.cpo.CpoAdapterFactoryManager; import org.synchronoss.cpo.CpoException; -import org.synchronoss.cpo.core.cpoCoreMeta.CpoMetaDataDocument; -import org.synchronoss.cpo.core.cpoCoreMeta.CtClass; +import org.synchronoss.cpo.cpometa.CtClass; +import org.synchronoss.cpo.cpometa.CtCpoMetaData; import org.synchronoss.cpo.exporter.CpoClassSourceGenerator; import org.synchronoss.cpo.exporter.CpoInterfaceSourceGenerator; import org.synchronoss.cpo.exporter.CpoLegacyClassSourceGenerator; @@ -91,19 +91,19 @@ public void testXmlExport() { for (CpoClass cpoClass : metaDescriptor.getCpoClasses()) { cpoClass.acceptMetaDFVisitor(metaXmlObjectExporter); } - CpoMetaDataDocument doc = metaXmlObjectExporter.getCpoMetaDataDocument(); + CtCpoMetaData ctCpoMetaData = metaXmlObjectExporter.getCpoMetaData(); - // doc better be valid - logger.debug("validating doc"); - assertTrue(doc.validate()); + // ctCpoMetaData better be valid + logger.debug("validating ctCpoMetaData"); + // assertTrue(ctCpoMetaData.validate()); // make sure it saved the data right // should be 3 classes in here - assertEquals(3, doc.getCpoMetaData().getCpoClassArray().length); + assertEquals(3, ctCpoMetaData.getCpoClass().size()); boolean found = false; - for (CtClass ctClass : doc.getCpoMetaData().getCpoClassArray()) { + for (CtClass ctClass : ctCpoMetaData.getCpoClass()) { // validate the ValueObject if (ctClass.getName().equals(ValueObject.class.getName())) { found = true; diff --git a/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/jmeter/CpoJavaSamplerClient.java b/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/jmeter/CpoJavaSamplerClient.java index 0d7ed21e9..550db19ac 100644 --- a/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/jmeter/CpoJavaSamplerClient.java +++ b/cpo-jdbc/src/test/java/org/synchronoss/cpo/jdbc/jmeter/CpoJavaSamplerClient.java @@ -33,10 +33,10 @@ import org.synchronoss.cpo.CpoAdapter; import org.synchronoss.cpo.CpoAdapterFactoryManager; import org.synchronoss.cpo.CpoException; +import org.synchronoss.cpo.cpoconfig.CtJdbcConfig; +import org.synchronoss.cpo.cpoconfig.CtJdbcReadWriteConfig; import org.synchronoss.cpo.jdbc.ValueObject; import org.synchronoss.cpo.jdbc.adapter.ValueObjectFactory; -import org.synchronoss.cpo.jdbc.cpoJdbcConfig.CtJdbcConfig; -import org.synchronoss.cpo.jdbc.cpoJdbcConfig.CtJdbcReadWriteConfig; import org.synchronoss.cpo.jdbc.meta.JdbcCpoMetaDescriptor; import org.synchronoss.cpo.meta.CpoMetaDescriptor; import org.testng.annotations.BeforeClass; @@ -82,12 +82,13 @@ public void setupTest(JavaSamplerContext javaSamplerContext) { "/oracle/classdef/oracleValueMetaData.xml", true); - CtJdbcConfig jdbcConfig = CtJdbcConfig.Factory.newInstance(); + CtJdbcConfig jdbcConfig = new CtJdbcConfig(); jdbcConfig.setName(this.getClass().getName()); jdbcConfig.setMetaDescriptorName(metaDescriptor.getName()); jdbcConfig.setCpoConfigProcessor(CONFIG_PROCESSOR); - CtJdbcReadWriteConfig rwc = jdbcConfig.addNewReadWriteConfig(); + CtJdbcReadWriteConfig rwc = new CtJdbcReadWriteConfig(); + jdbcConfig.setReadWriteConfig(rwc); rwc.setUser(javaSamplerContext.getParameter(USER_NAME)); rwc.setPassword(javaSamplerContext.getParameter(PASSWORD)); rwc.setUrl(javaSamplerContext.getParameter(URL)); diff --git a/cpo-jdbc/src/test/resources/badConfig.xml b/cpo-jdbc/src/test/resources/badConfig.xml index 6332b96f5..897e009e5 100644 --- a/cpo-jdbc/src/test/resources/badConfig.xml +++ b/cpo-jdbc/src/test/resources/badConfig.xml @@ -21,10 +21,9 @@ ]] --> - @@ -34,14 +33,14 @@ /emptyMetaData.xml - + jdbcMeta org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - - ${cpo.db.url} - ${cpo.db.user} - ${cpo.db.pswd} - + + + ${cpo.db.url} + ${cpo.db.user} + ${cpo.db.pswd} + diff --git a/cpo-jdbc/src/test/resources/common/LobMetaData.xml b/cpo-jdbc/src/test/resources/common/LobMetaData.xml index cd7990339..7f68f0b35 100644 --- a/cpo-jdbc/src/test/resources/common/LobMetaData.xml +++ b/cpo-jdbc/src/test/resources/common/LobMetaData.xml @@ -21,28 +21,28 @@ ]] --> - + - + bLob byte[] B_LOB LONGVARBINARY org.synchronoss.cpo.transform.jdbc.TransformGZipBytes - + bLob2 byte[] B_LOB2 LONGVARBINARY - + lobId int LOB_ID INTEGER - + cLob char[] C_LOB @@ -52,60 +52,60 @@ delete from lob_test where lob_id = ? - + lobId - IN + IN insert into lob_test (lob_id, b_lob, c_lob, b_lob2) values (?,?,?,?) - + lobId - IN + IN - + bLob - IN + IN - + cLob - IN + IN - + bLob2 - IN + IN update lob_test set b_lob=?, c_lob=?, b_lob2=? where lob_id = ? - + bLob - IN + IN - + cLob - IN + IN - + bLob2 - IN + IN - + lobId - IN + IN select * from lob_test where lob_id = ? - + lobId - IN + IN diff --git a/cpo-jdbc/src/test/resources/common/ValueCaseMetaData.xml b/cpo-jdbc/src/test/resources/common/ValueCaseMetaData.xml index f425fa63a..4c1818b75 100644 --- a/cpo-jdbc/src/test/resources/common/ValueCaseMetaData.xml +++ b/cpo-jdbc/src/test/resources/common/ValueCaseMetaData.xml @@ -21,120 +21,120 @@ ]] --> - + - + id int iD INTEGER - value_object - id + value_object + id - + attrChar java.lang.String attr_CHAR CHAR - value_object - attr_char + value_object + attr_char - + attrCharacter java.lang.String attr_CHARACTER CHAR - + attrDate java.sql.Date attr_DATE DATE - + attrDecimal java.math.BigDecimal attr_DECIMAL DECIMAL - + attrInteger int attr_INTEGER INTEGER org.synchronoss.cpo.transform.jdbc.TransformNoOp - + attrNumeric java.math.BigDecimal attr_NUMERIC NUMERIC - + attrSmallInt short attr_SMALLINT SMALLINT - value_object - attr_smallint + value_object + attr_smallint - + attrTimestamp java.sql.Timestamp attr_TIMESTAMP TIMESTAMP - + attrVarChar java.lang.String attr_VARCHAR VARCHAR - value_object - attr_varchar + value_object + attr_varchar - + attrBit boolean attr_BIT BIT - + attrBool boolean attr_BOOL BOOLEAN - + attrDatetime java.sql.Timestamp attr_DATETIME TIMESTAMP - + attrBigInt java.math.BigInteger attr_BIGINT BIGINT - + attrDouble double attr_DOUBLE DOUBLE - + attrReal float attr_REAL REAL - + attrFloat float attr_FLOAT REAL - + attrTime java.sql.Time attr_TIME @@ -143,123 +143,123 @@ insert into value_object(id, attr_char, attr_character, attr_date, attr_decimal, attr_integer, attr_numeric, attr_smallint, attr_timestamp, attr_varchar, attr_bit, attr_bool, attr_datetime, attr_bigint) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?) - + id - IN + IN - + attrChar - IN + IN - + attrCharacter - IN + IN - + attrDate - IN + IN - + attrDecimal - IN + IN - + attrInteger - IN + IN - + attrNumeric - IN + IN - + attrSmallInt - IN + IN - + attrTimestamp - IN + IN - + attrVarChar - IN + IN - + attrBit - IN + IN - + attrBool - IN + IN - + attrDatetime - IN + IN - + attrBigInt - IN + IN insert into value_object (id, attr_varchar) values (?,?) - + id - IN + IN - + attrVarChar - IN + IN delete from value_object where id = ? - + id - IN + IN select count(0) from value_object where id = ? - + id - IN + IN select * from value_object where id = ? for update - + id - IN + IN select * from value_object where id = ? for update - + id - IN + IN select * from value_object where attr_varchar=? __CPO_WHERE__ and attr_varchar=? - + attrVarChar - IN + IN - + attrVarChar - IN + IN @@ -276,34 +276,34 @@ {? = call power(?,?)} - + attrDouble - OUT + OUT - + attrSmallInt - IN + IN - + attrSmallInt - IN + IN insert into value_object (id,attr_varchar,attr_smallint) values (?,?,?) - + id - IN + IN - + attrVarChar - IN + IN - + attrSmallInt - IN + IN @@ -315,9 +315,9 @@ delete from value_object where id = ? - + id - IN + IN @@ -332,44 +332,44 @@ {? = call power(?,?)} - + attrDouble - OUT + OUT - + attrInteger - IN + IN - + attrInteger - IN + IN select * from value_object where id = ? - + id - IN + IN select * from value_object where id = ? - + id - IN + IN select * from value_object where id = ? for update - + id - IN + IN @@ -381,9 +381,9 @@ update value_object set attr_varchar=? - + attrVarChar - IN + IN diff --git a/cpo-jdbc/src/test/resources/common/ValueMetaData.xml b/cpo-jdbc/src/test/resources/common/ValueMetaData.xml index 1c53ce550..5819b3b64 100644 --- a/cpo-jdbc/src/test/resources/common/ValueMetaData.xml +++ b/cpo-jdbc/src/test/resources/common/ValueMetaData.xml @@ -21,39 +21,41 @@ ]] --> - + - + minId int ID INTEGER - value_object - id + value_object + id - + maxId int ID INTEGER - value_object - id + value_object + id - + int1 int ID INTEGER - value_object - id + value_object + id - + int2 int ID INTEGER - value_object - id + value_object + id @@ -63,147 +65,147 @@ select * from value_object where id between ? and ? - + minId - IN + IN - + maxId - IN + IN {? = call power(?,?)} - + attrDouble - OUT + OUT - + int1 - IN + IN - + int2 - IN + IN - + id int ID INTEGER - value_object - id + value_object + id - + attrChar java.lang.String ATTR_CHAR CHAR - value_object - attr_char + value_object + attr_char - + attrCharacter java.lang.String ATTR_CHARACTER CHAR - + attrDate java.sql.Date ATTR_DATE DATE - + attrDecimal java.math.BigDecimal ATTR_DECIMAL DECIMAL - + attrInteger int ATTR_INTEGER INTEGER org.synchronoss.cpo.transform.jdbc.TransformNoOp - + attrNumeric java.math.BigDecimal ATTR_NUMERIC NUMERIC - + attrSmallInt short ATTR_SMALLINT SMALLINT - value_object - attr_smallint + value_object + attr_smallint - + attrTimestamp java.sql.Timestamp ATTR_TIMESTAMP TIMESTAMP - + attrVarChar java.lang.String ATTR_VARCHAR VARCHAR - value_object - attr_varchar + value_object + attr_varchar - + attrBit boolean ATTR_BIT BIT - + attrBool boolean ATTR_BOOL BOOLEAN - + attrDatetime java.sql.Timestamp ATTR_DATETIME TIMESTAMP - + attrBigInt java.math.BigInteger ATTR_BIGINT BIGINT - + attrDouble double ATTR_DOUBLE DOUBLE - + attrReal float ATTR_REAL REAL - + attrFloat float ATTR_FLOAT REAL - + attrTime java.sql.Time ATTR_TIME @@ -212,123 +214,123 @@ insert into value_object(id, attr_char, attr_character, attr_date, attr_decimal, attr_integer, attr_numeric, attr_smallint, attr_timestamp, attr_varchar, attr_bit, attr_bool, attr_datetime, attr_bigint) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?) - + id - IN + IN - + attrChar - IN + IN - + attrCharacter - IN + IN - + attrDate - IN + IN - + attrDecimal - IN + IN - + attrInteger - IN + IN - + attrNumeric - IN + IN - + attrSmallInt - IN + IN - + attrTimestamp - IN + IN - + attrVarChar - IN + IN - + attrBit - IN + IN - + attrBool - IN + IN - + attrDatetime - IN + IN - + attrBigInt - IN + IN insert into value_object (id, attr_varchar) values (?,?) - + id - IN + IN - + attrVarChar - IN + IN delete from value_object where id = ? - + id - IN + IN select count(0) from value_object where id = ? - + id - IN + IN select * from value_object where id = ? for update - + id - IN + IN select * from value_object where id = ? for update - + id - IN + IN select * from value_object where attr_varchar=? __CPO_WHERE__ and attr_varchar=? - + attrVarChar - IN + IN - + attrVarChar - IN + IN @@ -345,38 +347,38 @@ {? = call power(?,?)} - + attrDouble - OUT + OUT - + attrSmallInt - IN + IN - + attrSmallInt - IN + IN insert into value_object (id,attr_varchar,attr_smallint,attr_bigint) values (?,?,?,?) - + id - IN + IN - + attrVarChar - IN + IN - + attrSmallInt - IN + IN - + attrBigInt - IN + IN @@ -388,9 +390,9 @@ delete from value_object where id = ? - + id - IN + IN @@ -405,44 +407,44 @@ {? = call power(?,?)} - + attrDouble - OUT + OUT - + attrInteger - IN + IN - + attrInteger - IN + IN select * from value_object where id = ? - + id - IN + IN select * from value_object where id = ? - + id - IN + IN select * from value_object where id = ? for update nowait - + id - IN + IN @@ -454,9 +456,9 @@ update value_object set attr_varchar=? - + attrVarChar - IN + IN diff --git a/cpo-jdbc/src/test/resources/emptyClassMetaData.xml b/cpo-jdbc/src/test/resources/emptyClassMetaData.xml index 4aa24bdc1..70041985c 100644 --- a/cpo-jdbc/src/test/resources/emptyClassMetaData.xml +++ b/cpo-jdbc/src/test/resources/emptyClassMetaData.xml @@ -19,7 +19,7 @@ . ]] --> - + diff --git a/cpo-jdbc/src/test/resources/emptyMetaData.xml b/cpo-jdbc/src/test/resources/emptyMetaData.xml index 3eb9e188c..bfa70bb27 100644 --- a/cpo-jdbc/src/test/resources/emptyMetaData.xml +++ b/cpo-jdbc/src/test/resources/emptyMetaData.xml @@ -19,5 +19,5 @@ . ]] --> - + diff --git a/cpo-jdbc/src/test/resources/h2/cpoConfig.xml b/cpo-jdbc/src/test/resources/h2/cpoConfig.xml index d86afa939..c1e32c293 100644 --- a/cpo-jdbc/src/test/resources/h2/cpoConfig.xml +++ b/cpo-jdbc/src/test/resources/h2/cpoConfig.xml @@ -21,181 +21,179 @@ ]] --> - - - /emptyClassMetaData.xml - /common/ValueMetaData.xml - /common/LobMetaData.xml - /emptyMetaData.xml - - - /common/ValueCaseMetaData.xml - - - /common/ValueCaseMetaData.xml - + + /emptyClassMetaData.xml + /common/ValueMetaData.xml + /common/LobMetaData.xml + /emptyMetaData.xml + + + /common/ValueCaseMetaData.xml + + + /common/ValueCaseMetaData.xml + - - /emptyClassMetaData.xml - /common/ValueMetaData.xml - /common/LobMetaData.xml - /emptyMetaData.xml - + + /emptyClassMetaData.xml + /common/ValueMetaData.xml + /common/LobMetaData.xml + /emptyMetaData.xml + - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${h2.class} - ${h2.url} - - - - - - caseSensitive - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${h2.class} - ${h2.url} - - - - - - caseInsensitive - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${h2.class} - ${h2.url} - - - - + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${h2.class} + ${h2.url} + + + + + + caseSensitive + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${h2.class} + ${h2.url} + + + + + + caseInsensitive + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${h2.class} + ${h2.url} + + + + - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${h2.driver} - ${h2.url} - ${h2.user} - ${h2.pswd} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${h2.driver} - ${h2.userurl} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${h2.driver} - ${h2.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${h2.class} - ${h2.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${h2.class} - ${h2.url} - - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${h2.driver} - ${h2.url} - ${h2.user} - ${h2.pswd} - - - ${h2.driver} - ${h2.url} - ${h2.user} - ${h2.pswd} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${h2.class} - ${h2.url} - - - - - ${h2.class} - ${h2.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${h2.driver} - ${h2.url} - ${h2.user} - ${h2.pswd} - - - ${h2.class} - ${h2.url} - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${h2.class} - ${h2.url} - - - - - ${h2.driver} - ${h2.url} - ${h2.user} - ${h2.pswd} - - - + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${h2.driver} + ${h2.url} + ${h2.user} + ${h2.pswd} + + + ${h2.driver} + ${h2.url} + ${h2.user} + ${h2.pswd} + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${h2.class} + ${h2.url} + + + + + ${h2.class} + ${h2.url} + + + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${h2.driver} + ${h2.url} + ${h2.user} + ${h2.pswd} + + + ${h2.class} + ${h2.url} + + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${h2.class} + ${h2.url} + + + + + ${h2.driver} + ${h2.url} + ${h2.user} + ${h2.pswd} + + + diff --git a/cpo-jdbc/src/test/resources/hotDeployMetaData.xml b/cpo-jdbc/src/test/resources/hotDeployMetaData.xml index 804b45342..6667430f4 100644 --- a/cpo-jdbc/src/test/resources/hotDeployMetaData.xml +++ b/cpo-jdbc/src/test/resources/hotDeployMetaData.xml @@ -21,7 +21,7 @@ ]] --> - diff --git a/cpo-jdbc/src/test/resources/mariadb/cpoConfig.xml b/cpo-jdbc/src/test/resources/mariadb/cpoConfig.xml index ef7c75379..9781de5a3 100644 --- a/cpo-jdbc/src/test/resources/mariadb/cpoConfig.xml +++ b/cpo-jdbc/src/test/resources/mariadb/cpoConfig.xml @@ -21,180 +21,178 @@ ]] --> - - - /emptyClassMetaData.xml - ${mariadb.valueMeta} - ${mariadb.lobMeta} - /emptyMetaData.xml - - - ${mariadb.valueCaseMeta} - - - ${mariadb.valueCaseMeta} - + + /emptyClassMetaData.xml + ${mariadb.valueMeta} + ${mariadb.lobMeta} + /emptyMetaData.xml + + + ${mariadb.valueCaseMeta} + + + ${mariadb.valueCaseMeta} + - - /emptyClassMetaData.xml - ${mariadb.valueMeta} - ${mariadb.lobMeta} - /emptyMetaData.xml - + + /emptyClassMetaData.xml + ${mariadb.valueMeta} + ${mariadb.lobMeta} + /emptyMetaData.xml + - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mariadb.class} - ${mariadb.url} - - - - - - caseSensitive - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mariadb.class} - ${mariadb.url} - - - - - - caseInsensitive - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mariadb.class} - ${mariadb.url} - - - - + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mariadb.class} + ${mariadb.url} + + + + + + caseSensitive + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mariadb.class} + ${mariadb.url} + + + + + + caseInsensitive + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mariadb.class} + ${mariadb.url} + + + + - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mariadb.driver} - ${mariadb.url} - ${mariadb.user} - ${mariadb.pswd} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mariadb.driver} - ${mariadb.userurl} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mariadb.driver} - ${mariadb.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mariadb.class} - ${mariadb.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mariadb.class} - ${mariadb.url} - - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mariadb.driver} - ${mariadb.url} - ${mariadb.user} - ${mariadb.pswd} - - - ${mariadb.driver} - ${mariadb.url} - ${mariadb.user} - ${mariadb.pswd} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mariadb.class} - ${mariadb.url} - - - - - ${mariadb.class} - ${mariadb.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mariadb.driver} - ${mariadb.url} - ${mariadb.user} - ${mariadb.pswd} - - - ${mariadb.class} - ${mariadb.url} - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mariadb.class} - ${mariadb.url} - - - - - ${mariadb.driver} - ${mariadb.url} - ${mariadb.user} - ${mariadb.pswd} - - - + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mariadb.driver} + ${mariadb.url} + ${mariadb.user} + ${mariadb.pswd} + + + ${mariadb.driver} + ${mariadb.url} + ${mariadb.user} + ${mariadb.pswd} + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mariadb.class} + ${mariadb.url} + + + + + ${mariadb.class} + ${mariadb.url} + + + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mariadb.driver} + ${mariadb.url} + ${mariadb.user} + ${mariadb.pswd} + + + ${mariadb.class} + ${mariadb.url} + + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mariadb.class} + ${mariadb.url} + + + + + ${mariadb.driver} + ${mariadb.url} + ${mariadb.user} + ${mariadb.pswd} + + + diff --git a/cpo-jdbc/src/test/resources/mysql/cpoConfig.xml b/cpo-jdbc/src/test/resources/mysql/cpoConfig.xml index 436e6f97e..a78047688 100644 --- a/cpo-jdbc/src/test/resources/mysql/cpoConfig.xml +++ b/cpo-jdbc/src/test/resources/mysql/cpoConfig.xml @@ -21,180 +21,178 @@ ]] --> - - - /emptyClassMetaData.xml - ${mysql.valueMeta} - ${mysql.lobMeta} - /emptyMetaData.xml - - - ${mysql.valueCaseMeta} - - - ${mysql.valueCaseMeta} - + + /emptyClassMetaData.xml + ${mysql.valueMeta} + ${mysql.lobMeta} + /emptyMetaData.xml + + + ${mysql.valueCaseMeta} + + + ${mysql.valueCaseMeta} + - - /emptyClassMetaData.xml - ${mysql.valueMeta} - ${mysql.lobMeta} - /emptyMetaData.xml - + + /emptyClassMetaData.xml + ${mysql.valueMeta} + ${mysql.lobMeta} + /emptyMetaData.xml + - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mysql.class} - ${mysql.url} - - - - - - caseSensitive - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mysql.class} - ${mysql.url} - - - - - - caseInsensitive - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mysql.class} - ${mysql.url} - - - - + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mysql.class} + ${mysql.url} + + + + + + caseSensitive + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mysql.class} + ${mysql.url} + + + + + + caseInsensitive + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mysql.class} + ${mysql.url} + + + + - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mysql.driver} - ${mysql.url} - ${mysql.user} - ${mysql.pswd} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mysql.driver} - ${mysql.userurl} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mysql.driver} - ${mysql.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mysql.class} - ${mysql.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mysql.class} - ${mysql.url} - - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mysql.driver} - ${mysql.url} - ${mysql.user} - ${mysql.pswd} - - - ${mysql.driver} - ${mysql.url} - ${mysql.user} - ${mysql.pswd} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mysql.class} - ${mysql.url} - - - - - ${mysql.class} - ${mysql.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mysql.driver} - ${mysql.url} - ${mysql.user} - ${mysql.pswd} - - - ${mysql.class} - ${mysql.url} - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${mysql.class} - ${mysql.url} - - - - - ${mysql.driver} - ${mysql.url} - ${mysql.user} - ${mysql.pswd} - - - + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mysql.driver} + ${mysql.url} + ${mysql.user} + ${mysql.pswd} + + + ${mysql.driver} + ${mysql.url} + ${mysql.user} + ${mysql.pswd} + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mysql.class} + ${mysql.url} + + + + + ${mysql.class} + ${mysql.url} + + + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mysql.driver} + ${mysql.url} + ${mysql.user} + ${mysql.pswd} + + + ${mysql.class} + ${mysql.url} + + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${mysql.class} + ${mysql.url} + + + + + ${mysql.driver} + ${mysql.url} + ${mysql.user} + ${mysql.pswd} + + + diff --git a/cpo-jdbc/src/test/resources/oracle/classdef/oracleLobMetaData.xml b/cpo-jdbc/src/test/resources/oracle/classdef/oracleLobMetaData.xml index ccdd0eb95..96d7764e7 100644 --- a/cpo-jdbc/src/test/resources/oracle/classdef/oracleLobMetaData.xml +++ b/cpo-jdbc/src/test/resources/oracle/classdef/oracleLobMetaData.xml @@ -19,7 +19,7 @@ . ]] --> - + bLob diff --git a/cpo-jdbc/src/test/resources/oracle/classdef/oracleValueCaseMetaData.xml b/cpo-jdbc/src/test/resources/oracle/classdef/oracleValueCaseMetaData.xml index 2f93d9eaa..245e92247 100644 --- a/cpo-jdbc/src/test/resources/oracle/classdef/oracleValueCaseMetaData.xml +++ b/cpo-jdbc/src/test/resources/oracle/classdef/oracleValueCaseMetaData.xml @@ -19,7 +19,7 @@ . ]] --> - + attrBit diff --git a/cpo-jdbc/src/test/resources/oracle/classdef/oracleValueMetaData.xml b/cpo-jdbc/src/test/resources/oracle/classdef/oracleValueMetaData.xml index 2b6669d68..e5cb7a873 100644 --- a/cpo-jdbc/src/test/resources/oracle/classdef/oracleValueMetaData.xml +++ b/cpo-jdbc/src/test/resources/oracle/classdef/oracleValueMetaData.xml @@ -19,7 +19,7 @@ . ]] --> - + minId diff --git a/cpo-jdbc/src/test/resources/oracle/cpoConfig.xml b/cpo-jdbc/src/test/resources/oracle/cpoConfig.xml index 2ce641278..c8f3ca623 100644 --- a/cpo-jdbc/src/test/resources/oracle/cpoConfig.xml +++ b/cpo-jdbc/src/test/resources/oracle/cpoConfig.xml @@ -21,180 +21,178 @@ ]] --> - - - /emptyClassMetaData.xml - ${oracle.valueMeta} - ${oracle.lobMeta} - /emptyMetaData.xml - - - ${oracle.valueCaseMeta} - - - ${oracle.valueCaseMeta} - + + /emptyClassMetaData.xml + ${oracle.valueMeta} + ${oracle.lobMeta} + /emptyMetaData.xml + + + ${oracle.valueCaseMeta} + + + ${oracle.valueCaseMeta} + - - /emptyClassMetaData.xml - ${oracle.valueMeta} - ${oracle.lobMeta} - /emptyMetaData.xml - + + /emptyClassMetaData.xml + ${oracle.valueMeta} + ${oracle.lobMeta} + /emptyMetaData.xml + - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${oracle.class} - ${oracle.url} - - - - - - caseSensitive - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${oracle.class} - ${oracle.url} - - - - - - caseInsensitive - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${oracle.class} - ${oracle.url} - - - - + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${oracle.class} + ${oracle.url} + + + + + + caseSensitive + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${oracle.class} + ${oracle.url} + + + + + + caseInsensitive + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${oracle.class} + ${oracle.url} + + + + - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${oracle.driver} - ${oracle.url} - ${oracle.user} - ${oracle.pswd} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${oracle.driver} - ${oracle.userurl} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${oracle.driver} - ${oracle.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${oracle.class} - ${oracle.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${oracle.class} - ${oracle.url} - - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${oracle.driver} - ${oracle.url} - ${oracle.user} - ${oracle.pswd} - - - ${oracle.driver} - ${oracle.url} - ${oracle.user} - ${oracle.pswd} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${oracle.class} - ${oracle.url} - - - - - ${oracle.class} - ${oracle.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${oracle.driver} - ${oracle.url} - ${oracle.user} - ${oracle.pswd} - - - ${oracle.class} - ${oracle.url} - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${oracle.class} - ${oracle.url} - - - - - ${oracle.driver} - ${oracle.url} - ${oracle.user} - ${oracle.pswd} - - - + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${oracle.driver} + ${oracle.url} + ${oracle.user} + ${oracle.pswd} + + + ${oracle.driver} + ${oracle.url} + ${oracle.user} + ${oracle.pswd} + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${oracle.class} + ${oracle.url} + + + + + ${oracle.class} + ${oracle.url} + + + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${oracle.driver} + ${oracle.url} + ${oracle.user} + ${oracle.pswd} + + + ${oracle.class} + ${oracle.url} + + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${oracle.class} + ${oracle.url} + + + + + ${oracle.driver} + ${oracle.url} + ${oracle.user} + ${oracle.pswd} + + + diff --git a/cpo-jdbc/src/test/resources/postgres/cpoConfig.xml b/cpo-jdbc/src/test/resources/postgres/cpoConfig.xml index 4ba8a205a..9a3cdf34a 100644 --- a/cpo-jdbc/src/test/resources/postgres/cpoConfig.xml +++ b/cpo-jdbc/src/test/resources/postgres/cpoConfig.xml @@ -21,180 +21,178 @@ ]] --> - - - /emptyClassMetaData.xml - ${postgres.valueMeta} - ${postgres.lobMeta} - /emptyMetaData.xml - - - ${postgres.valueCaseMeta} - - - ${postgres.valueCaseMeta} - + + /emptyClassMetaData.xml + ${postgres.valueMeta} + ${postgres.lobMeta} + /emptyMetaData.xml + + + ${postgres.valueCaseMeta} + + + ${postgres.valueCaseMeta} + - - /emptyClassMetaData.xml - ${postgres.valueMeta} - ${postgres.lobMeta} - /emptyMetaData.xml - + + /emptyClassMetaData.xml + ${postgres.valueMeta} + ${postgres.lobMeta} + /emptyMetaData.xml + - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${postgres.class} - ${postgres.url} - - - - - - caseSensitive - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${postgres.class} - ${postgres.url} - - - - - - caseInsensitive - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${postgres.class} - ${postgres.url} - - - - + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${postgres.class} + ${postgres.url} + + + + + + caseSensitive + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${postgres.class} + ${postgres.url} + + + + + + caseInsensitive + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${postgres.class} + ${postgres.url} + + + + - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${postgres.driver} - ${postgres.url} - ${postgres.user} - ${postgres.pswd} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${postgres.driver} - ${postgres.userurl} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${postgres.driver} - ${postgres.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${postgres.class} - ${postgres.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${postgres.class} - ${postgres.url} - - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${postgres.driver} - ${postgres.url} - ${postgres.user} - ${postgres.pswd} - - - ${postgres.driver} - ${postgres.url} - ${postgres.user} - ${postgres.pswd} - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${postgres.class} - ${postgres.url} - - - - - ${postgres.class} - ${postgres.url} - - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${postgres.driver} - ${postgres.url} - ${postgres.user} - ${postgres.pswd} - - - ${postgres.class} - ${postgres.url} - - - - - jdbcMeta - org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor - - ${postgres.class} - ${postgres.url} - - - - - ${postgres.driver} - ${postgres.url} - ${postgres.user} - ${postgres.pswd} - - - + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${postgres.driver} + ${postgres.url} + ${postgres.user} + ${postgres.pswd} + + + ${postgres.driver} + ${postgres.url} + ${postgres.user} + ${postgres.pswd} + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${postgres.class} + ${postgres.url} + + + + + ${postgres.class} + ${postgres.url} + + + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${postgres.driver} + ${postgres.url} + ${postgres.user} + ${postgres.pswd} + + + ${postgres.class} + ${postgres.url} + + + + + jdbcMeta + org.synchronoss.cpo.jdbc.config.JdbcCpoConfigProcessor + + ${postgres.class} + ${postgres.url} + + + + + ${postgres.driver} + ${postgres.url} + ${postgres.user} + ${postgres.pswd} + + + diff --git a/pom.xml b/pom.xml index 9a55946c9..655d9ed03 100644 --- a/pom.xml +++ b/pom.xml @@ -180,20 +180,6 @@ maven-surefire-plugin 3.5.4 - - org.apache.xmlbeans - xmlbeans - 5.3.0 - - - Build-XMLBeans - generate-sources - - compile - - - - org.apache.maven.plugins maven-site-plugin @@ -443,12 +429,6 @@ testng 7.11.0 - - - org.apache.logging.log4j - log4j-to-slf4j - 2.25.1 - org.slf4j slf4j-api @@ -467,11 +447,15 @@ import - org.apache.xmlbeans - xmlbeans - 5.3.0 + jakarta.xml.bind + jakarta.xml.bind-api + 4.0.4 - + + org.glassfish.jaxb + jaxb-runtime + 4.0.6 + @@ -576,7 +560,7 @@ all true - org.synchronoss.cpo.cassandra.cpoCassandraConfig.*:org.synchronoss.cpo.cassandra.cpoCassandraMeta.*:org.synchronoss.cpo.jdbc.cpoJdbcMeta.*:org.synchronoss.cpo.jdbc.cpoJdbcConfig.*:org.synchronoss.cpo.core.cpoCoreMeta.*:org.synchronoss.cpo.core.cpoCoreConfig.* + org.synchronoss.cpo.cassandra.cpoCassandraConfig.*:org.synchronoss.cpo.cassandra.cpoCassandraMeta.*:org.synchronoss.cpo.jdbc.cpoJdbcMeta.*:org.synchronoss.cpo.jdbc.cpoJdbcConfig.*:org.synchronoss.cpo.core.cpometa.*:org.synchronoss.cpo.core.cpoCoreConfig.*