Repository: marmotta Updated Branches: refs/heads/develop 1d58fa6cb -> 5d94ae2ef
towards MARMOTTA-543 (modular function support): - implemented service registry for native functions Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/dc4cdddb Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/dc4cdddb Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/dc4cdddb Branch: refs/heads/develop Commit: dc4cdddb2bc341cb6f4182a930dffd3095c90b80 Parents: 1d58fa6 Author: Sebastian Schaffert <[email protected]> Authored: Fri Sep 19 17:16:34 2014 +0200 Committer: Sebastian Schaffert <[email protected]> Committed: Fri Sep 19 17:16:34 2014 +0200 ---------------------------------------------------------------------- .../sparql/function/NativeFunctionRegistry.java | 53 ++++++++++++++++++++ 1 file changed, 53 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/dc4cdddb/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/NativeFunctionRegistry.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/NativeFunctionRegistry.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/NativeFunctionRegistry.java new file mode 100644 index 0000000..cb57f61 --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/NativeFunctionRegistry.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.marmotta.kiwi.sparql.function; + +import info.aduna.lang.service.ServiceRegistry; + +/** + * Registry for natively supported functions + * + * @author Sebastian Schaffert ([email protected]) + */ +public class NativeFunctionRegistry extends ServiceRegistry<String,NativeFunction> { + + private static NativeFunctionRegistry defaultRegistry; + + /** + * Gets the default FunctionRegistry. + * + * @return The default registry. + */ + public static synchronized NativeFunctionRegistry getInstance() { + if (defaultRegistry == null) { + defaultRegistry = new NativeFunctionRegistry(); + } + + return defaultRegistry; + } + + public NativeFunctionRegistry() { + super(NativeFunction.class); + } + + @Override + protected String getKey(NativeFunction function) + { + return function.getURI(); + } +}
