You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2014/12/05 16:36:22 UTC
[13/50] [abbrv] marmotta git commit: remove utility classes whose
functionality is now provided by other libraries
remove utility classes whose functionality is now provided by other libraries
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/9eed4763
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/9eed4763
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/9eed4763
Branch: refs/heads/master
Commit: 9eed476383fc6e2071cd51d157c18db8575f5796
Parents: 807f371
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Tue Nov 11 16:49:30 2014 +0100
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Tue Nov 11 16:49:30 2014 +0100
----------------------------------------------------------------------
.../commons/collections/CollectionUtils.java | 150 --
.../marmotta/commons/constants/Namespace.java | 2142 ------------------
.../kiwi/sparql/builder/SQLBuilder.java | 4 +-
.../builder/eval/ValueExpressionEvaluator.java | 4 +-
.../services/provider/AbstractHttpProvider.java | 15 +-
.../provider/ldap/LdapFoafProvider.java | 18 +-
.../ldap/mapping/LiteralPredicateFactory.java | 9 +-
.../ldap/mapping/PredicateObjectFactory.java | 10 +-
.../mapping/TypedLiteralPredicateFactory.java | 47 -
.../ldap/mapping/UriPredicateFactory.java | 9 +-
.../core/model/module/ModuleConfiguration.java | 6 +-
.../webservices/resource/MetaWebService.java | 5 +-
.../security/model/SecurityConstraint.java | 36 +-
.../webservices/MementoWebService.java | 8 +-
14 files changed, 70 insertions(+), 2393 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/9eed4763/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/collections/CollectionUtils.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/collections/CollectionUtils.java b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/collections/CollectionUtils.java
deleted file mode 100644
index 82064e5..0000000
--- a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/collections/CollectionUtils.java
+++ /dev/null
@@ -1,150 +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.marmotta.commons.collections;
-
-import java.text.Format;
-import java.util.*;
-
-/**
- * This class contains static helper methods for supporting java collections
- * in Java 5.
- *
- * @author Sebastian Schaffert
- */
-public class CollectionUtils {
-
- /**
- * Convert any iterable into a list
- * @param <T>
- * @param iterable
- * @return
- */
- @SuppressWarnings("unchecked")
- public static <T> List<T> toList(Iterable<T> iterable) {
- return toCollection(LinkedList.class,iterable);
- }
-
- /**
- * Convert any iterable into a set
- * @param <T>
- * @param iterable
- * @return
- */
- @SuppressWarnings("unchecked")
- public static <T> Set<T> toSet(Iterable<T> iterable) {
- return toCollection(HashSet.class,iterable);
- }
-
- private static <C extends Collection<T>,T> C toCollection(Class<C> cls, Iterable<T> iterable) {
- try {
- C result = cls.newInstance();
-
- for(T item : iterable) {
- result.add(item);
- }
-
- return result;
- } catch(InstantiationException ex) {
- return null;
- } catch(IllegalAccessException ex) {
- return null;
- }
- }
-
- public static <T> T first(Iterable<T> iterable) {
- return iterable.iterator().next();
- }
-
- public static <T> String fold(T[] elements, String separator) {
- StringBuilder builder = new StringBuilder();
- for(int i=0; i<elements.length; i++) {
- builder.append(elements[i].toString());
- if(i < elements.length-1) {
- builder.append(separator);
- }
- }
- return builder.toString();
- }
-
-
- public static <T> String fold(Collection<T> elements, String separator) {
- StringBuilder builder = new StringBuilder();
- ArrayList<T> list = new ArrayList<T>(elements);
- for(int i=0; i<list.size(); i++) {
- builder.append(list.get(i).toString());
- if(i < list.size()-1) {
- builder.append(separator);
- }
- }
- return builder.toString();
- }
-
-
- public static <T> String fold(Collection<T> elements, Format format, String separator) {
- StringBuilder builder = new StringBuilder();
- ArrayList<T> list = new ArrayList<T>(elements);
- for(int i=0; i<list.size(); i++) {
- builder.append(format.format(list.get(i)));
- if(i < list.size()-1) {
- builder.append(separator);
- }
- }
- return builder.toString();
- }
-
- public static <T> String fold(Collection<T> elements, StringSerializer<T> format, String separator) {
- StringBuilder builder = new StringBuilder();
- ArrayList<T> list = new ArrayList<T>(elements);
- for(int i=0; i<list.size(); i++) {
- builder.append(format.serialize(list.get(i)));
- if(i < list.size()-1) {
- builder.append(separator);
- }
- }
- return builder.toString();
- }
-
-
- /**
- * Concatenate the collection of lists passed as argument into a new array list.
- * @param lists
- * @param <T>
- * @return
- */
- public static <T> List<T> concat(Collection<? extends Collection<T>> lists) {
- int size = 0;
- for(Collection<T> list : lists) {
- size += list.size();
- }
- List<T> result = new ArrayList<T>(size);
- for(Collection<T> list : lists) {
- result.addAll(list);
- }
- return result;
- }
-
- /**
- * Allows a custom serialization of objects of type T to a string.
- *
- * @param <T> the object type to serialize as string
- */
- public interface StringSerializer<T> {
- public String serialize(T t);
- }
-
-}