http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.accumulo/src/test/java/org/apache/rya/export/api/conf/AccumuloConfigurationAdapterTest.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.accumulo/src/test/java/org/apache/rya/export/api/conf/AccumuloConfigurationAdapterTest.java b/extras/rya.export/export.accumulo/src/test/java/org/apache/rya/export/api/conf/AccumuloConfigurationAdapterTest.java index ad322a3..e62cae1 100644 --- a/extras/rya.export/export.accumulo/src/test/java/org/apache/rya/export/api/conf/AccumuloConfigurationAdapterTest.java +++ b/extras/rya.export/export.accumulo/src/test/java/org/apache/rya/export/api/conf/AccumuloConfigurationAdapterTest.java @@ -18,19 +18,22 @@ */ package org.apache.rya.export.api.conf; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.util.Date; +import org.apache.rya.export.AccumuloMergeToolConfiguration; import org.apache.rya.export.DBType; -import org.apache.rya.export.JAXBAccumuloMergeConfiguration; +import org.apache.rya.export.InstanceType; import org.apache.rya.export.MergePolicy; -import org.apache.rya.export.accumulo.common.InstanceType; import org.apache.rya.export.accumulo.conf.AccumuloExportConstants; import org.apache.rya.export.accumulo.driver.AccumuloDualInstanceDriver; import org.apache.rya.export.accumulo.util.AccumuloInstanceDriver; -import org.junit.Assert; import org.junit.Test; /** @@ -39,8 +42,8 @@ import org.junit.Test; public class AccumuloConfigurationAdapterTest { private static final InstanceType INSTANCE_TYPE = InstanceType.MOCK; - private static final boolean IS_MOCK = INSTANCE_TYPE.isMock(); - private static final boolean USE_TIME_SYNC = false; + private static final boolean IS_MOCK = INSTANCE_TYPE == InstanceType.MOCK; + private static final boolean USE_TIME_SYNC = true; private static final String PARENT_HOST_NAME = "localhost:1234"; private static final int PARENT_PORT = 1111; @@ -68,7 +71,7 @@ public class AccumuloConfigurationAdapterTest { @Test public void testCreateConfig() throws MergeConfigurationException { - final JAXBAccumuloMergeConfiguration jConfig = mock(JAXBAccumuloMergeConfiguration.class); + final AccumuloMergeToolConfiguration jConfig = mock(AccumuloMergeToolConfiguration.class); // Parent Properties when(jConfig.getParentHostname()).thenReturn(PARENT_HOST_NAME); when(jConfig.getParentPort()).thenReturn(PARENT_PORT); @@ -79,7 +82,7 @@ public class AccumuloConfigurationAdapterTest { when(jConfig.getParentDBType()).thenReturn(DBType.ACCUMULO); when(jConfig.getParentTomcatUrl()).thenReturn(PARENT_TOMCAT_URL); // Parent Accumulo Properties - when(jConfig.getParentInstanceType()).thenReturn(INSTANCE_TYPE.toString()); + when(jConfig.getParentInstanceType()).thenReturn(INSTANCE_TYPE); when(jConfig.getParentAuths()).thenReturn(PARENT_AUTH); when(jConfig.getParentZookeepers()).thenReturn(PARENT_ZOOKEEPERS); @@ -90,56 +93,51 @@ public class AccumuloConfigurationAdapterTest { when(jConfig.getChildUsername()).thenReturn(CHILD_USER_NAME); when(jConfig.getChildPassword()).thenReturn(CHILD_PASSWORD); when(jConfig.getChildTablePrefix()).thenReturn(CHILD_TABLE_PREFIX); - when(jConfig.getChildDBType()).thenReturn(DBType.ACCUMULO); + when(jConfig.getChildDBType()).thenReturn(DBType.MONGO); when(jConfig.getChildTomcatUrl()).thenReturn(CHILD_TOMCAT_URL); - // Child Accumulo Properties - when(jConfig.getChildInstanceType()).thenReturn(INSTANCE_TYPE.toString()); - when(jConfig.getChildAuths()).thenReturn(CHILD_AUTH); - when(jConfig.getChildZookeepers()).thenReturn(CHILD_ZOOKEEPERS); // Other Properties when(jConfig.getMergePolicy()).thenReturn(MergePolicy.TIMESTAMP); when(jConfig.getNtpServerHost()).thenReturn(TIME_SERVER); when(jConfig.isUseNtpServer()).thenReturn(USE_TIME_SYNC); - when(jConfig.getToolStartTime()).thenReturn(TOOL_START_TIME); - final AccumuloMergeConfiguration accumuloMergeConfiguration = AccumuloConfigurationAdapter.createConfig(jConfig); + final AccumuloConfigurationAdapter adapter = new AccumuloConfigurationAdapter(); + final AccumuloMergeConfiguration accumuloMergeConfiguration = (AccumuloMergeConfiguration) adapter.createConfig(jConfig); - Assert.assertNotNull(accumuloMergeConfiguration); - Assert.assertEquals(AccumuloMergeConfiguration.class, accumuloMergeConfiguration.getClass()); + assertNotNull(accumuloMergeConfiguration); + assertEquals(AccumuloMergeConfiguration.class, accumuloMergeConfiguration.getClass()); // Parent Properties - Assert.assertEquals(PARENT_HOST_NAME, accumuloMergeConfiguration.getParentHostname()); - Assert.assertEquals(PARENT_USER_NAME, accumuloMergeConfiguration.getParentUsername()); - Assert.assertEquals(PARENT_PASSWORD, accumuloMergeConfiguration.getParentPassword()); - Assert.assertEquals(PARENT_INSTANCE, accumuloMergeConfiguration.getParentRyaInstanceName()); - Assert.assertEquals(PARENT_TABLE_PREFIX, accumuloMergeConfiguration.getParentTablePrefix()); - Assert.assertEquals(PARENT_TOMCAT_URL, accumuloMergeConfiguration.getParentTomcatUrl()); - Assert.assertEquals(DBType.ACCUMULO, accumuloMergeConfiguration.getParentDBType()); - Assert.assertEquals(PARENT_PORT, accumuloMergeConfiguration.getParentPort()); + assertEquals(PARENT_HOST_NAME, accumuloMergeConfiguration.getParentHostname()); + assertEquals(PARENT_USER_NAME, accumuloMergeConfiguration.getParentUsername()); + assertEquals(PARENT_PASSWORD, accumuloMergeConfiguration.getParentPassword()); + assertEquals(PARENT_INSTANCE, accumuloMergeConfiguration.getParentRyaInstanceName()); + assertEquals(PARENT_TABLE_PREFIX, accumuloMergeConfiguration.getParentTablePrefix()); + assertEquals(PARENT_TOMCAT_URL, accumuloMergeConfiguration.getParentTomcatUrl()); + assertEquals(DBType.ACCUMULO, accumuloMergeConfiguration.getParentDBType()); + assertEquals(PARENT_PORT, accumuloMergeConfiguration.getParentPort()); // Parent Accumulo Properties - Assert.assertEquals(PARENT_ZOOKEEPERS, accumuloMergeConfiguration.getParentZookeepers()); - Assert.assertEquals(PARENT_AUTH, accumuloMergeConfiguration.getParentAuths()); - Assert.assertEquals(InstanceType.MOCK, accumuloMergeConfiguration.getParentInstanceType()); + assertEquals(PARENT_ZOOKEEPERS, accumuloMergeConfiguration.getParentZookeepers()); + assertEquals(PARENT_AUTH, accumuloMergeConfiguration.getParentAuths()); + assertEquals(InstanceType.MOCK, accumuloMergeConfiguration.getParentInstanceType()); // Child Properties - Assert.assertEquals(CHILD_HOST_NAME, accumuloMergeConfiguration.getChildHostname()); - Assert.assertEquals(CHILD_USER_NAME, accumuloMergeConfiguration.getChildUsername()); - Assert.assertEquals(CHILD_PASSWORD, accumuloMergeConfiguration.getChildPassword()); - Assert.assertEquals(CHILD_INSTANCE, accumuloMergeConfiguration.getChildRyaInstanceName()); - Assert.assertEquals(CHILD_TABLE_PREFIX, accumuloMergeConfiguration.getChildTablePrefix()); - Assert.assertEquals(CHILD_TOMCAT_URL, accumuloMergeConfiguration.getChildTomcatUrl()); - Assert.assertEquals(DBType.ACCUMULO, accumuloMergeConfiguration.getChildDBType()); - Assert.assertEquals(CHILD_PORT, accumuloMergeConfiguration.getChildPort()); + assertEquals(CHILD_HOST_NAME, accumuloMergeConfiguration.getChildHostname()); + assertEquals(CHILD_USER_NAME, accumuloMergeConfiguration.getChildUsername()); + assertEquals(CHILD_PASSWORD, accumuloMergeConfiguration.getChildPassword()); + assertEquals(CHILD_INSTANCE, accumuloMergeConfiguration.getChildRyaInstanceName()); + assertEquals(CHILD_TABLE_PREFIX, accumuloMergeConfiguration.getChildTablePrefix()); + assertEquals(CHILD_TOMCAT_URL, accumuloMergeConfiguration.getChildTomcatUrl()); + assertEquals(DBType.MONGO, accumuloMergeConfiguration.getChildDBType()); + assertEquals(CHILD_PORT, accumuloMergeConfiguration.getChildPort()); // Child Properties - Assert.assertEquals(CHILD_ZOOKEEPERS, accumuloMergeConfiguration.getChildZookeepers()); - Assert.assertEquals(CHILD_AUTH, accumuloMergeConfiguration.getChildAuths()); - Assert.assertEquals(InstanceType.MOCK, accumuloMergeConfiguration.getChildInstanceType()); + assertNull(accumuloMergeConfiguration.getChildZookeepers()); + assertNull(accumuloMergeConfiguration.getChildAuths()); + assertNull(accumuloMergeConfiguration.getChildInstanceType()); // Other Properties - Assert.assertEquals(MergePolicy.TIMESTAMP, accumuloMergeConfiguration.getMergePolicy()); - Assert.assertEquals(Boolean.FALSE, accumuloMergeConfiguration.getUseNtpServer()); - Assert.assertEquals(TIME_SERVER, accumuloMergeConfiguration.getNtpServerHost()); - Assert.assertEquals(TOOL_START_TIME, accumuloMergeConfiguration.getToolStartTime()); + assertEquals(MergePolicy.TIMESTAMP, accumuloMergeConfiguration.getMergePolicy()); + assertTrue(accumuloMergeConfiguration.getUseNtpServer()); + assertEquals(TIME_SERVER, accumuloMergeConfiguration.getNtpServerHost()); } }
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/pom.xml ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/pom.xml b/extras/rya.export/export.api/pom.xml index d0f88ee..892921c 100644 --- a/extras/rya.export/export.api/pom.xml +++ b/extras/rya.export/export.api/pom.xml @@ -25,7 +25,7 @@ under the License. <parent> <groupId>org.apache.rya</groupId> <artifactId>rya.export.parent</artifactId> - <version>3.2.10-SNAPSHOT</version> + <version>3.2.11-incubating-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> @@ -69,12 +69,12 @@ under the License. <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> - <version>1.4.3</version> + <version>${slf4j.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> - <version>1.4.3</version> + <version>${slf4j.version}</version> </dependency> <dependency> <groupId>org.glassfish.jaxb</groupId> @@ -87,7 +87,7 @@ under the License. <pluginManagement> <plugins> <!-- - If we e.g. execute on JDK 1.7, we should compile for Java 7 to get + If we e.g. execute on JDK 1.7, we should compile for Java 7 to get the same (or higher) JAXB API version as used during the xjc execution. --> <plugin> @@ -128,7 +128,6 @@ under the License. <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> - <version>2.2</version> <executions> <execution> <id>xjc</id> @@ -138,17 +137,12 @@ under the License. </execution> </executions> <configuration> - <sources> - <source>src/main/xsd/MergeConfiguration.xsd</source> - </sources> <packageName>org.apache.rya.export</packageName> <outputDirectory>src/gen/java</outputDirectory> </configuration> </plugin> - <!-- - Create shaded jar with all the dependencies - --> + <!--Create shaded jar with all the dependencies--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/Merger.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/Merger.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/Merger.java index ce3e9d7..af5c70d 100644 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/Merger.java +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/Merger.java @@ -18,7 +18,7 @@ */ package org.apache.rya.export.api; -import mvm.rya.api.domain.RyaStatement; +import org.apache.rya.api.domain.RyaStatement; /** * Performs the merging of {@link RyaStatement}s. http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/StatementMerger.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/StatementMerger.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/StatementMerger.java index 2737752..f48a673 100644 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/StatementMerger.java +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/StatementMerger.java @@ -18,9 +18,9 @@ */ package org.apache.rya.export.api; -import com.google.common.base.Optional; +import org.apache.rya.api.domain.RyaStatement; -import mvm.rya.api.domain.RyaStatement; +import com.google.common.base.Optional; /** * Defines how 2 {@link RyaStatement}s will merge. http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/ConfigurationAdapter.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/ConfigurationAdapter.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/ConfigurationAdapter.java index 39c4e0b..2699a96 100644 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/ConfigurationAdapter.java +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/ConfigurationAdapter.java @@ -18,7 +18,7 @@ */ package org.apache.rya.export.api.conf; -import org.apache.rya.export.JAXBMergeConfiguration; +import org.apache.rya.export.MergeToolConfiguration; import org.apache.rya.export.api.conf.MergeConfiguration.Builder; /** @@ -30,17 +30,32 @@ public class ConfigurationAdapter { * @return The {@link MergeConfiguration} used in the application * @throws MergeConfigurationException */ - public static MergeConfiguration createConfig(final JAXBMergeConfiguration jConfig) throws MergeConfigurationException { - final Builder configBuilder = new Builder() - .setParentHostname(jConfig.getParentHostname()) - .setParentRyaInstanceName(jConfig.getParentRyaInstanceName()) - .setParentDBType(jConfig.getParentDBType()) - .setParentPort(jConfig.getParentPort()) - .setChildHostname(jConfig.getChildHostname()) - .setChildRyaInstanceName(jConfig.getChildRyaInstanceName()) - .setChildDBType(jConfig.getChildDBType()) - .setChildPort(jConfig.getChildPort()) - .setMergePolicy(jConfig.getMergePolicy()); + public MergeConfiguration createConfig(final MergeToolConfiguration jConfig) throws MergeConfigurationException { + final Builder configBuilder = getBuilder(jConfig); return configBuilder.build(); } + + protected Builder getBuilder(final MergeToolConfiguration jConfig) { + final Builder configBuilder = new Builder() + .setParentHostname(jConfig.getParentHostname()) + .setParentUsername(jConfig.getParentUsername()) + .setParentPassword(jConfig.getParentPassword()) + .setParentTablePrefix(jConfig.getParentTablePrefix()) + .setParentRyaInstanceName(jConfig.getParentRyaInstanceName()) + .setParentTomcatUrl(jConfig.getParentTomcatUrl()) + .setParentDBType(jConfig.getParentDBType()) + .setParentPort(jConfig.getParentPort()) + .setChildHostname(jConfig.getChildHostname()) + .setChildUsername(jConfig.getChildUsername()) + .setChildPassword(jConfig.getChildPassword()) + .setChildTablePrefix(jConfig.getChildTablePrefix()) + .setChildRyaInstanceName(jConfig.getChildRyaInstanceName()) + .setChildTomcatUrl(jConfig.getChildTomcatUrl()) + .setChildDBType(jConfig.getChildDBType()) + .setChildPort(jConfig.getChildPort()) + .setMergePolicy(jConfig.getMergePolicy()) + .setUseNtpServer(jConfig.isUseNtpServer()) + .setNtpServerHost(jConfig.getNtpServerHost()); + return configBuilder; + } } http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfiguration.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfiguration.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfiguration.java index dd6fd89..96f7ed6 100644 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfiguration.java +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfiguration.java @@ -58,7 +58,6 @@ public class MergeConfiguration { private final boolean useNtpServer; private final String ntpServerHost; - private final String toolStartTime; /** * Constructs a {@link MergeConfiguration}. @@ -66,25 +65,24 @@ public class MergeConfiguration { protected MergeConfiguration(final Builder builder) throws MergeConfigurationException { try { parentHostname = checkNotNull(builder.parentHostname); - parentUsername = checkNotNull(builder.parentUsername); - parentPassword = checkNotNull(builder.parentPassword); + parentUsername = builder.parentUsername; + parentPassword = builder.parentPassword; parentRyaInstanceName = checkNotNull(builder.parentRyaInstanceName); parentTablePrefix = checkNotNull(builder.parentTablePrefix); parentTomcatUrl = checkNotNull(builder.parentTomcatUrl); parentDBType = checkNotNull(builder.parentDBType); parentPort = checkNotNull(builder.parentPort); childHostname = checkNotNull(builder.childHostname); - childUsername = checkNotNull(builder.childUsername); - childPassword = checkNotNull(builder.childPassword); + childUsername = builder.childUsername; + childPassword = builder.childPassword; childRyaInstanceName = checkNotNull(builder.childRyaInstanceName); childTablePrefix = checkNotNull(builder.childTablePrefix); childTomcatUrl = checkNotNull(builder.childTomcatUrl); childDBType = checkNotNull(builder.childDBType); childPort = checkNotNull(builder.childPort); - mergePolicy = checkNotNull(builder.mergePolicy); - useNtpServer = checkNotNull(builder.useNtpServer); - ntpServerHost = checkNotNull(builder.ntpServerHost); - toolStartTime = checkNotNull(builder.toolStartTime); + mergePolicy = builder.mergePolicy; + useNtpServer = builder.useNtpServer; + ntpServerHost = builder.ntpServerHost; } catch(final NullPointerException npe) { //fix this. throw new MergeConfigurationException("The configuration was missing required field(s)", npe); @@ -185,7 +183,7 @@ public class MergeConfiguration { /** * @return The URL of the Apache Tomcat server web page running on the child machine. */ - public String getChildTomcatUrl() { + public String getChildTomcatUrl() {;// return childTomcatUrl; } @@ -226,28 +224,9 @@ public class MergeConfiguration { } /** - * @return The time of the data to be included in the copy/merge process. - */ - public String getToolStartTime() { - return toolStartTime; - } - - /** - * Abstract builder to help create {@link MergeConfiguration}s. - */ - public abstract static class AbstractBuilder<T extends AbstractBuilder<T>> { - /** - * @return The {@link MergeConfiguration} based on this builder. - * @throws MergeConfigurationException - * @throws NullPointerException if any field as not been provided - */ - public abstract MergeConfiguration build() throws MergeConfigurationException; - } - - /** * Builder to help create {@link MergeConfiguration}s. */ - public static class Builder extends AbstractBuilder<Builder> { + public static class Builder { private String parentHostname; private String parentUsername; private String parentPassword; @@ -270,7 +249,41 @@ public class MergeConfiguration { private Boolean useNtpServer; private String ntpServerHost; - private String toolStartTime; + + /** + * Creates a new Builder to create a {@link MergeConfiguration}. + */ + public Builder() { + } + + /** + * Creates a Builder based on an existing one. + * @param builder - The {@link Builder} + */ + public Builder(final Builder builder) { + parentDBType = builder.parentDBType; + parentHostname = builder.parentHostname; + parentPassword = builder.parentPassword; + parentPort = builder.parentPort; + parentRyaInstanceName = builder.parentRyaInstanceName; + parentTablePrefix = builder.parentTablePrefix; + parentTomcatUrl = builder.parentTomcatUrl; + parentUsername = builder.parentUsername; + + childDBType = builder.childDBType; + childHostname = builder.childHostname; + childPassword = builder.childPassword; + childPort = builder.childPort; + childRyaInstanceName = builder.childRyaInstanceName; + childTablePrefix = builder.childTablePrefix; + childTomcatUrl = builder.childTomcatUrl; + childUsername = builder.childUsername; + + mergePolicy = builder.mergePolicy; + + useNtpServer = builder.useNtpServer; + ntpServerHost = builder.ntpServerHost; + } /** * @param hostname - the hostname of the parent. @@ -446,17 +459,6 @@ public class MergeConfiguration { return this; } - /** - * @param toolStartTime - The time of the data to be included in the - * copy/merge process. - * @return the updated {@link Builder}. - */ - public Builder setToolStartTime(final String toolStartTime) { - this.toolStartTime = toolStartTime; - return this; - } - - @Override public MergeConfiguration build() throws MergeConfigurationException { return new MergeConfiguration(this); } http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfigurationDecorator.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfigurationDecorator.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfigurationDecorator.java new file mode 100644 index 0000000..461d5fb --- /dev/null +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfigurationDecorator.java @@ -0,0 +1,151 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.rya.export.api.conf; + +import org.apache.rya.export.DBType; +import org.apache.rya.export.MergePolicy; + +/** + * Decorator for {@link MergeConfiguration}. + * <p> + * The {@link MergeConfiguration} should be decorated when a new datastore + * has specific configuration fields or a new statement merge policy + * requires configuration. + */ +public class MergeConfigurationDecorator extends MergeConfiguration { + + /** + * Creates a new {@link MergeConfigurationDecorator} + * @param builder - The configuratoin builder. + * @throws MergeConfigurationException + */ + public MergeConfigurationDecorator(final MergeConfiguration.Builder builder) throws MergeConfigurationException { + super(builder); + } + + @Override + public int hashCode() { + return super.hashCode(); + } + + @Override + public boolean equals(final Object obj) { + return super.equals(obj); + } + + @Override + public String getParentHostname() { + return super.getParentHostname(); + } + + @Override + public String getParentUsername() { + return super.getParentUsername(); + } + + @Override + public String getParentPassword() { + return super.getParentPassword(); + } + + @Override + public String getParentRyaInstanceName() { + return super.getParentRyaInstanceName(); + } + + @Override + public String getParentTablePrefix() { + return super.getParentTablePrefix(); + } + + @Override + public String getParentTomcatUrl() { + return super.getParentTomcatUrl(); + } + + @Override + public DBType getParentDBType() { + return super.getParentDBType(); + } + + @Override + public int getParentPort() { + return super.getParentPort(); + } + + @Override + public String getChildHostname() { + return super.getChildHostname(); + } + + @Override + public String getChildUsername() { + return super.getChildUsername(); + } + + @Override + public String getChildPassword() { + return super.getChildPassword(); + } + + @Override + public String getChildRyaInstanceName() { + return super.getChildRyaInstanceName(); + } + + @Override + public String getChildTablePrefix() { + return super.getChildTablePrefix(); + } + + @Override + public String getChildTomcatUrl() { + return super.getChildTomcatUrl(); + } + + @Override + public DBType getChildDBType() { + return super.getChildDBType(); + } + + @Override + public int getChildPort() { + return super.getChildPort(); + } + + @Override + public MergePolicy getMergePolicy() { + return super.getMergePolicy(); + } + + @Override + public Boolean getUseNtpServer() { + return super.getUseNtpServer(); + } + + @Override + public String getNtpServerHost() { + return super.getNtpServerHost(); + } + + @Override + public String toString() { + return super.toString(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfigurationException.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfigurationException.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfigurationException.java index 7e099e1..e7e8e8b 100644 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfigurationException.java +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/MergeConfigurationException.java @@ -24,10 +24,19 @@ package org.apache.rya.export.api.conf; public class MergeConfigurationException extends Exception { private static final long serialVersionUID = 1L; + /** + * Creates a new {@link MergeConfigurationException} + * @param message - The error message. + */ public MergeConfigurationException(final String message) { super(message); } + /** + * Creates a new {@link MergeConfigurationException} + * @param message - The error message. + * @param source - The source of the error. + */ public MergeConfigurationException(final String message, final Throwable source) { super(message, source); } http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/policy/TimestampPolicyConfigurationAdapter.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/policy/TimestampPolicyConfigurationAdapter.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/policy/TimestampPolicyConfigurationAdapter.java new file mode 100644 index 0000000..c9e21a6 --- /dev/null +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/policy/TimestampPolicyConfigurationAdapter.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.rya.export.api.conf.policy; + +import org.apache.rya.export.MergeToolConfiguration; +import org.apache.rya.export.TimestampMergePolicyConfiguration; +import org.apache.rya.export.api.conf.ConfigurationAdapter; +import org.apache.rya.export.api.conf.MergeConfiguration; +import org.apache.rya.export.api.conf.MergeConfigurationException; +import org.apache.rya.export.api.conf.policy.TimestampPolicyMergeConfiguration.TimestampPolicyBuilder; + +/** + * Helper for creating the immutable application configuration that uses + * Accumulo. + */ +public class TimestampPolicyConfigurationAdapter extends ConfigurationAdapter { + /** + * @param jConfig - The JAXB generated configuration. + * @return The {@link MergeConfiguration} used in the application + * @throws MergeConfigurationException + */ + @Override + public MergeConfiguration createConfig(final MergeToolConfiguration jConfig) throws MergeConfigurationException { + final TimestampMergePolicyConfiguration timeConfig = (TimestampMergePolicyConfiguration) jConfig; + final MergeConfiguration.Builder configBuilder = super.getBuilder(jConfig); + final TimestampPolicyBuilder builder = new TimestampPolicyBuilder(configBuilder); + builder.setToolStartTime(timeConfig.getToolStartTime()); + return builder.build(); + } +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/policy/TimestampPolicyMergeConfiguration.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/policy/TimestampPolicyMergeConfiguration.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/policy/TimestampPolicyMergeConfiguration.java new file mode 100644 index 0000000..91bd4c2 --- /dev/null +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/policy/TimestampPolicyMergeConfiguration.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.rya.export.api.conf.policy; + +import static java.util.Objects.requireNonNull; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.apache.rya.export.api.conf.MergeConfiguration; +import org.apache.rya.export.api.conf.MergeConfigurationDecorator; +import org.apache.rya.export.api.conf.MergeConfigurationException; + +/** + * Configuration for merging Rya Statements using timestamp. + */ +public class TimestampPolicyMergeConfiguration extends MergeConfigurationDecorator { + private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSSz"); + private final Date toolStartTime; + + /** + * Creates a new {@link TimestampPolicyMergeConfiguration} + * @param builder - Builder used to create the configuration. + * @throws MergeConfigurationException - The provided time is not formatted properly. + */ + public TimestampPolicyMergeConfiguration(final TimestampPolicyBuilder builder) throws MergeConfigurationException { + super(builder); + requireNonNull(builder.toolStartTime); + try { + toolStartTime = dateFormat.parse(builder.toolStartTime); + } catch (final ParseException e) { + throw new MergeConfigurationException("Cannot parse the configured start time.", e); + } + } + + /** + * @return The time of the data to be included in the copy/merge process. + */ + public Date getToolStartTime() { + return toolStartTime; + } + + /** + * Builder to help create {@link MergeConfiguration}s. + */ + public static class TimestampPolicyBuilder extends Builder { + private String toolStartTime; + + public TimestampPolicyBuilder(final Builder builder) { + super(builder); + } + + /** + * @param toolStartTime - The time of the data to be included in the + * copy/merge process. + * @return the updated {@link Builder}. + */ + public Builder setToolStartTime(final String toolStartTime) { + this.toolStartTime = toolStartTime; + return this; + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/policy/TimestampPolicyStatementStore.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/policy/TimestampPolicyStatementStore.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/policy/TimestampPolicyStatementStore.java new file mode 100644 index 0000000..79ac19d --- /dev/null +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/conf/policy/TimestampPolicyStatementStore.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.rya.export.api.conf.policy; + +import static java.util.Objects.requireNonNull; + +import java.util.Date; +import java.util.Iterator; + +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.export.api.store.FetchStatementException; +import org.apache.rya.export.api.store.RyaStatementStore; +import org.apache.rya.export.api.store.RyaStatementStorePolicy; + +/** + * Statement Store decorated to fetch statements based on a timestamp. + */ +public abstract class TimestampPolicyStatementStore extends RyaStatementStorePolicy { + protected final Date timestamp; + + /** + * Creates a new {@link TimestampPolicyStatementStore} + * @param store - The {@link RyaStatementStore} to decorate + * @param timestamp - The timestamp to fetch statements based on. + */ + public TimestampPolicyStatementStore(final RyaStatementStore store, final Date timestamp) { + super(store); + this.timestamp = requireNonNull(timestamp); + } + + /** + * The statements fetched will have been inserted into the statement store after + * the specified timestamp. + */ + @Override + public abstract Iterator<RyaStatement> fetchStatements() throws FetchStatementException; +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/MergeParentMetadata.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/MergeParentMetadata.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/MergeParentMetadata.java new file mode 100644 index 0000000..262007e --- /dev/null +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/MergeParentMetadata.java @@ -0,0 +1,137 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.rya.export.api.metadata; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.Date; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; + +/** + * The parent database identifying information. Use the {@link ParentMetadataRepository} + * to retrieve this information + */ +public class MergeParentMetadata { + private final String ryaInstanceName; + private final Date timestamp; + private final Date filterTimestamp; + private final Long parentTimeOffset; + + /** + * Creates a new {@link MergeParentMetadata}. + * @param ryaInstanceName - The Rya Instance Name of the parent database. + * @param timestamp - The timestamp of when the copy tool ran. + * @param filterTimestamp - The timestamp used by the copy tool to filter + * which data was included when copying. + * @param parentTimeOffset - The parent time offset metadata key for the + * table. + */ + public MergeParentMetadata(final String ryaInstanceName, final Date timestamp, final Date filterTimestamp, final Long parentTimeOffset) { + this.ryaInstanceName = checkNotNull(ryaInstanceName); + this.timestamp = checkNotNull(timestamp); + this.filterTimestamp = filterTimestamp; + this.parentTimeOffset = checkNotNull(parentTimeOffset); + } + + /** + * @return - The Rya Instance Name of the parent database. + */ + public String getRyaInstanceName() { + return ryaInstanceName; + } + + /** + * @return - The timestamp of when the copy tool ran. + */ + public Date getTimestamp() { + return timestamp; + } + + /** + * @return - The timestamp used by the copy tool to filter which data was + * included when copying. + */ + public Date getFilterTimestamp() { + return filterTimestamp; + } + + /** + * @return - The parent time offset metadata key for the table. + */ + public Long getParentTimeOffset() { + return parentTimeOffset; + } + + @Override + public boolean equals(final Object obj) { + if(!(obj instanceof MergeParentMetadata)) { + return false; + } + final MergeParentMetadata other = (MergeParentMetadata) obj; + final EqualsBuilder builder = new EqualsBuilder() + .append(getRyaInstanceName(), other.getRyaInstanceName()) + .append(getTimestamp(), other.getTimestamp()) + .append(getFilterTimestamp(), other.getFilterTimestamp()) + .append(getParentTimeOffset(), other.getParentTimeOffset()); + return builder.isEquals(); + } + + @Override + public int hashCode() { + final HashCodeBuilder builder = new HashCodeBuilder() + .append(getRyaInstanceName()) + .append(getTimestamp()) + .append(getFilterTimestamp()) + .append(getParentTimeOffset()); + return builder.toHashCode(); + } + + public static class Builder { + private String name; + private Date timestamp; + private Date filterTimestamp; + private Long parentTimeOffset; + + public Builder setRyaInstanceName(final String name) { + this.name = checkNotNull(name); + return this; + } + + public Builder setTimestamp(final Date timestamp) { + this.timestamp = checkNotNull(timestamp); + return this; + } + + public Builder setFilterTimestmap(final Date filterTimestamp) { + this.filterTimestamp = checkNotNull(filterTimestamp); + return this; + } + + public Builder setParentTimeOffset(final Long parentTimeOffset) { + this.parentTimeOffset = parentTimeOffset; + return this; + } + + public MergeParentMetadata build() { + return new MergeParentMetadata(name, timestamp, filterTimestamp, parentTimeOffset); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataDoesNotExistException.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataDoesNotExistException.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataDoesNotExistException.java new file mode 100644 index 0000000..0c5ffdd --- /dev/null +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataDoesNotExistException.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.rya.export.api.metadata; + +/** + * Thrown when the {@link ParentMetadataRepository} attempts to fetch + * the {@link MergeParentMetadata} and it does not exist. + */ +public class ParentMetadataDoesNotExistException extends ParentMetadataException { + private static final long serialVersionUID = 1L; + + /** + * Creates a new {@link ParentMetadataDoesNotExistException} + * @param message - The error message. + */ + public ParentMetadataDoesNotExistException(final String message) { + super(message); + } + + /** + * Creates a new {@link ParentMetadataDoesNotExistException} + * @param message - The error message. + * @param cause - The source of the error. + */ + public ParentMetadataDoesNotExistException(final String message, final Throwable cause) { + super(message, cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataException.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataException.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataException.java new file mode 100644 index 0000000..1d0de08 --- /dev/null +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataException.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.rya.export.api.metadata; + +/** + * Thrown when the {@link ParentMetadataRepository} attempts to fetch + * the {@link MergeParentMetadata} and it does not exist. + */ +class ParentMetadataException extends Exception { + private static final long serialVersionUID = 1L; + + /** + * Creates a new {@link ParentMetadataException} + * @param message - The error message. + */ + public ParentMetadataException(final String message) { + super(message); + } + + /** + * Creates a new {@link ParentMetadataException} + * @param message - The error message. + * @param cause - The cause of the error. + */ + public ParentMetadataException(final String message, final Throwable cause) { + super(message, cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataExistsException.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataExistsException.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataExistsException.java new file mode 100644 index 0000000..3dba0f4 --- /dev/null +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataExistsException.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.rya.export.api.metadata; + +/** + * Thrown when the {@link ParentMetadataRepository} attempts to set the + * {@link MergeParentMetadata} and it already exists. + */ +public class ParentMetadataExistsException extends ParentMetadataException { + private static final long serialVersionUID = 1L; + + /** + * Creates a new {@link ParentMetadataExistsException} + * @param message - The error message. + */ + public ParentMetadataExistsException(final String message) { + super(message); + } + + /** + * Creates a new {@link ParentMetadataExistsException} + * @param message - The error message. + * @apram cause - The source of the error. + */ + public ParentMetadataExistsException(final String message, final Throwable cause) { + super(message, cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataRepository.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataRepository.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataRepository.java new file mode 100644 index 0000000..fc0f4db --- /dev/null +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/metadata/ParentMetadataRepository.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.rya.export.api.metadata; + +/** + * Repository for metadata pertaining to the parent database. This will contain + * all information to identify where any data was exported from. + * <p> + * The data found here is: + * <li>Parent database Rya Instance Name</li> + * <li>Timestamp used as the lower cutoff for the export</li> + */ +public interface ParentMetadataRepository { + /** + * @return The metadata for identifying the parent. + * @throws ParentMetadataDoesNotExistException - The {@link MergeParentMetadata} + * has not been set. + */ + public MergeParentMetadata get() throws ParentMetadataDoesNotExistException; + + /** + * @param metadata - The identifying metadata for the parent. + * @throws ParentMetadataExistsException - The {@link MergeParentMetadata} has + * already been set. + */ + public void set(MergeParentMetadata metadata) throws ParentMetadataExistsException; +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/MergeParentMetadata.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/MergeParentMetadata.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/MergeParentMetadata.java deleted file mode 100644 index 2401adf..0000000 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/MergeParentMetadata.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.rya.export.api.parent; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Date; - -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; - -/** - * The parent database identifying information. Use the {@link ParentMetadataRepository} - * to retrieve this information - */ -public class MergeParentMetadata { - private final String ryaInstanceName; - private final Date timestamp; - private final Date filterTimestamp; - private final Long parentTimeOffset; - - /** - * Creates a new {@link MergeParentMetadata}. - * @param ryaInstanceName - The Rya Instance Name of the parent database. - * @param timestamp - The timestamp of when the copy tool ran. - * @param filterTimestamp - The timestamp used by the copy tool to filter - * which data was included when copying. - * @param parentTimeOffset - The parent time offset metadata key for the - * table. - */ - public MergeParentMetadata(final String ryaInstanceName, final Date timestamp, final Date filterTimestamp, final Long parentTimeOffset) { - this.ryaInstanceName = checkNotNull(ryaInstanceName); - this.timestamp = checkNotNull(timestamp); - this.filterTimestamp = filterTimestamp; - this.parentTimeOffset = checkNotNull(parentTimeOffset); - } - - /** - * @return - The Rya Instance Name of the parent database. - */ - public String getRyaInstanceName() { - return ryaInstanceName; - } - - /** - * @return - The timestamp of when the copy tool ran. - */ - public Date getTimestamp() { - return timestamp; - } - - /** - * @return - The timestamp used by the copy tool to filter which data was - * included when copying. - */ - public Date getFilterTimestamp() { - return filterTimestamp; - } - - /** - * @return - The parent time offset metadata key for the table. - */ - public Long getParentTimeOffset() { - return parentTimeOffset; - } - - @Override - public boolean equals(final Object obj) { - if(!(obj instanceof MergeParentMetadata)) { - return false; - } - final MergeParentMetadata other = (MergeParentMetadata) obj; - final EqualsBuilder builder = new EqualsBuilder() - .append(getRyaInstanceName(), other.getRyaInstanceName()) - .append(getTimestamp(), other.getTimestamp()) - .append(getFilterTimestamp(), other.getFilterTimestamp()) - .append(getParentTimeOffset(), other.getParentTimeOffset()); - return builder.isEquals(); - } - - @Override - public int hashCode() { - final HashCodeBuilder builder = new HashCodeBuilder() - .append(getRyaInstanceName()) - .append(getTimestamp()) - .append(getFilterTimestamp()) - .append(getParentTimeOffset()); - return builder.toHashCode(); - } - - public static class Builder { - private String name; - private Date timestamp; - private Date filterTimestamp; - private Long parentTimeOffset; - - public Builder setRyaInstanceName(final String name) { - this.name = checkNotNull(name); - return this; - } - - public Builder setTimestamp(final Date timestamp) { - this.timestamp = checkNotNull(timestamp); - return this; - } - - public Builder setFilterTimestmap(final Date filterTimestamp) { - this.filterTimestamp = checkNotNull(filterTimestamp); - return this; - } - - public Builder setParentTimeOffset(final Long parentTimeOffset) { - this.parentTimeOffset = parentTimeOffset; - return this; - } - - public MergeParentMetadata build() { - return new MergeParentMetadata(name, timestamp, filterTimestamp, parentTimeOffset); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataDoesNotExistException.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataDoesNotExistException.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataDoesNotExistException.java deleted file mode 100644 index f6f691c..0000000 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataDoesNotExistException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.rya.export.api.parent; - -/** - * Thrown when the {@link ParentMetadataRepository} attempts to fetch - * the {@link MergeParentMetadata} and it does not exist. / - */ -public class ParentMetadataDoesNotExistException extends ParentMetadataException { - private static final long serialVersionUID = 1L; - - public ParentMetadataDoesNotExistException(final String message) { - super(message); - } - - public ParentMetadataDoesNotExistException(final String message, final Throwable cause) { - super(message, cause); - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataException.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataException.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataException.java deleted file mode 100644 index e3645b7..0000000 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.rya.export.api.parent; - -/** - * Thrown when the {@link ParentMetadataRepository} attempts to fetch - * the {@link MergeParentMetadata} and it does not exist. - */ -class ParentMetadataException extends Exception { - private static final long serialVersionUID = 1L; - - public ParentMetadataException(final String message) { - super(message); - } - - public ParentMetadataException(final String message, final Throwable cause) { - super(message, cause); - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataExistsException.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataExistsException.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataExistsException.java deleted file mode 100644 index 6ff63dc..0000000 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataExistsException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.rya.export.api.parent; - -/** - * Thrown when the {@link ParentMetadataRepository} attempts to set the - * {@link MergeParentMetadata} and it already exists. - */ -public class ParentMetadataExistsException extends ParentMetadataException { - private static final long serialVersionUID = 1L; - - public ParentMetadataExistsException(final String message) { - super(message); - } - - public ParentMetadataExistsException(final String message, final Throwable cause) { - super(message, cause); - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataRepository.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataRepository.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataRepository.java deleted file mode 100644 index c5ab665..0000000 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/parent/ParentMetadataRepository.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.rya.export.api.parent; - -/** - * Repository for metadata pertaining to the parent database. This will contain - * all information to identify where any data was exported from. - * <p> - * The data found here is: - * <li>Parent database Rya Instance Name</li> - * <li>Timestamp used as the lower cutoff for the export</li> - */ -public interface ParentMetadataRepository { - /** - * @return The metadata for identifying the parent. - * @throws ParentMetadataDoesNotExistException - The {@link MergeParentMetadata} - * has not been set. - */ - public MergeParentMetadata get() throws ParentMetadataDoesNotExistException; - - /** - * @param metadata - The identifying metadata for the parent. - * @throws ParentMetadataExistsException - The {@link MergeParentMetadata} has - * already been set. - */ - public void set(MergeParentMetadata metadata) throws ParentMetadataExistsException; -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/AddStatementException.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/AddStatementException.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/AddStatementException.java index 48cf7d4..44380a2 100644 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/AddStatementException.java +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/AddStatementException.java @@ -18,7 +18,7 @@ */ package org.apache.rya.export.api.store; -import mvm.rya.api.domain.RyaStatement; +import org.apache.rya.api.domain.RyaStatement; /** * Exception thrown when failing to add a {@link RyaStatement} to a http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/ContainsStatementException.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/ContainsStatementException.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/ContainsStatementException.java index c091e90..bd4a80b 100644 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/ContainsStatementException.java +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/ContainsStatementException.java @@ -18,7 +18,7 @@ */ package org.apache.rya.export.api.store; -import mvm.rya.api.domain.RyaStatement; +import org.apache.rya.api.domain.RyaStatement; /** * Exception thrown when failing to check a {@link RyaStatementStore} for a http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/FetchStatementException.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/FetchStatementException.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/FetchStatementException.java index fe06d58..0375ecb 100644 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/FetchStatementException.java +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/FetchStatementException.java @@ -18,7 +18,7 @@ */ package org.apache.rya.export.api.store; -import mvm.rya.api.domain.RyaStatement; +import org.apache.rya.api.domain.RyaStatement; /** * Exception thrown when failing to fetch a {@link RyaStatement} from a http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RemoveStatementException.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RemoveStatementException.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RemoveStatementException.java index 7d45348..a0385f9 100644 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RemoveStatementException.java +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RemoveStatementException.java @@ -18,7 +18,7 @@ */ package org.apache.rya.export.api.store; -import mvm.rya.api.domain.RyaStatement; +import org.apache.rya.api.domain.RyaStatement; /** * Exception thrown when failing to remove a {@link RyaStatement} from a http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStore.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStore.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStore.java index 3f4e6fb..68998da 100644 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStore.java +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStore.java @@ -19,8 +19,11 @@ package org.apache.rya.export.api.store; import java.util.Iterator; +import java.util.Optional; -import mvm.rya.api.domain.RyaStatement; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.export.api.metadata.MergeParentMetadata; +import org.apache.rya.export.api.metadata.ParentMetadataExistsException; /** * Allows specific CRUD operations on {@link RyaStatement} storage systems. @@ -35,6 +38,7 @@ import mvm.rya.api.domain.RyaStatement; * some storage system that is used when merging in data or exporting data. */ public interface RyaStatementStore { + /** * @return an {@link Iterator} containing all {@link RyaStatement}s found * in this {@link RyaStatementStore}. The statements will be sorted by @@ -71,4 +75,16 @@ public interface RyaStatementStore { * @throws ContainsStatementException - Thrown when an exception occurs trying to check for the statement. */ public boolean containsStatement(final RyaStatement ryaStatement) throws ContainsStatementException; + + /** + * @return - The {@link MergeParentMetadata}, if it exists, of this Statement Store. + */ + public Optional<MergeParentMetadata> getParentMetadata(); + + /** + * Sets the {@link MergeParentMetadata} for this rya statement store. + * The metadata points to the parent rya store + * @throws ParentMetadataExistsException + */ + public void setParentMetadata(MergeParentMetadata metadata) throws ParentMetadataExistsException; } http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStoreDecorator.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStoreDecorator.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStoreDecorator.java deleted file mode 100644 index 3a5794b..0000000 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStoreDecorator.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.rya.export.api.store; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Iterator; - -import mvm.rya.api.domain.RyaStatement; - -/** - * Decorates a {@link RyaStatementStore}. This is to be used when the default - * actions for {@link RyaStatement}s in the {@link RyaStatementStore} need to - * do something more specific. - */ -public abstract class RyaStatementStoreDecorator implements RyaStatementStore { - final RyaStatementStore store; - - /** - * Creates a new {@link RyaStatementStoreDecorator} around the provided {@link RyaStatementStore}. - * @param store - The {@link RyaStatementStore} to decorate. - */ - public RyaStatementStoreDecorator(final RyaStatementStore store) { - this.store = checkNotNull(store); - } - - @Override - public Iterator<RyaStatement> fetchStatements() throws FetchStatementException { - return store.fetchStatements(); - } - - @Override - public void addStatement(final RyaStatement statement) throws AddStatementException { - store.addStatement(statement); - } - - @Override - public void removeStatement(final RyaStatement statement) throws RemoveStatementException { - store.removeStatement(statement); - } - - @Override - public void updateStatement(final RyaStatement original, final RyaStatement update) throws UpdateStatementException { - store.updateStatement(original, update); - } - - @Override - public boolean containsStatement(final RyaStatement statement) throws ContainsStatementException { - return store.containsStatement(statement); - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStorePolicy.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStorePolicy.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStorePolicy.java new file mode 100644 index 0000000..d7d2a4d --- /dev/null +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/RyaStatementStorePolicy.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.rya.export.api.store; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.util.Iterator; +import java.util.Optional; + +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.export.api.metadata.MergeParentMetadata; +import org.apache.rya.export.api.metadata.ParentMetadataExistsException; + +/** + * Decorates a {@link RyaStatementStore}. This is to be used when the default + * actions for {@link RyaStatement}s in the {@link RyaStatementStore} need to + * do something more specific. + */ +public abstract class RyaStatementStorePolicy implements RyaStatementStore { + protected final RyaStatementStore store; + + /** + * Creates a new {@link RyaStatementStorePolicy} around the provided {@link RyaStatementStore}. + * @param store - The {@link RyaStatementStore} to decorate. + */ + public RyaStatementStorePolicy(final RyaStatementStore store) { + this.store = checkNotNull(store); + } + + @Override + public Iterator<RyaStatement> fetchStatements() throws FetchStatementException { + return store.fetchStatements(); + } + + @Override + public void addStatement(final RyaStatement statement) throws AddStatementException { + store.addStatement(statement); + } + + @Override + public void removeStatement(final RyaStatement statement) throws RemoveStatementException { + store.removeStatement(statement); + } + + @Override + public void updateStatement(final RyaStatement original, final RyaStatement update) throws UpdateStatementException { + store.updateStatement(original, update); + } + + @Override + public boolean containsStatement(final RyaStatement statement) throws ContainsStatementException { + return store.containsStatement(statement); + } + + @Override + public Optional<MergeParentMetadata> getParentMetadata() { + return store.getParentMetadata(); + } + + @Override + public void setParentMetadata(final MergeParentMetadata metadata) throws ParentMetadataExistsException { + store.setParentMetadata(metadata); + } +} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/UpdateStatementException.java ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/UpdateStatementException.java b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/UpdateStatementException.java index 26f776b..08bf570 100644 --- a/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/UpdateStatementException.java +++ b/extras/rya.export/export.api/src/main/java/org/apache/rya/export/api/store/UpdateStatementException.java @@ -18,7 +18,7 @@ */ package org.apache.rya.export.api.store; -import mvm.rya.api.domain.RyaStatement; +import org.apache.rya.api.domain.RyaStatement; /** * Exception thrown when failing to update a {@link RyaStatement} in a @@ -43,5 +43,4 @@ public class UpdateStatementException extends StatementStoreException { public UpdateStatementException(final String message, final Throwable cause) { super(message, cause); } - } http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/b61920ab/extras/rya.export/export.api/src/main/xsd/MergeConfiguration.xsd ---------------------------------------------------------------------- diff --git a/extras/rya.export/export.api/src/main/xsd/MergeConfiguration.xsd b/extras/rya.export/export.api/src/main/xsd/MergeConfiguration.xsd index 036b067..7b84baf 100644 --- a/extras/rya.export/export.api/src/main/xsd/MergeConfiguration.xsd +++ b/extras/rya.export/export.api/src/main/xsd/MergeConfiguration.xsd @@ -17,64 +17,73 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:mc="http://mergeconfig" - targetNamespace="http://mergeconfig" - elementFormDefault="qualified"> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" + jaxb:version="2.0" + xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" + jaxb:extensionBindingPrefixes="xjc" + xmlns:mc="http://mergeconfig" + targetNamespace="http://mergeconfig"> + <xsd:annotation> + <xsd:appinfo> + <jaxb:globalBindings> + <xjc:simple /> + </jaxb:globalBindings> + </xsd:appinfo> + </xsd:annotation> + <xsd:element name="MergeToolConfiguration" type="mc:MergeToolConfiguration"/> - <xs:element name="configuration" type="mc:JAXBMergeConfiguration"/> + <xsd:complexType name="MergeToolConfiguration"> + <xsd:sequence> + <xsd:element name="parentHostname" type="xsd:string"/> + <xsd:element name="parentUsername" type="xsd:string" minOccurs="0"/> + <xsd:element name="parentPassword" type="xsd:string" minOccurs="0"/> + <xsd:element name="parentRyaInstanceName" type="xsd:string"/> + <xsd:element name="parentTablePrefix" type="xsd:string"/> + <xsd:element name="parentTomcatUrl" type="xsd:string"/> + <xsd:element name="parentDBType" type="mc:DBType"/> + <xsd:element name="parentPort" type="mc:Port"/> - <xs:complexType name="JAXBMergeConfiguration"> - <xs:sequence> - <xs:element name="parentHostname" type="xs:string"/> - <xs:element name="parentUsername" type="xs:string"/> - <xs:element name="parentPassword" type="xs:string"/> - <xs:element name="parentRyaInstanceName" type="xs:string"/> - <xs:element name="parentTablePrefix" type="xs:string"/> - <xs:element name="parentTomcatUrl" type="xs:string"/> - <xs:element name="parentDBType" type="mc:DBType"/> - <xs:element name="parentPort" type="mc:Port"/> + <xsd:element name="childHostname" type="xsd:string"/> + <xsd:element name="childUsername" type="xsd:string" minOccurs="0"/> + <xsd:element name="childPassword" type="xsd:string" minOccurs="0"/> + <xsd:element name="childRyaInstanceName" type="xsd:string"/> + <xsd:element name="childTablePrefix" type="xsd:string"/> + <xsd:element name="childTomcatUrl" type="xsd:string"/> + <xsd:element name="childDBType" type="mc:DBType"/> + <xsd:element name="childPort" type="mc:Port"/> - <xs:element name="childHostname" type="xs:string"/> - <xs:element name="childUsername" type="xs:string"/> - <xs:element name="childPassword" type="xs:string"/> - <xs:element name="childRyaInstanceName" type="xs:string"/> - <xs:element name="childTablePrefix" type="xs:string"/> - <xs:element name="childTomcatUrl" type="xs:string"/> - <xs:element name="childDBType" type="mc:DBType"/> - <xs:element name="childPort" type="mc:Port"/> + <xsd:element name="mergePolicy" type="mc:MergePolicy"/> - <xs:element name="mergePolicy" type="mc:MergePolicy"/> + <xsd:element name="useNtpServer" type="xsd:boolean"/> + <xsd:element name="ntpServerHost" type="xsd:string" minOccurs="0"/> + </xsd:sequence> + </xsd:complexType> - <xs:element name="useNtpServer" type="xs:boolean"/> - <xs:element name="ntpServerHost" type="xs:string"/> - <xs:element name="toolStartTime" type="xs:string"/> - </xs:sequence> - </xs:complexType> - - <xs:simpleType name="MergePolicy"> - <xs:restriction base="xs:string"> - <xs:enumeration value="timestamp"/> - </xs:restriction> - </xs:simpleType> + <xsd:simpleType name="MergePolicy"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="timestamp"/> + <xsd:enumeration value="query"/> + </xsd:restriction> + </xsd:simpleType> - <xs:simpleType name="DBType"> - <xs:restriction base="xs:string"> - <xs:enumeration value="accumulo"/> - <xs:enumeration value="mongo"/> - </xs:restriction> - </xs:simpleType> + <xsd:simpleType name="DBType"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="accumulo"/> + <xsd:enumeration value="mongo"/> + </xsd:restriction> + </xsd:simpleType> + + <xsd:simpleType name="Port"> + <xsd:annotation> + <xsd:documentation> + Port number in the range [1, 65536). + </xsd:documentation> + </xsd:annotation> - <xs:simpleType name="Port"> - <xs:annotation> - <xs:documentation> - Port number in the range [1, 65536]. - </xs:documentation> - </xs:annotation> - - <xs:restriction base="xs:unsignedShort"> - <xs:minInclusive value="1"/> - </xs:restriction> - </xs:simpleType> -</schema> \ No newline at end of file + <xsd:restriction base="xsd:unsignedShort"> + <xsd:minInclusive value="1"/> + <xsd:maxInclusive value="65535"/> + </xsd:restriction> + </xsd:simpleType> +</xsd:schema> \ No newline at end of file
