Repository: zest-java Updated Branches: refs/heads/develop 4dabe5781 -> 8a6ddd2e3
ZEST-134, Remove Dataset feature that was never fully implemented. Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/8a6ddd2e Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/8a6ddd2e Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/8a6ddd2e Branch: refs/heads/develop Commit: 8a6ddd2e314db2ea73e064db6691ca69a673198d Parents: 4dabe57 Author: Niclas Hedhman <[email protected]> Authored: Wed Dec 16 15:39:41 2015 +0800 Committer: Niclas Hedhman <[email protected]> Committed: Wed Dec 16 15:39:41 2015 +0800 ---------------------------------------------------------------------- .../org/apache/zest/api/dataset/DataSet.java | 36 ------ .../apache/zest/api/dataset/DataSetSource.java | 27 ---- .../java/org/apache/zest/api/dataset/Query.java | 64 ---------- .../api/dataset/iterable/IterableDataSet.java | 57 --------- .../api/dataset/iterable/IterableQuery.java | 127 ------------------- .../zest/api/dataset/iterable/package.html | 21 --- .../org/apache/zest/api/dataset/package.html | 21 --- .../dataset/iterable/IterableDataSetTest.java | 61 --------- 8 files changed, 414 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/8a6ddd2e/core/api/src/main/java/org/apache/zest/api/dataset/DataSet.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/dataset/DataSet.java b/core/api/src/main/java/org/apache/zest/api/dataset/DataSet.java deleted file mode 100644 index 960cd39..0000000 --- a/core/api/src/main/java/org/apache/zest/api/dataset/DataSet.java +++ /dev/null @@ -1,36 +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.zest.api.dataset; - -import java.util.function.Function; -import java.util.function.Predicate; - -/** - * definition.constrain(entity(Person.class)) - * builder.from(path(Person.class,Movie.)) - * TODO - */ -public interface DataSet<T> -{ - DataSet<T> constrain( Predicate<T> selection ); - - <U> DataSet<U> project( Function<T, U> conversion ); - - Query<T> newQuery(); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/8a6ddd2e/core/api/src/main/java/org/apache/zest/api/dataset/DataSetSource.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/dataset/DataSetSource.java b/core/api/src/main/java/org/apache/zest/api/dataset/DataSetSource.java deleted file mode 100644 index ef99c08..0000000 --- a/core/api/src/main/java/org/apache/zest/api/dataset/DataSetSource.java +++ /dev/null @@ -1,27 +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.zest.api.dataset; - -/** - * TODO - */ -public interface DataSetSource -{ - <T> DataSet<T> newDataSet( Class<T> type ); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/8a6ddd2e/core/api/src/main/java/org/apache/zest/api/dataset/Query.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/dataset/Query.java b/core/api/src/main/java/org/apache/zest/api/dataset/Query.java deleted file mode 100644 index b5124cb..0000000 --- a/core/api/src/main/java/org/apache/zest/api/dataset/Query.java +++ /dev/null @@ -1,64 +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.zest.api.dataset; - -import java.util.function.Predicate; -import org.apache.zest.api.property.Property; -import org.apache.zest.api.query.QueryException; -import org.apache.zest.api.query.QueryExecutionException; -import org.apache.zest.functional.Visitor; - -/** - * TODO - */ -public interface Query<T> -{ - public enum Order - { - ASCENDING, DESCENDING - } - - Query filter( Predicate<T> filter ); - - Query orderBy( final Property<?> property, final Order order ); - - Query skip( int skipNrOfResults ); - - Query limit( int maxNrOfResults ); - - // Variables - Query<T> setVariable( String name, Object value ); - - Object getVariable( String name ); - - long count() - throws QueryExecutionException; - - T first() - throws QueryExecutionException; - - T single() - throws QueryException; - - <ThrowableType extends Throwable> boolean execute( Visitor<T, ThrowableType> resultVisitor ) - throws ThrowableType, QueryExecutionException; - - Iterable<T> toIterable() - throws QueryExecutionException; -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/8a6ddd2e/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableDataSet.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableDataSet.java b/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableDataSet.java deleted file mode 100644 index be2ddf4..0000000 --- a/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableDataSet.java +++ /dev/null @@ -1,57 +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.zest.api.dataset.iterable; - -import java.util.function.Function; -import java.util.function.Predicate; -import org.apache.zest.api.dataset.DataSet; -import org.apache.zest.api.dataset.Query; -import org.apache.zest.functional.Iterables; - -/** - * TODO - */ -public class IterableDataSet<T> - implements DataSet<T> -{ - private Iterable<T> iterable; - - public IterableDataSet( Iterable<T> iterable ) - { - this.iterable = iterable; - } - - @Override - public DataSet<T> constrain( Predicate<T> selection ) - { - return new IterableDataSet<T>( Iterables.filter( selection, iterable ) ); - } - - @Override - public <U> DataSet<U> project( Function<T, U> conversion ) - { - return new IterableDataSet<U>( Iterables.map( conversion, iterable ) ); - } - - @Override - public Query<T> newQuery() - { - return new IterableQuery<T>( iterable ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/8a6ddd2e/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableQuery.java ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableQuery.java b/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableQuery.java deleted file mode 100644 index 7476500..0000000 --- a/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableQuery.java +++ /dev/null @@ -1,127 +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.zest.api.dataset.iterable; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Predicate; -import org.apache.zest.api.dataset.Query; -import org.apache.zest.api.property.Property; -import org.apache.zest.api.query.QueryException; -import org.apache.zest.functional.Iterables; -import org.apache.zest.functional.Visitor; - -/** - * TODO - */ -public class IterableQuery<T> implements Query<T> -{ - private Iterable<T> iterable; - private int skip; - private int limit; - private Map<String, Object> variables = new HashMap<String, Object>(); - - public IterableQuery( Iterable<T> iterable ) - { - this.iterable = iterable; - } - - @Override - public Query filter( Predicate<T> filter ) - { - iterable = Iterables.filter( filter, iterable ); - - return this; - } - - @Override - public Query orderBy( Property<?> property, Order order ) - { - return this; - } - - @Override - public Query skip( int skipNrOfResults ) - { - this.skip = skipNrOfResults; - - return this; - } - - @Override - public Query limit( int maxNrOfResults ) - { - this.limit = maxNrOfResults; - return this; - } - - @Override - public Query<T> setVariable( String name, Object value ) - { - variables.put( name, value ); - return this; - } - - @Override - public Object getVariable( String name ) - { - return variables.get( name ); - } - - @Override - public long count() - { - return Iterables.count( Iterables.limit( limit, Iterables.skip( skip, iterable ) ) ); - } - - @Override - public T first() - { - return Iterables.first( Iterables.limit( limit, Iterables.skip( skip, iterable ) ) ); - } - - @Override - public T single() - throws QueryException - { - return Iterables.single( Iterables.limit( limit, Iterables.skip( skip, iterable ) ) ); - } - - @Override - public <ThrowableType extends Throwable> boolean execute( Visitor<T, ThrowableType> resultVisitor ) - throws ThrowableType - { - for( T t : toIterable() ) - { - if( !resultVisitor.visit( t ) ) - { - return false; - } - } - - return true; - } - - @Override - public Iterable<T> toIterable() - throws QueryException - { - return Iterables.limit( limit, Iterables.skip( skip, iterable ) ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/8a6ddd2e/core/api/src/main/java/org/apache/zest/api/dataset/iterable/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/dataset/iterable/package.html b/core/api/src/main/java/org/apache/zest/api/dataset/iterable/package.html deleted file mode 100644 index 9874cb5..0000000 --- a/core/api/src/main/java/org/apache/zest/api/dataset/iterable/package.html +++ /dev/null @@ -1,21 +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. ---> -<html> - <body> - <h2>Iterable DataSets.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/8a6ddd2e/core/api/src/main/java/org/apache/zest/api/dataset/package.html ---------------------------------------------------------------------- diff --git a/core/api/src/main/java/org/apache/zest/api/dataset/package.html b/core/api/src/main/java/org/apache/zest/api/dataset/package.html deleted file mode 100644 index f324682..0000000 --- a/core/api/src/main/java/org/apache/zest/api/dataset/package.html +++ /dev/null @@ -1,21 +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. ---> -<html> - <body> - <h2>DataSet API.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/8a6ddd2e/core/api/src/test/java/org/apache/zest/api/dataset/iterable/IterableDataSetTest.java ---------------------------------------------------------------------- diff --git a/core/api/src/test/java/org/apache/zest/api/dataset/iterable/IterableDataSetTest.java b/core/api/src/test/java/org/apache/zest/api/dataset/iterable/IterableDataSetTest.java deleted file mode 100644 index 675a05e..0000000 --- a/core/api/src/test/java/org/apache/zest/api/dataset/iterable/IterableDataSetTest.java +++ /dev/null @@ -1,61 +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.zest.api.dataset.iterable; - -import org.junit.Before; -import org.junit.Ignore; -import org.apache.zest.api.dataset.DataSet; -import org.apache.zest.api.property.Property; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.functional.Iterables; -import org.apache.zest.test.AbstractZestTest; - -/** - * TODO - */ -@Ignore( "Not implemented yet" ) -public class IterableDataSetTest - extends AbstractZestTest -{ - DataSet<TestValue> dataSet; - - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.values( TestValue.class ); - } - - @Before - public void setUp() - { - dataSet = new IterableDataSet<TestValue>( Iterables.iterable( newTestValue( "Rickard" ), newTestValue( "Niclas" ), newTestValue( "Paul" ) ) ); - } - - private TestValue newTestValue( String name ) - { - return module.newValueFromSerializedState( TestValue.class, "{name:'" + name + "'}" ); - } - - interface TestValue - { - Property<String> name(); - } -}
