http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreConfiguration.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreConfiguration.java b/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreConfiguration.java deleted file mode 100644 index 86e22a2..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreConfiguration.java +++ /dev/null @@ -1,520 +0,0 @@ -package mvm.rya.api; - -/* - * 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. - */ - - - -import java.util.List; - -import mvm.rya.api.layout.TableLayoutStrategy; -import mvm.rya.api.layout.TablePrefixLayoutStrategy; -import mvm.rya.api.persist.RdfEvalStatsDAO; - -import org.apache.hadoop.conf.Configuration; -import org.openrdf.query.algebra.evaluation.QueryOptimizer; - -import com.google.common.base.Joiner; -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; - -/** - * Rdf triple store specific configuration - */ -public abstract class RdfCloudTripleStoreConfiguration extends Configuration { - - // public static final String CONF_ISQUERYTIMEBASED = "query.timebased"; - public static final String CONF_TTL = "query.ttl"; - public static final String CONF_STARTTIME = "query.startTime"; - // public static final String CONF_TIMEINDEXURIS = "query.timeindexuris"; - public static final String CONF_NUM_THREADS = "query.numthreads"; - public static final String CONF_PERFORMANT = "query.performant"; - public static final String CONF_INFER = "query.infer"; - public static final String CONF_USE_STATS = "query.usestats"; - public static final String CONF_USE_COMPOSITE = "query.usecompositecard"; - public static final String CONF_USE_SELECTIVITY = "query.useselectivity"; - public static final String CONF_TBL_PREFIX = "query.tblprefix"; - public static final String CONF_BATCH_SIZE = "query.batchsize"; - public static final String CONF_OFFSET = "query.offset"; - public static final String CONF_LIMIT = "query.limit"; - public static final String CONF_QUERYPLAN_FLAG = "query.printqueryplan"; - public static final String CONF_QUERY_AUTH = "query.auth"; - public static final String CONF_RESULT_FORMAT = "query.resultformat"; - public static final String CONF_CV = "conf.cv"; - public static final String CONF_TBL_SPO = "tbl.spo"; - public static final String CONF_TBL_PO = "tbl.po"; - public static final String CONF_TBL_OSP = "tbl.osp"; - public static final String CONF_TBL_NS = "tbl.ns"; - public static final String CONF_TBL_EVAL = "tbl.eval"; - public static final String CONF_PREFIX_ROW_WITH_HASH = "tbl.hashprefix"; - public static final String CONF_OPTIMIZERS = "query.optimizers"; - public static final String CONF_PCJ_OPTIMIZER = "pcj.query.optimizer"; - public static final String CONF_PCJ_TABLES = "pcj.index.tables"; - - - /** - * @deprecated use CONF_* - */ - @Deprecated - public static final String BINDING_DISP_QUERYPLAN = CONF_QUERYPLAN_FLAG; - /** - * @deprecated use CONF_* - */ - @Deprecated - public static final String BINDING_AUTH = CONF_QUERY_AUTH; - /** - * @deprecated use CONF_* - */ - @Deprecated - public static final String BINDING_CV = CONF_CV; - /** - * @deprecated use CONF_* - */ - @Deprecated - public static final String BINDING_TTL = CONF_TTL; - /** - * @deprecated use CONF_* - */ - @Deprecated - public static final String BINDING_STARTTIME = CONF_STARTTIME; - /** - * @deprecated use CONF_* - */ - @Deprecated - public static final String BINDING_PERFORMANT = CONF_PERFORMANT; - /** - * @deprecated use CONF_* - */ - @Deprecated - public static final String BINDING_INFER = CONF_INFER; - /** - * @deprecated use CONF_* - */ - @Deprecated - public static final String BINDING_USESTATS = CONF_USE_STATS; - /** - * @deprecated use CONF_* - */ - @Deprecated - public static final String BINDING_OFFSET = CONF_OFFSET; - /** - * @deprecated use CONF_* - */ - @Deprecated - public static final String BINDING_LIMIT = CONF_LIMIT; - - public static final String STATS_PUSH_EMPTY_RDFTYPE_DOWN = "conf.stats.rdftype.down"; - public static final String INFER_INCLUDE_INVERSEOF = "infer.include.inverseof"; - public static final String INFER_INCLUDE_SUBCLASSOF = "infer.include.subclassof"; - public static final String INFER_INCLUDE_SUBPROPOF = "infer.include.subpropof"; - public static final String INFER_INCLUDE_SYMMPROP = "infer.include.symmprop"; - public static final String INFER_INCLUDE_TRANSITIVEPROP = "infer.include.transprop"; - - public static final String RDF_DAO_CLASS = "class.rdf.dao"; - public static final String RDF_EVAL_STATS_DAO_CLASS = "class.rdf.evalstats"; - - public static final String REGEX_SUBJECT = "query.regex.subject"; - public static final String REGEX_PREDICATE = "query.regex.predicate"; - public static final String REGEX_OBJECT = "query.regex.object"; - private static final String[] EMPTY_STR_ARR = new String[0]; - - private TableLayoutStrategy tableLayoutStrategy = new TablePrefixLayoutStrategy(); - - public RdfCloudTripleStoreConfiguration() { - } - - public RdfCloudTripleStoreConfiguration(Configuration other) { - super(other); - if (other instanceof RdfCloudTripleStoreConfiguration) { - setTableLayoutStrategy(((RdfCloudTripleStoreConfiguration) other).getTableLayoutStrategy()); - } - } - - @Override - public abstract RdfCloudTripleStoreConfiguration clone(); - - public TableLayoutStrategy getTableLayoutStrategy() { - return tableLayoutStrategy; - } - - public void setTableLayoutStrategy(TableLayoutStrategy tableLayoutStrategy) { - if (tableLayoutStrategy != null) { - this.tableLayoutStrategy = tableLayoutStrategy; - } else { - this.tableLayoutStrategy = new TablePrefixLayoutStrategy(); //default - } - set(CONF_TBL_SPO, this.tableLayoutStrategy.getSpo()); - set(CONF_TBL_PO, this.tableLayoutStrategy.getPo()); - set(CONF_TBL_OSP, this.tableLayoutStrategy.getOsp()); - set(CONF_TBL_NS, this.tableLayoutStrategy.getNs()); - set(CONF_TBL_EVAL, this.tableLayoutStrategy.getEval()); - } - - public Long getTtl() { - String val = get(CONF_TTL); - if (val != null) { - return Long.valueOf(val); - } - return null; - } - - public void setTtl(Long ttl) { - Preconditions.checkNotNull(ttl); - Preconditions.checkArgument(ttl >= 0, "ttl must be non negative"); - set(CONF_TTL, ttl.toString()); - } - - public Long getStartTime() { - String val = get(CONF_STARTTIME); - if (val != null) { - return Long.valueOf(val); - } - return null; - } - - public void setStartTime(Long startTime) { - Preconditions.checkNotNull(startTime); - Preconditions.checkArgument(startTime >= 0, "startTime must be non negative"); - set(CONF_STARTTIME, startTime.toString()); - } - - public Integer getNumThreads() { - return getInt(CONF_NUM_THREADS, 2); - } - - public void setNumThreads(Integer numThreads) { - Preconditions.checkNotNull(numThreads); - Preconditions.checkArgument(numThreads > 0, "numThreads must be greater than 0"); - setInt(CONF_NUM_THREADS, numThreads); - } - - public Boolean isPerformant() { - return getBoolean(CONF_PERFORMANT, true); - } - - public void setPerformant(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(CONF_PERFORMANT, val); - } - - public Boolean isInfer() { - return getBoolean(CONF_INFER, false); - } - - public void setInfer(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(CONF_INFER, val); - } - - public Boolean isUseStats() { - return getBoolean(CONF_USE_STATS, false); - } - - public void setUseStats(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(CONF_USE_STATS, val); - } - - public Boolean isUseSelectivity() { - return getBoolean(CONF_USE_SELECTIVITY, false); - } - - public void setUseSelectivity(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(CONF_USE_SELECTIVITY, val); - } - - public Boolean isPrefixRowsWithHash() { - return getBoolean(CONF_PREFIX_ROW_WITH_HASH, false); - } - - public void setPrefixRowsWithHash(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(CONF_PREFIX_ROW_WITH_HASH, val); - } - - public String getTablePrefix() { - return get(CONF_TBL_PREFIX, RdfCloudTripleStoreConstants.TBL_PRFX_DEF); - } - - public void setTablePrefix(String tablePrefix) { - Preconditions.checkNotNull(tablePrefix); - set(CONF_TBL_PREFIX, tablePrefix); - setTableLayoutStrategy(new TablePrefixLayoutStrategy(tablePrefix)); //TODO: Should we change the layout strategy - } - - public Integer getBatchSize() { - String val = get(CONF_BATCH_SIZE); - if (val != null) { - return Integer.valueOf(val); - } - return null; - } - - public void setBatchSize(Long batchSize) { - Preconditions.checkNotNull(batchSize); - Preconditions.checkArgument(batchSize > 0, "Batch Size must be greater than 0"); - setLong(CONF_BATCH_SIZE, batchSize); - } - - public Long getOffset() { - String val = get(CONF_OFFSET); - if (val != null) { - return Long.valueOf(val); - } - return null; - } - - public void setOffset(Long offset) { - Preconditions.checkNotNull(offset); - Preconditions.checkArgument(offset >= 0, "offset must be positive"); - setLong(CONF_OFFSET, offset); - } - - public Long getLimit() { - String val = get(CONF_LIMIT); - if (val != null) { - return Long.valueOf(val); - } - return null; - } - - public void setLimit(Long limit) { - Preconditions.checkNotNull(limit); - Preconditions.checkArgument(limit >= 0, "limit must be positive"); - setLong(CONF_LIMIT, limit); - } - - - public Boolean isDisplayQueryPlan() { - return getBoolean(CONF_QUERYPLAN_FLAG, false); - } - - public void setDisplayQueryPlan(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(CONF_QUERYPLAN_FLAG, val); - } - - /** - * @return - * @deprecated - */ - @Deprecated - public String getAuth() { - return Joiner.on(",").join(getAuths()); - } - - /** - * @param auth - * @deprecated - */ - @Deprecated - public void setAuth(String auth) { - Preconditions.checkNotNull(auth); - setStrings(CONF_QUERY_AUTH, auth); - } - - public String[] getAuths() { - return getStrings(CONF_QUERY_AUTH, EMPTY_STR_ARR); - } - - public void setAuths(String... auths) { - setStrings(CONF_QUERY_AUTH, auths); - } - - public String getEmit() { - return get(CONF_RESULT_FORMAT); - } - - public void setEmit(String emit) { - Preconditions.checkNotNull(emit); - set(CONF_RESULT_FORMAT, emit); - } - - public String getCv() { - return get(CONF_CV); - } - - public void setCv(String cv) { - Preconditions.checkNotNull(cv); - set(CONF_CV, cv); - } - - - public Boolean isUseCompositeCardinality() { - return getBoolean(CONF_USE_COMPOSITE, true); - } - - public void setCompositeCardinality(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(CONF_USE_COMPOSITE, val); - } - - - public Boolean isStatsPushEmptyRdftypeDown() { - return getBoolean(STATS_PUSH_EMPTY_RDFTYPE_DOWN, true); - } - - public void setStatsPushEmptyRdftypeDown(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(STATS_PUSH_EMPTY_RDFTYPE_DOWN, val); - } - - public Boolean isInferInverseOf() { - return getBoolean(INFER_INCLUDE_INVERSEOF, true); - } - - public void setInferInverseOf(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(INFER_INCLUDE_INVERSEOF, val); - } - - public Boolean isInferSubClassOf() { - return getBoolean(INFER_INCLUDE_SUBCLASSOF, true); - } - - public void setInferSubClassOf(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(INFER_INCLUDE_SUBCLASSOF, val); - } - - public Boolean isInferSubPropertyOf() { - return getBoolean(INFER_INCLUDE_SUBPROPOF, true); - } - - public void setInferSubPropertyOf(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(INFER_INCLUDE_SUBPROPOF, val); - } - - public Boolean isInferSymmetricProperty() { - return getBoolean(INFER_INCLUDE_SYMMPROP, true); - } - - public void setInferSymmetricProperty(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(INFER_INCLUDE_SYMMPROP, val); - } - - public Boolean isInferTransitiveProperty() { - return getBoolean(INFER_INCLUDE_TRANSITIVEPROP, true); - } - - public void setInferTransitiveProperty(Boolean val) { - Preconditions.checkNotNull(val); - setBoolean(INFER_INCLUDE_TRANSITIVEPROP, val); - } - - public void setRdfEvalStatsDaoClass(Class<? extends RdfEvalStatsDAO> rdfEvalStatsDaoClass) { - Preconditions.checkNotNull(rdfEvalStatsDaoClass); - setClass(RDF_EVAL_STATS_DAO_CLASS, rdfEvalStatsDaoClass, RdfEvalStatsDAO.class); - } - - public Class<? extends RdfEvalStatsDAO> getRdfEvalStatsDaoClass() { - return getClass(RDF_EVAL_STATS_DAO_CLASS, null, RdfEvalStatsDAO.class); - } - - - public void setPcjTables(List<String> indexTables) { - Preconditions.checkNotNull(indexTables); - setStrings(CONF_PCJ_TABLES, indexTables.toArray(new String[]{})); - } - - - public List<String> getPcjTables() { - List<String> pcjTables = Lists.newArrayList(); - String[] tables = getStrings(CONF_PCJ_TABLES); - if(tables == null) { - return pcjTables; - } - for(String table: tables) { - Preconditions.checkNotNull(table); - pcjTables.add(table); - } - return pcjTables; - } - - - public void setPcjOptimizer(Class<? extends QueryOptimizer> optimizer) { - Preconditions.checkNotNull(optimizer); - setClass(CONF_PCJ_OPTIMIZER, optimizer, QueryOptimizer.class); - } - - public Class<QueryOptimizer> getPcjOptimizer() { - Class<? extends QueryOptimizer> opt = getClass(CONF_PCJ_OPTIMIZER, null, QueryOptimizer.class); - if (opt != null) { - Preconditions.checkArgument(QueryOptimizer.class.isAssignableFrom(opt)); - return (Class<QueryOptimizer>) opt; - } else { - return null; - } - - } - - - public void setOptimizers(List<Class<? extends QueryOptimizer>> optimizers) { - Preconditions.checkNotNull(optimizers); - List<String> strs = Lists.newArrayList(); - for (Class ai : optimizers){ - Preconditions.checkNotNull(ai); - strs.add(ai.getName()); - } - - setStrings(CONF_OPTIMIZERS, strs.toArray(new String[]{})); - } - - public List<Class<QueryOptimizer>> getOptimizers() { - List<Class<QueryOptimizer>> opts = Lists.newArrayList(); - for (Class<?> clazz : getClasses(CONF_OPTIMIZERS)){ - Preconditions.checkArgument(QueryOptimizer.class.isAssignableFrom(clazz)); - opts.add((Class<QueryOptimizer>) clazz); - } - - return opts; - } - - - - public String getRegexSubject() { - return get(REGEX_SUBJECT); - } - - public void setRegexSubject(String regexSubject) { - Preconditions.checkNotNull(regexSubject); - set(REGEX_SUBJECT, regexSubject); - } - - public String getRegexPredicate() { - return get(REGEX_PREDICATE); - } - - public void setRegexPredicate(String regex) { - Preconditions.checkNotNull(regex); - set(REGEX_PREDICATE, regex); - } - - public String getRegexObject() { - return get(REGEX_OBJECT); - } - - public void setRegexObject(String regex) { - Preconditions.checkNotNull(regex); - set(REGEX_OBJECT, regex); - } -}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreConstants.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreConstants.java b/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreConstants.java deleted file mode 100644 index 5311bd9..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreConstants.java +++ /dev/null @@ -1,151 +0,0 @@ -package mvm.rya.api; - -/* - * 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. - */ - - - -import mvm.rya.api.domain.RyaSchema; -import mvm.rya.api.domain.RyaType; -import mvm.rya.api.domain.RyaURI; -import org.apache.hadoop.io.Text; -import org.openrdf.model.Literal; -import org.openrdf.model.URI; -import org.openrdf.model.Value; -import org.openrdf.model.ValueFactory; -import org.openrdf.model.impl.ValueFactoryImpl; - -public class RdfCloudTripleStoreConstants { - - public static final String NAMESPACE = RyaSchema.NAMESPACE; - public static final String AUTH_NAMESPACE = RyaSchema.AUTH_NAMESPACE; - public static ValueFactory VALUE_FACTORY = ValueFactoryImpl.getInstance(); - public static URI RANGE = VALUE_FACTORY.createURI(NAMESPACE, "range"); - public static URI PARTITION_TIMERANGE = VALUE_FACTORY.createURI("urn:mvm.mmrts.partition.rdf/08/2011#", "timeRange"); - public static Literal EMPTY_LITERAL = VALUE_FACTORY.createLiteral(0); - public static final byte EMPTY_BYTES[] = new byte[0]; - public static final Text EMPTY_TEXT = new Text(); - - public static final Long MAX_MEMORY = 10000000l; - public static final Long MAX_TIME = 60000l; - public static final Integer NUM_THREADS = 4; - -// public static final String TS = "ts"; -// public static final Text TS_TXT = new Text(TS); - -// public static final String INFO = "info"; -// public static final Text INFO_TXT = new Text(INFO); - - public static final String SUBJECT_CF = "s"; - public static final Text SUBJECT_CF_TXT = new Text(SUBJECT_CF); - public static final String PRED_CF = "p"; - public static final Text PRED_CF_TXT = new Text(PRED_CF); - public static final String OBJ_CF = "o"; - public static final Text OBJ_CF_TXT = new Text(OBJ_CF); - public static final String SUBJECTOBJECT_CF = "so"; - public static final Text SUBJECTOBJECT_CF_TXT = new Text(SUBJECTOBJECT_CF); - public static final String SUBJECTPRED_CF = "sp"; - public static final Text SUBJECTPRED_CF_TXT = new Text(SUBJECTPRED_CF); - public static final String PREDOBJECT_CF = "po"; - public static final Text PREDOBJECT_CF_TXT = new Text(PREDOBJECT_CF); - - public static final String TBL_PRFX_DEF = "rya_"; - public static final String TBL_SPO_SUFFIX = "spo"; - public static final String TBL_PO_SUFFIX = "po"; - public static final String TBL_OSP_SUFFIX = "osp"; - public static final String TBL_EVAL_SUFFIX = "eval"; - public static final String TBL_STATS_SUFFIX = "prospects"; - public static final String TBL_SEL_SUFFIX = "selectivity"; - public static final String TBL_NS_SUFFIX = "ns"; - public static String TBL_SPO = TBL_PRFX_DEF + TBL_SPO_SUFFIX; - public static String TBL_PO = TBL_PRFX_DEF + TBL_PO_SUFFIX; - public static String TBL_OSP = TBL_PRFX_DEF + TBL_OSP_SUFFIX; - public static String TBL_EVAL = TBL_PRFX_DEF + TBL_EVAL_SUFFIX; - public static String TBL_STATS = TBL_PRFX_DEF + TBL_STATS_SUFFIX; - public static String TBL_SEL = TBL_PRFX_DEF + TBL_SEL_SUFFIX; - public static String TBL_NAMESPACE = TBL_PRFX_DEF + TBL_NS_SUFFIX; - - public static Text TBL_SPO_TXT = new Text(TBL_SPO); - public static Text TBL_PO_TXT = new Text(TBL_PO); - public static Text TBL_OSP_TXT = new Text(TBL_OSP); - public static Text TBL_EVAL_TXT = new Text(TBL_EVAL); - public static Text TBL_NAMESPACE_TXT = new Text(TBL_NAMESPACE); - - public static void prefixTables(String prefix) { - if (prefix == null) - prefix = TBL_PRFX_DEF; - TBL_SPO = prefix + TBL_SPO_SUFFIX; - TBL_PO = prefix + TBL_PO_SUFFIX; - TBL_OSP = prefix + TBL_OSP_SUFFIX; - TBL_EVAL = prefix + TBL_EVAL_SUFFIX; - TBL_NAMESPACE = prefix + TBL_NS_SUFFIX; - - TBL_SPO_TXT = new Text(TBL_SPO); - TBL_PO_TXT = new Text(TBL_PO); - TBL_OSP_TXT = new Text(TBL_OSP); - TBL_EVAL_TXT = new Text(TBL_EVAL); - TBL_NAMESPACE_TXT = new Text(TBL_NAMESPACE); - } - - public static final String INFO_NAMESPACE = "namespace"; - public static final Text INFO_NAMESPACE_TXT = new Text(INFO_NAMESPACE); - - public static final byte DELIM_BYTE = 0; - public static final byte TYPE_DELIM_BYTE = 1; - public static final byte LAST_BYTE = -1; //0xff - public static final byte[] LAST_BYTES = new byte[]{LAST_BYTE}; - public static final byte[] TYPE_DELIM_BYTES = new byte[]{TYPE_DELIM_BYTE}; - public static final String DELIM = "\u0000"; - public static final String DELIM_STOP = "\u0001"; - public static final String LAST = "\uFFDD"; - public static final String TYPE_DELIM = new String(TYPE_DELIM_BYTES); - public static final byte[] DELIM_BYTES = DELIM.getBytes(); - public static final byte[] DELIM_STOP_BYTES = DELIM_STOP.getBytes(); - - - /* RECORD TYPES */ - public static final int URI_MARKER = 7; - - public static final int BNODE_MARKER = 8; - - public static final int PLAIN_LITERAL_MARKER = 9; - - public static final int LANG_LITERAL_MARKER = 10; - - public static final int DATATYPE_LITERAL_MARKER = 11; - - public static final int EOF_MARKER = 127; - - // public static final Authorizations ALL_AUTHORIZATIONS = new Authorizations( - // "_"); - - public static enum TABLE_LAYOUT { - SPO, PO, OSP - } - - //TODO: This should be in a version file somewhere - public static URI RTS_SUBJECT = VALUE_FACTORY.createURI(NAMESPACE, "rts"); - public static RyaURI RTS_SUBJECT_RYA = new RyaURI(RTS_SUBJECT.stringValue()); - public static URI RTS_VERSION_PREDICATE = VALUE_FACTORY.createURI(NAMESPACE, "version"); - public static RyaURI RTS_VERSION_PREDICATE_RYA = new RyaURI(RTS_VERSION_PREDICATE.stringValue()); - public static final Value VERSION = VALUE_FACTORY.createLiteral("3.0.0"); - public static RyaType VERSION_RYA = new RyaType(VERSION.stringValue()); - - public static String RYA_CONFIG_AUTH = "RYACONFIG"; -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreStatement.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreStatement.java b/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreStatement.java deleted file mode 100644 index 4a13c01..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreStatement.java +++ /dev/null @@ -1,72 +0,0 @@ -package mvm.rya.api; - -/* - * 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. - */ - - - -import org.openrdf.model.Resource; -import org.openrdf.model.Statement; -import org.openrdf.model.URI; -import org.openrdf.model.Value; -import org.openrdf.model.impl.ContextStatementImpl; -import org.openrdf.model.impl.StatementImpl; - -import java.util.ArrayList; -import java.util.Collection; - -public class RdfCloudTripleStoreStatement extends StatementImpl { - - private Resource[] contexts; //TODO: no blank nodes - - public RdfCloudTripleStoreStatement(Resource subject, URI predicate, Value object) { - super(subject, predicate, object); - } - - public RdfCloudTripleStoreStatement(Resource subject, URI predicate, Value object, - Resource... contexts) { - super(subject, predicate, object); - this.contexts = contexts; - } - - public Resource[] getContexts() { - return contexts; - } - - public Collection<Statement> getStatements() { - Collection<Statement> statements = new ArrayList<Statement>(); - - if (getContexts() != null && getContexts().length > 1) { - for (Resource contxt : getContexts()) { - statements.add(new ContextStatementImpl(getSubject(), - getPredicate(), getObject(), contxt)); - } - } else - statements.add(this); - - return statements; - } - - @Override - public Resource getContext() { - if (contexts == null || contexts.length == 0) - return null; - else return contexts[0]; - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreUtils.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreUtils.java b/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreUtils.java deleted file mode 100644 index eeadb9b..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/RdfCloudTripleStoreUtils.java +++ /dev/null @@ -1,420 +0,0 @@ -package mvm.rya.api; - -/* - * 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. - */ - - - -import mvm.rya.api.layout.TableLayoutStrategy; -import mvm.rya.api.layout.TablePrefixLayoutStrategy; -import org.openrdf.model.Literal; -import org.openrdf.model.URI; -import org.openrdf.model.Value; -import org.openrdf.model.ValueFactory; -import org.openrdf.model.impl.BNodeImpl; -import org.openrdf.model.impl.LiteralImpl; -import org.openrdf.model.impl.URIImpl; -import org.openrdf.model.impl.ValueFactoryImpl; - -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static mvm.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT; - -public class RdfCloudTripleStoreUtils { - - public static ValueFactory valueFactory = new ValueFactoryImpl(); - public static final Pattern literalPattern = Pattern.compile("^\"(.*?)\"((\\^\\^<(.+?)>)$|(@(.{2}))$)"); - -// public static byte[] writeValue(Value value) throws IOException { -// return RdfIO.writeValue(value); -//// if (value == null) -//// return new byte[]{}; -//// ByteArrayDataOutput dataOut = ByteStreams.newDataOutput(); -//// if (value instanceof URI) { -//// dataOut.writeByte(RdfCloudTripleStoreConstants.URI_MARKER); -//// writeString(((URI) value).toString(), dataOut); -//// } else if (value instanceof BNode) { -//// dataOut.writeByte(RdfCloudTripleStoreConstants.BNODE_MARKER); -//// writeString(((BNode) value).getID(), dataOut); -//// } else if (value instanceof Literal) { -//// Literal lit = (Literal) value; -//// -//// String label = lit.getLabel(); -//// String language = lit.getLanguage(); -//// URI datatype = lit.getDatatype(); -//// -//// if (datatype != null) { -//// dataOut.writeByte(RdfCloudTripleStoreConstants.DATATYPE_LITERAL_MARKER); -//// writeString(label, dataOut); -//// dataOut.write(writeValue(datatype)); -//// } else if (language != null) { -//// dataOut.writeByte(RdfCloudTripleStoreConstants.LANG_LITERAL_MARKER); -//// writeString(label, dataOut); -//// writeString(language, dataOut); -//// } else { -//// dataOut.writeByte(RdfCloudTripleStoreConstants.PLAIN_LITERAL_MARKER); -//// writeString(label, dataOut); -//// } -//// } else { -//// throw new IllegalArgumentException("unexpected value type: " -//// + value.getClass()); -//// } -//// return dataOut.toByteArray(); -// } - -// public static Value readValue(ByteArrayDataInput dataIn, ValueFactory vf) -// throws IOException, ClassCastException { -// return RdfIO.readValue(dataIn, vf, DELIM_BYTE); -//// int valueTypeMarker; -//// try { -//// valueTypeMarker = dataIn.readByte(); -//// } catch (Exception e) { -//// return null; -//// } -//// -//// Value ret = null; -//// if (valueTypeMarker == RdfCloudTripleStoreConstants.URI_MARKER) { -//// String uriString = readString(dataIn); -//// ret = vf.createURI(uriString); -//// } else if (valueTypeMarker == RdfCloudTripleStoreConstants.BNODE_MARKER) { -//// String bnodeID = readString(dataIn); -//// ret = vf.createBNode(bnodeID); -//// } else if (valueTypeMarker == RdfCloudTripleStoreConstants.PLAIN_LITERAL_MARKER) { -//// String label = readString(dataIn); -//// ret = vf.createLiteral(label); -//// } else if (valueTypeMarker == RdfCloudTripleStoreConstants.LANG_LITERAL_MARKER) { -//// String label = readString(dataIn); -//// String language = readString(dataIn); -//// ret = vf.createLiteral(label, language); -//// } else if (valueTypeMarker == RdfCloudTripleStoreConstants.DATATYPE_LITERAL_MARKER) { -//// String label = readString(dataIn); -//// URI datatype = (URI) readValue(dataIn, vf); -//// ret = vf.createLiteral(label, datatype); -//// } else { -//// throw new InvalidValueTypeMarkerRuntimeException(valueTypeMarker, "Invalid value type marker: " -//// + valueTypeMarker); -//// } -//// -//// return ret; -// } - -// public static void writeString(String s, ByteArrayDataOutput dataOut) -// throws IOException { -// dataOut.writeUTF(s); -// } -// -// public static String readString(ByteArrayDataInput dataIn) -// throws IOException { -// return dataIn.readUTF(); -// } -// -// public static byte[] writeContexts(Resource... contexts) throws IOException { -// if (contexts != null) { -// ByteArrayDataOutput cntxout = ByteStreams.newDataOutput(); -// for (Resource resource : contexts) { -// final byte[] context_bytes = RdfCloudTripleStoreUtils -// .writeValue(resource); -// cntxout.write(context_bytes); -// cntxout.write(RdfCloudTripleStoreConstants.DELIM_BYTES); -// } -// return cntxout.toByteArray(); -// } else -// return new byte[]{}; -// } -// -// public static List<Resource> readContexts(byte[] cont_arr, ValueFactory vf) -// throws IOException { -// List<Resource> contexts = new ArrayList<Resource>(); -// String conts_str = new String(cont_arr); -// String[] split = conts_str.split(RdfCloudTripleStoreConstants.DELIM); -// for (String string : split) { -// contexts.add((Resource) RdfCloudTripleStoreUtils.readValue(ByteStreams -// .newDataInput(string.getBytes()), vf)); -// } -// return contexts; -// } - -// public static Statement translateStatementFromRow(ByteArrayDataInput input, Text context, TABLE_LAYOUT tble, ValueFactory vf) throws IOException { -// Resource subject; -// URI predicate; -// Value object; -// if (TABLE_LAYOUT.SPO.equals(tble)) { -// subject = (Resource) RdfCloudTripleStoreUtils.readValue(input, vf); -// predicate = (URI) RdfCloudTripleStoreUtils.readValue(input, vf); -// object = RdfCloudTripleStoreUtils.readValue(input, vf); -// } else if (TABLE_LAYOUT.OSP.equals(tble)) { -// object = RdfCloudTripleStoreUtils.readValue(input, vf); -// subject = (Resource) RdfCloudTripleStoreUtils.readValue(input, vf); -// predicate = (URI) RdfCloudTripleStoreUtils.readValue(input, vf); -// } else if (TABLE_LAYOUT.PO.equals(tble)) { -// predicate = (URI) RdfCloudTripleStoreUtils.readValue(input, vf); -// object = RdfCloudTripleStoreUtils.readValue(input, vf); -// subject = (Resource) RdfCloudTripleStoreUtils.readValue(input, vf); -// } else { -// throw new IllegalArgumentException("Table[" + tble + "] is not valid"); -// } -// if (context == null || INFO_TXT.equals(context)) -// return new StatementImpl(subject, predicate, object); //default graph -// else -// return new ContextStatementImpl(subject, predicate, object, (Resource) readValue(ByteStreams.newDataInput(context.getBytes()), vf)); //TODO: Seems like a perf hog -// } - -// public static byte[] buildRowWith(byte[] bytes_one, byte[] bytes_two, byte[] bytes_three) throws IOException { -// ByteArrayDataOutput rowidout = ByteStreams.newDataOutput(); -// rowidout.write(bytes_one); -// rowidout.writeByte(DELIM_BYTE); -//// rowidout.write(RdfCloudTripleStoreConstants.DELIM_BYTES); -// rowidout.write(bytes_two); -// rowidout.writeByte(DELIM_BYTE); -//// rowidout.write(RdfCloudTripleStoreConstants.DELIM_BYTES); -// rowidout.write(bytes_three); -// return truncateRowId(rowidout.toByteArray()); -// } - -// public static byte[] truncateRowId(byte[] byteArray) { -// if (byteArray.length > 32000) { -// ByteArrayDataOutput stream = ByteStreams.newDataOutput(); -// stream.write(byteArray, 0, 32000); -// return stream.toByteArray(); -// } -// return byteArray; -// } - - - public static class CustomEntry<T, U> implements Map.Entry<T, U> { - - private T key; - private U value; - - public CustomEntry(T key, U value) { - this.key = key; - this.value = value; - } - - @Override - public T getKey() { - return key; - } - - @Override - public U getValue() { - return value; - } - - public T setKey(T key) { - this.key = key; - return this.key; - } - - @Override - public U setValue(U value) { - this.value = value; - return this.value; - } - - @Override - public String toString() { - return "CustomEntry{" + - "key=" + key + - ", value=" + value + - '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - CustomEntry that = (CustomEntry) o; - - if (key != null ? !key.equals(that.key) : that.key != null) return false; - if (value != null ? !value.equals(that.value) : that.value != null) return false; - - return true; - } - - @Override - public int hashCode() { - int result = key != null ? key.hashCode() : 0; - result = 31 * result + (value != null ? value.hashCode() : 0); - return result; - } - } - - /** - * If value is a URI, then return as URI, otherwise return namespace/value as the URI - * - * @param namespace - * @param value - * @return - */ - public static URI convertToUri(String namespace, String value) { - if (value == null) - return null; - URI subjUri; - try { - subjUri = valueFactory.createURI(value); - } catch (Exception e) { - //not uri - if (namespace == null) - return null; - subjUri = valueFactory.createURI(namespace, value); - } - return subjUri; - } - - public static Literal convertToDataTypeLiteral(String s) { - int i = s.indexOf("^^"); - if (i != -1) { - String val = s.substring(1, i - 1); - int dt_i_start = i + 2; - int dt_i_end = s.length(); - if (s.charAt(dt_i_start) == '<') { - dt_i_start = dt_i_start + 1; - dt_i_end = dt_i_end - 1; - } - - String dataType = s.substring(dt_i_start, dt_i_end); - return valueFactory.createLiteral(val, valueFactory.createURI(dataType)); - } - return null; - } - - public static boolean isDataTypeLiteral(String lit) { - return lit != null && lit.indexOf("^^") != -1; - } - - public static boolean isUri(String uri) { - if (uri == null) return false; - try { - valueFactory.createURI(uri); - } catch (Exception e) { - return false; - } - return true; - } - - -// public static boolean isQueryTimeBased(Configuration conf) { -// return (conf != null && conf.getBoolean(RdfCloudTripleStoreConfiguration.CONF_ISQUERYTIMEBASED, false)); -// } -// -// public static void setQueryTimeBased(Configuration conf, boolean timeBased) { -// if (conf != null) -// conf.setBoolean(RdfCloudTripleStoreConfiguration.CONF_ISQUERYTIMEBASED, isQueryTimeBased(conf) || timeBased); -// } - - -// public static void addTimeIndexUri(Configuration conf, URI timeUri, Class<? extends TtlValueConverter> ttlValueConvClass) { -// String[] timeIndexUris = conf.getStrings(RdfCloudTripleStoreConfiguration.CONF_TIMEINDEXURIS); -// if (timeIndexUris == null) -// timeIndexUris = new String[0]; -// List<String> stringList = new ArrayList<String>(Arrays.asList(timeIndexUris)); -// String timeUri_s = timeUri.stringValue(); -// if (!stringList.contains(timeUri_s)) -// stringList.add(timeUri_s); -// conf.setStrings(RdfCloudTripleStoreConfiguration.CONF_TIMEINDEXURIS, stringList.toArray(new String[stringList.size()])); -// conf.set(timeUri_s, ttlValueConvClass.getName()); -// } - -// public static Class<? extends TtlValueConverter> getTtlValueConverter(Configuration conf, URI predicate) throws ClassNotFoundException { -// if (predicate == null) -// return null; -// -// String[] s = conf.getStrings(RdfCloudTripleStoreConfiguration.CONF_TIMEINDEXURIS); -// if (s == null) -// return null; -// -// for (String uri : s) { -// if (predicate.stringValue().equals(uri)) { -// return (Class<? extends TtlValueConverter>) RdfCloudTripleStoreUtils.class.getClassLoader().loadClass(conf.get(uri)); -// } -// } -// return null; -// } - - public static String layoutToTable(TABLE_LAYOUT layout, RdfCloudTripleStoreConfiguration conf) { - TableLayoutStrategy tableLayoutStrategy = conf.getTableLayoutStrategy(); - return layoutToTable(layout, tableLayoutStrategy); - } - - public static String layoutToTable(TABLE_LAYOUT layout, TableLayoutStrategy tableLayoutStrategy) { - if (tableLayoutStrategy == null) { - tableLayoutStrategy = new TablePrefixLayoutStrategy(); - } - switch (layout) { - case SPO: { - return tableLayoutStrategy.getSpo(); - } - case PO: { - return tableLayoutStrategy.getPo(); - } - case OSP: { - return tableLayoutStrategy.getOsp(); - } - } - return null; - } - - public static String layoutPrefixToTable(TABLE_LAYOUT layout, String prefix) { - return layoutToTable(layout, new TablePrefixLayoutStrategy(prefix)); - } - - //helper methods to createValue - public static Value createValue(String resource) { - if (isBNode(resource)) - return new BNodeImpl(resource.substring(2)); - Literal literal; - if ((literal = makeLiteral(resource)) != null) - return literal; - if (resource.contains(":") || resource.contains("/") || resource.contains("#")) { - return new URIImpl(resource); - } else { - throw new RuntimeException((new StringBuilder()).append(resource).append(" is not a valid URI, blank node, or literal value").toString()); - } - } - - public static boolean isBNode(String resource) { - return resource.length() > 2 && resource.startsWith("_:"); - } - - public static boolean isLiteral(String resource) { - return literalPattern.matcher(resource).matches() || resource.startsWith("\"") && resource.endsWith("\"") && resource.length() > 1; - } - - public static boolean isURI(String resource) { - return !isBNode(resource) && !isLiteral(resource) && (resource.contains(":") || resource.contains("/") || resource.contains("#")); - } - - public static Literal makeLiteral(String resource) { - Matcher matcher = literalPattern.matcher(resource); - if (matcher.matches()) - if (null != matcher.group(4)) - return new LiteralImpl(matcher.group(1), new URIImpl(matcher.group(4))); - else - return new LiteralImpl(matcher.group(1), matcher.group(6)); - if (resource.startsWith("\"") && resource.endsWith("\"") && resource.length() > 1) - return new LiteralImpl(resource.substring(1, resource.length() - 1)); - else - return null; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/client/BatchUpdatePCJ.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/client/BatchUpdatePCJ.java b/common/rya.api/src/main/java/mvm/rya/api/client/BatchUpdatePCJ.java deleted file mode 100644 index d6f3454..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/client/BatchUpdatePCJ.java +++ /dev/null @@ -1,40 +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 mvm.rya.api.client; - -import javax.annotation.ParametersAreNonnullByDefault; - -/** - * Batch update a PCJ index. - */ -@ParametersAreNonnullByDefault -public interface BatchUpdatePCJ { - - /** - * Batch update a specific PCJ index using the {@link Statement}s that are - * currently in the Rya instance. - * - * @param ryaInstanceName - The Rya instance whose PCJ will be updated. (not null) - * @param pcjId - Identifies the PCJ index to update. (not null) - * @throws InstanceDoesNotExistException No instance of Rya exists for the provided name. - * @throws PCJDoesNotExistException No PCJ exists for the provided PCJ ID. - * @throws RyaClientException Something caused the command to fail. - */ - public void batchUpdate(String ryaInstanceName, String pcjId) throws InstanceDoesNotExistException, PCJDoesNotExistException, RyaClientException; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/client/CreatePCJ.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/client/CreatePCJ.java b/common/rya.api/src/main/java/mvm/rya/api/client/CreatePCJ.java deleted file mode 100644 index ae22ffe..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/client/CreatePCJ.java +++ /dev/null @@ -1,40 +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 mvm.rya.api.client; - -import javax.annotation.ParametersAreNonnullByDefault; - -/** - * Create a new PCJ within the target instance of Rya. - */ -@ParametersAreNonnullByDefault -public interface CreatePCJ { - - /** - * Designate a new PCJ that will be maintained by the target instance of Rya. - * - * @param instanceName - Indicates which Rya instance will create and maintain - * the PCJ. (not null) - * @param sparql - The SPARQL query that will be maintained. (not null) - * @return The ID that was assigned to this newly created PCJ. - * @throws InstanceDoesNotExistException No instance of Rya exists for the provided name. - * @throws RyaClientException Something caused the command to fail. - */ - public String createPCJ(final String instanceName, String sparql) throws InstanceDoesNotExistException, RyaClientException; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/client/DeletePCJ.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/client/DeletePCJ.java b/common/rya.api/src/main/java/mvm/rya/api/client/DeletePCJ.java deleted file mode 100644 index 92b6b71..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/client/DeletePCJ.java +++ /dev/null @@ -1,38 +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 mvm.rya.api.client; - -import javax.annotation.ParametersAreNonnullByDefault; - -/** - * Deletes a PCJ from an instance of Rya. - */ -@ParametersAreNonnullByDefault -public interface DeletePCJ { - - /** - * Deletes a PCJ from an instance of Rya. - * - * @param instanceName - Indicates which Rya instance is maintaining the PCJ. (not null) - * @param pcjId - The ID of the PCJ that will be deleted. (not null) - * @throws InstanceDoesNotExistException No instance of Rya exists for the provided name. - * @throws RyaClientException Something caused the command to fail. - */ - public void deletePCJ(String instanceName, final String pcjId) throws InstanceDoesNotExistException, RyaClientException; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/client/GetInstanceDetails.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/client/GetInstanceDetails.java b/common/rya.api/src/main/java/mvm/rya/api/client/GetInstanceDetails.java deleted file mode 100644 index 536b5a8..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/client/GetInstanceDetails.java +++ /dev/null @@ -1,44 +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 mvm.rya.api.client; - -import javax.annotation.ParametersAreNonnullByDefault; - -import com.google.common.base.Optional; - -import mvm.rya.api.instance.RyaDetails; - -/** - * Get configuration and maintenance information about a specific instance of Rya. - */ -@ParametersAreNonnullByDefault -public interface GetInstanceDetails { - - /** - * Get configuration and maintenance information about a specific instance of Rya. - * - * @param instanceName - Indicates which Rya instance to fetch the details from. (not null) - * @return The {@link RyaDetails} that describe the instance of Rya. If this is - * an older version of Rya, then there may not be any details to fetch. If - * this is the case, empty is returned. - * @throws InstanceDoesNotExistException No instance of Rya exists for the provided name. - * @throws RyaClientException Something caused the command to fail. - */ - public Optional<RyaDetails> getDetails(final String instanceName) throws InstanceDoesNotExistException, RyaClientException; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/client/Install.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/client/Install.java b/common/rya.api/src/main/java/mvm/rya/api/client/Install.java deleted file mode 100644 index 28a0dc5..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/client/Install.java +++ /dev/null @@ -1,268 +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 mvm.rya.api.client; - -import static java.util.Objects.requireNonNull; - -import java.util.Objects; - -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; -import javax.annotation.concurrent.Immutable; - -import com.google.common.base.Optional; - -/** - * Installs a new instance of Rya. - */ -@ParametersAreNonnullByDefault -public interface Install { - - /** - * Install a new instance of Rya. - * - * @param instanceName - Indicates the name of the Rya instance to install. (not null) - * @param installConfig - Configures how the Rya instance will operate. The - * instance name that is in this variable must match the {@code instanceName}. (not null) - * @throws DuplicateInstanceNameException A Rya instance already exists for the provided name. - * @throws RyaClientException Something caused the command to fail. - */ - public void install(final String instanceName, final InstallConfiguration installConfig) throws DuplicateInstanceNameException, RyaClientException; - - /** - * A Rya instance already exists for the provided name. - */ - public static class DuplicateInstanceNameException extends RyaClientException { - private static final long serialVersionUID = 1L; - - public DuplicateInstanceNameException(final String message) { - super(message); - } - } - - /** - * Configures how an instance of Rya will be configured when it is installed. - */ - @Immutable - @ParametersAreNonnullByDefault - public static class InstallConfiguration { - - private final boolean enableTableHashPrefix; - private final boolean enableFreeTextIndex; - private final boolean enableGeoIndex; - private final boolean enableEntityCentricIndex; - private final boolean enableTemporalIndex; - private final boolean enablePcjIndex; - private final Optional<String> fluoPcjAppName; - - /** - * Use a {@link Builder} to create instances of this class. - */ - private InstallConfiguration( - final boolean enableTableHashPrefix, - final boolean enableFreeTextIndex, - final boolean enableGeoIndex, - final boolean enableEntityCentricIndex, - final boolean enableTemporalIndex, - final boolean enablePcjIndex, - final Optional<String> fluoPcjAppName) { - this.enableTableHashPrefix = requireNonNull(enableTableHashPrefix); - this.enableFreeTextIndex = requireNonNull(enableFreeTextIndex); - this.enableGeoIndex = requireNonNull(enableGeoIndex); - this.enableEntityCentricIndex = requireNonNull(enableEntityCentricIndex); - this.enableTemporalIndex = requireNonNull(enableTemporalIndex); - this.enablePcjIndex = requireNonNull(enablePcjIndex); - this.fluoPcjAppName = requireNonNull(fluoPcjAppName); - } - - /** - * @return Whether or not the installed instance of Rya will include table prefix hashing. - */ - public boolean isTableHashPrefixEnabled() { - return enableTableHashPrefix; - } - - /** - * @return Whether or not the installed instance of Rya will maintain a Free Text index. - */ - public boolean isFreeTextIndexEnabled() { - return enableFreeTextIndex; - } - - /** - * @return Whether or not the installed instance of Rya will maintain a Geospatial index. - */ - public boolean isGeoIndexEnabled() { - return enableGeoIndex; - } - - /** - * @return Whether or not the installed instance of Rya will maintain an Entity Centric index. - */ - public boolean isEntityCentrixIndexEnabled() { - return enableEntityCentricIndex; - } - - /** - * @return Whether or not the installed instance of Rya will maintain a Temporal index. - */ - public boolean isTemporalIndexEnabled() { - return enableTemporalIndex; - } - - /** - * @return Whether or not the installed instance of Rya will maintain a PCJ index. - */ - public boolean isPcjIndexEnabled() { - return enablePcjIndex; - } - - /** - * @return The name of the Fluo application that updates this instance of Rya's PCJs. - * Optional because this does not have to be the update paradigm used. - */ - public Optional<String> getFluoPcjAppName() { - return fluoPcjAppName; - } - - @Override - public int hashCode() { - return Objects.hash( - enableTableHashPrefix, - enableFreeTextIndex, - enableGeoIndex, - enableEntityCentricIndex, - enableTemporalIndex, - enablePcjIndex, - fluoPcjAppName); - } - - @Override - public boolean equals(final Object obj) { - if(this == obj) { - return true; - } - if(obj instanceof InstallConfiguration) { - final InstallConfiguration config = (InstallConfiguration) obj; - return enableTableHashPrefix == config.enableTableHashPrefix && - enableFreeTextIndex == config.enableFreeTextIndex && - enableGeoIndex == config.enableGeoIndex && - enableEntityCentricIndex == config.enableEntityCentricIndex && - enableTemporalIndex == config.enableTemporalIndex && - enablePcjIndex == config.enablePcjIndex && - Objects.equals(fluoPcjAppName, config.fluoPcjAppName); - } - return false; - } - - /** - * @return An empty instance of {@link Builder}. - */ - public static Builder builder() { - return new Builder(); - } - - /** - * Builds instances of {@link InstallConfiguration}. - */ - @ParametersAreNonnullByDefault - public static class Builder { - private boolean enableTableHashPrefix = false; - private boolean enableFreeTextIndex = false; - private boolean enableGeoIndex = false; - private boolean enableEntityCentricIndex = false; - private boolean enableTemporalIndex = false; - private boolean enablePcjIndex = false; - private String fluoPcjAppName = null; - - /** - * @param enabled - Whether or not the installed instance of Rya will include table prefix hashing. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setEnableTableHashPrefix(final boolean enabled) { - enableTableHashPrefix = enabled; - return this; - } - - /** - * @param enabled - Whether or not the installed instance of Rya will maintain a Free Text index. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setEnableFreeTextIndex(final boolean enabled) { - enableFreeTextIndex = enabled; - return this; - } - - /** - * @param enabled - Whether or not the installed instance of Rya will maintain a Geospatial index. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setEnableGeoIndex(final boolean enabled) { - enableGeoIndex = enabled; - return this; - } - - /** - * @param enabled - Whether or not the installed instance of Rya will maintain an Entity Centric index. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setEnableEntityCentricIndex(final boolean enabled) { - enableEntityCentricIndex = enabled; - return this; - } - - /** - * @param enabled - Whether or not the installed instance of Rya will maintain a Temporal index. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setEnableTemporalIndex(final boolean enabled) { - enableTemporalIndex = enabled; - return this; - } - - /** - * @param enabled - Whether or not the installed instance of Rya will maintain a PCJ index. - * @return This {@link Builder} so that method invocations may be chained. - */ - public Builder setEnablePcjIndex(final boolean enabled) { - enablePcjIndex = enabled; - return this; - } - - public Builder setFluoPcjAppName(@Nullable final String fluoPcjAppName) { - this.fluoPcjAppName = fluoPcjAppName; - return this; - } - - /** - * @return Builds an instance of {@link InstallConfiguration} using this builder's values. - */ - public InstallConfiguration build() { - return new InstallConfiguration( - enableTableHashPrefix, - enableFreeTextIndex, - enableGeoIndex, - enableEntityCentricIndex, - enableTemporalIndex, - enablePcjIndex, - Optional.fromNullable(fluoPcjAppName)); - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/client/InstanceDoesNotExistException.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/client/InstanceDoesNotExistException.java b/common/rya.api/src/main/java/mvm/rya/api/client/InstanceDoesNotExistException.java deleted file mode 100644 index c8cc0aa..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/client/InstanceDoesNotExistException.java +++ /dev/null @@ -1,38 +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 mvm.rya.api.client; - -import javax.annotation.ParametersAreNonnullByDefault; - -/** - * One of the {@link RyaClient} commands could not execute because the connected - * instance of Rya does not exist. - */ -@ParametersAreNonnullByDefault -public class InstanceDoesNotExistException extends RyaClientException { - private static final long serialVersionUID = 1L; - - public InstanceDoesNotExistException(final String message) { - super(message); - } - - public InstanceDoesNotExistException(final String message, final Throwable cause) { - super(message, cause); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/client/InstanceExists.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/client/InstanceExists.java b/common/rya.api/src/main/java/mvm/rya/api/client/InstanceExists.java deleted file mode 100644 index 6f26fc6..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/client/InstanceExists.java +++ /dev/null @@ -1,37 +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 mvm.rya.api.client; - -import javax.annotation.ParametersAreNonnullByDefault; - -/** - * Checks if an instance of Rya has been installed. - */ -@ParametersAreNonnullByDefault -public interface InstanceExists { - - /** - * Checks if an instance of Rya has been installed. - * - * @param instanceName - The name to check. (not null) - * @return {@code true} If an instance of Rya exists with the provided name; otherwise {@code false}. - * @throws RyaClientException Something caused the command to fail. - */ - public boolean exists(String instanceName) throws RyaClientException; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/client/ListInstances.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/client/ListInstances.java b/common/rya.api/src/main/java/mvm/rya/api/client/ListInstances.java deleted file mode 100644 index 5edfbc4..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/client/ListInstances.java +++ /dev/null @@ -1,38 +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 mvm.rya.api.client; - -import java.util.List; - -import javax.annotation.ParametersAreNonnullByDefault; - -/** - * List the names of the installed Rya instances. - */ -@ParametersAreNonnullByDefault -public interface ListInstances { - - /** - * List the names of the installed Rya instances. - * - * @return The names of the installed Rya Instances. - * @throws RyaClientException Something caused the command to fail. - */ - public List<String> listInstances() throws RyaClientException; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/client/PCJDoesNotExistException.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/client/PCJDoesNotExistException.java b/common/rya.api/src/main/java/mvm/rya/api/client/PCJDoesNotExistException.java deleted file mode 100644 index 89f095f..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/client/PCJDoesNotExistException.java +++ /dev/null @@ -1,38 +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 mvm.rya.api.client; - -import javax.annotation.ParametersAreNonnullByDefault; - -/** - * One of the {@link RyaClient} commands could not execute because the connected - * instance of Rya does not have a PCJ matching the provided PCJ ID. - */ -@ParametersAreNonnullByDefault -public class PCJDoesNotExistException extends RyaClientException { - private static final long serialVersionUID = 1L; - - public PCJDoesNotExistException(final String message) { - super(message); - } - - public PCJDoesNotExistException(final String message, final Throwable cause) { - super(message, cause); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/client/RyaClient.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/client/RyaClient.java b/common/rya.api/src/main/java/mvm/rya/api/client/RyaClient.java deleted file mode 100644 index 851a273..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/client/RyaClient.java +++ /dev/null @@ -1,112 +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 mvm.rya.api.client; - -import static java.util.Objects.requireNonNull; - -import javax.annotation.ParametersAreNonnullByDefault; -import javax.annotation.concurrent.Immutable; - -/** - * Provides access to a set of Rya functions. - */ -@Immutable -@ParametersAreNonnullByDefault -public class RyaClient { - // Administrative functions. - private final Install install; - private final CreatePCJ createPcj; - private final DeletePCJ deletePcj; - private final BatchUpdatePCJ batchUpdatePcj; - private final GetInstanceDetails getInstanceDetails; - private final InstanceExists instanceExists; - private final ListInstances listInstances; - - /** - * Constructs an instance of {@link RyaClient}. - */ - public RyaClient( - final Install install, - final CreatePCJ createPcj, - final DeletePCJ deletePcj, - final BatchUpdatePCJ batchUpdatePcj, - final GetInstanceDetails getInstanceDetails, - final InstanceExists instanceExists, - final ListInstances listInstances) { - this.install = requireNonNull(install); - this.createPcj = requireNonNull(createPcj); - this.deletePcj = requireNonNull(deletePcj); - this.batchUpdatePcj = requireNonNull(batchUpdatePcj); - this.getInstanceDetails = requireNonNull(getInstanceDetails); - this.instanceExists = requireNonNull(instanceExists); - this.listInstances = requireNonNull(listInstances); - } - - /** - * @return An instance of {@link Install} that is connected to a Rya storage. - */ - public Install getInstall() { - return install; - } - - /** - * @return An instance of {@link CreatePCJ} that is connected to a Rya storage - * if the Rya instance supports PCJ indexing. - */ - public CreatePCJ getCreatePCJ() { - return createPcj; - } - - /** - * @return An instance of {@link DeletePCJ} that is connected to a Rya storage - * if the Rya instance supports PCJ indexing. - */ - public DeletePCJ getDeletePCJ() { - return deletePcj; - } - - /** - * @return An instnace of {@link BatchUpdatePCJ} that is connected to a Rya storage - * if the Rya instance supports PCJ indexing. - */ - public BatchUpdatePCJ getBatchUpdatePCJ() { - return batchUpdatePcj; - } - - /** - * @return An instance of {@link GetInstanceDetails} that is connected to a Rya storage. - */ - public GetInstanceDetails getGetInstanceDetails() { - return getInstanceDetails; - } - - /** - * @return An instance of {@link ListInstances} that is connected to a Rya storage. - */ - public ListInstances getListInstances() { - return listInstances; - } - - /** - * @return An instance of {@link InstanceExists} that is connected to a Rya storage. - */ - public InstanceExists getInstanceExists() { - return instanceExists; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/client/RyaClientException.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/client/RyaClientException.java b/common/rya.api/src/main/java/mvm/rya/api/client/RyaClientException.java deleted file mode 100644 index 28c78aa..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/client/RyaClientException.java +++ /dev/null @@ -1,37 +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 mvm.rya.api.client; - -import javax.annotation.ParametersAreNonnullByDefault; - -/** - * One of the {@link RyaClient} functions failed. - */ -@ParametersAreNonnullByDefault -public class RyaClientException extends Exception { - private static final long serialVersionUID = 1L; - - public RyaClientException(final String message) { - super(message); - } - - public RyaClientException(final String message, final Throwable cause) { - super(message, cause); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/date/DateTimeTtlValueConverter.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/date/DateTimeTtlValueConverter.java b/common/rya.api/src/main/java/mvm/rya/api/date/DateTimeTtlValueConverter.java deleted file mode 100644 index 199b63d..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/date/DateTimeTtlValueConverter.java +++ /dev/null @@ -1,80 +0,0 @@ -package mvm.rya.api.date; - -/* - * 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. - */ - - - -import org.openrdf.model.Value; - -import javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.DatatypeFactory; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -/** - * Class DateTimeTtlValueConverter - * @deprecated 2 - */ -public class DateTimeTtlValueConverter implements TtlValueConverter { - - private Value start, stop; - private TimeZone timeZone = TimeZone.getTimeZone("Zulu"); - - @Override - public void convert(String ttl, String startTime) { - try { - long start_l, stop_l; - long ttl_l = Long.parseLong(ttl); - stop_l = System.currentTimeMillis(); - if (startTime != null) - stop_l = Long.parseLong(startTime); - start_l = stop_l - ttl_l; - - GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance(); - cal.setTimeZone(getTimeZone()); - cal.setTimeInMillis(start_l); - DatatypeFactory factory = DatatypeFactory.newInstance(); - start = vf.createLiteral(factory.newXMLGregorianCalendar(cal)); - - cal.setTimeInMillis(stop_l); - stop = vf.createLiteral(factory.newXMLGregorianCalendar(cal)); - } catch (DatatypeConfigurationException e) { - throw new RuntimeException("Exception occurred creating DataTypeFactory", e); - } - } - - @Override - public Value getStart() { - return start; - } - - @Override - public Value getStop() { - return stop; - } - - public TimeZone getTimeZone() { - return timeZone; - } - - public void setTimeZone(TimeZone timeZone) { - this.timeZone = timeZone; - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/date/TimestampTtlStrValueConverter.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/date/TimestampTtlStrValueConverter.java b/common/rya.api/src/main/java/mvm/rya/api/date/TimestampTtlStrValueConverter.java deleted file mode 100644 index de4ff8b..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/date/TimestampTtlStrValueConverter.java +++ /dev/null @@ -1,56 +0,0 @@ -package mvm.rya.api.date; - -/* - * 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. - */ - - - -import org.openrdf.model.Value; - -/** - * Class TimestampTtlValueConverter - * @deprecated - */ -public class TimestampTtlStrValueConverter implements TtlValueConverter { - - private Value start, stop; - - @Override - public void convert(String ttl, String startTime) { - long start_l, stop_l; - long ttl_l = Long.parseLong(ttl); - stop_l = System.currentTimeMillis(); - if (startTime != null) - stop_l = Long.parseLong(startTime); - start_l = stop_l - ttl_l; - - start = vf.createLiteral(start_l + ""); - stop = vf.createLiteral(stop_l + ""); - } - - @Override - public Value getStart() { - return start; - } - - @Override - public Value getStop() { - return stop; - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/date/TimestampTtlValueConverter.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/date/TimestampTtlValueConverter.java b/common/rya.api/src/main/java/mvm/rya/api/date/TimestampTtlValueConverter.java deleted file mode 100644 index 75366dc..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/date/TimestampTtlValueConverter.java +++ /dev/null @@ -1,56 +0,0 @@ -package mvm.rya.api.date; - -/* - * 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. - */ - - - -import org.openrdf.model.Value; - -/** - * Class TimestampTtlValueConverter - * @deprecated - */ -public class TimestampTtlValueConverter implements TtlValueConverter { - - private Value start, stop; - - @Override - public void convert(String ttl, String startTime) { - long start_l, stop_l; - long ttl_l = Long.parseLong(ttl); - stop_l = System.currentTimeMillis(); - if (startTime != null) - stop_l = Long.parseLong(startTime); - start_l = stop_l - ttl_l; - - start = vf.createLiteral(start_l); - stop = vf.createLiteral(stop_l); - } - - @Override - public Value getStart() { - return start; - } - - @Override - public Value getStop() { - return stop; - } -} http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/main/java/mvm/rya/api/date/TtlValueConverter.java ---------------------------------------------------------------------- diff --git a/common/rya.api/src/main/java/mvm/rya/api/date/TtlValueConverter.java b/common/rya.api/src/main/java/mvm/rya/api/date/TtlValueConverter.java deleted file mode 100644 index 1ba9841..0000000 --- a/common/rya.api/src/main/java/mvm/rya/api/date/TtlValueConverter.java +++ /dev/null @@ -1,41 +0,0 @@ -package mvm.rya.api.date; - -/* - * 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. - */ - - - -import org.openrdf.model.Value; -import org.openrdf.model.ValueFactory; -import org.openrdf.model.impl.ValueFactoryImpl; - -/** - * Class TtlValueConverter - * @deprecated - */ -public interface TtlValueConverter { - - ValueFactory vf = ValueFactoryImpl.getInstance(); - - public void convert(String ttl, String startTime); - - public Value getStart(); - - public Value getStop(); -}
