jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [17/51] [partial] jena git commit: Rename com.hp.hpl.jena.* as org.apache.jena.*
Date Thu, 23 Apr 2015 19:56:33 GMT
http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SPARQLParserRegistry.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SPARQLParserRegistry.java
b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SPARQLParserRegistry.java
deleted file mode 100644
index fd09981..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SPARQLParserRegistry.java
+++ /dev/null
@@ -1,145 +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 com.hp.hpl.jena.sparql.lang;
-
-import java.util.HashMap ;
-import java.util.Map ;
-
-import com.hp.hpl.jena.query.Syntax ;
-
-public class SPARQLParserRegistry
-{
-    // the map contains the registered factories hashed by the syntaxes
-    Map<Syntax, SPARQLParserFactory> factories = new HashMap<>() ;
-    
-    // Singleton
-    static SPARQLParserRegistry registry = null ;
-    static synchronized public SPARQLParserRegistry get()
-    {
-        if ( registry == null )
-            init() ;
-        return registry;
-    }
-    
-    private SPARQLParserRegistry() { }
-    
-    private static synchronized void init()
-    {
-        SPARQLParserRegistry reg = new SPARQLParserRegistry() ;
-        
-        reg.add(Syntax.syntaxSPARQL_10, 
-                new SPARQLParserFactory() {
-            @Override
-            public boolean accept( Syntax syntax ) { return Syntax.syntaxSPARQL_10.equals(syntax)
; } 
-            @Override
-            public SPARQLParser create( Syntax syntax ) { return new ParserSPARQL10() ; }
}) ;
-        
-        reg.add(Syntax.syntaxSPARQL_11, 
-                new SPARQLParserFactory() {
-            @Override
-            public boolean accept( Syntax syntax ) { return Syntax.syntaxSPARQL_11.equals(syntax)
; } 
-            @Override
-            public SPARQLParser create( Syntax syntax ) { return new ParserSPARQL11() ; }
}) ;
-   
-        reg.add(Syntax.syntaxARQ, 
-                new SPARQLParserFactory() {
-            @Override
-            public boolean accept(Syntax syntax ) { return Syntax.syntaxARQ.equals(syntax)
; } 
-            @Override
-            public SPARQLParser create ( Syntax syntax ) { return new ParserARQ() ; } })
;
-
-        // Defend against concurrent start up (even if not synchronised).
-        // Protects against, not fixes, the problem.
-        registry = reg ;
-    }
-    
-    /** Return a suitable factory for the given syntax
-     *
-     * @param syntax the syntax to be processed
-     * @return a parser factory or null if none accept the request
-     */
-    
-    public static SPARQLParserFactory findFactory(Syntax syntax)
-    { return get().getFactory(syntax) ; }
-    
-    /** Return a suitable parser for the given syntax
-     *
-     * @param syntax the syntax to be processed
-     * @return a parser or null if none accept the request
-     */
-    
-    public static SPARQLParser parser(Syntax syntax)
-    { return get().createParser(syntax) ; }
-    
-    /** Return a suitable parser factory for the given syntax
-     *
-     * @param syntax the syntax to be processed
-     * @return a parser factory or null if none accept the request
-     */
-    
-    public SPARQLParserFactory getFactory(Syntax syntax)
-    { return factories.get(syntax) ; }
-    
-    /** Return a suitable parser for the given syntax
-     *
-     * @param syntax the syntax to be processed
-     * @return a parser or null if none accept the request
-     */
-    
-    public SPARQLParser createParser(Syntax syntax)
-    {
-        SPARQLParserFactory f = getFactory(syntax) ;
-        return ( f != null ) ? f.create(syntax) : null ;
-    }
-    
-    /** Register the given parser factory for the specified syntax.
-     *  If another factory is registered for the syntax it is replaced by the
-     *  given one.
-     */
-    public static void addFactory(Syntax syntax, SPARQLParserFactory f)
-    { get().add(syntax, f) ; }
-    
-    /** Register the given parser factory for the specified syntax.
-     *  If another factory is registered for the syntax it is replaced by the
-     *  given one.
-     */
-    public void add(Syntax syntax, SPARQLParserFactory f)
-    {
-        if ( ! f.accept(syntax) )
-            throw new IllegalArgumentException( "The given parser factory does not accept
the specified syntax." );
-        factories.put(syntax, f) ;
-    }
-    
-    /** Unregister the parser factory associated with the given syntax */
-    public static void removeFactory(Syntax syntax)
-    { get().remove(syntax) ; }
-    
-    /** Unregister the parser factory associated with the given syntax */
-    public void remove(Syntax syntax)
-    { factories.remove(syntax) ; }
-    
-    /** Checks whether a parser factory is registered for the given syntax */
-    public static boolean containsParserFactory(Syntax syntax)
-    { return get().containsFactory(syntax) ; }
-    
-    /** Checks whether a parser factory is registered for the given syntax */
-    public boolean containsFactory(Syntax syntax)
-    { return factories.containsKey(syntax) ; }
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SyntaxVarScope.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SyntaxVarScope.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SyntaxVarScope.java
deleted file mode 100644
index 75f3653..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SyntaxVarScope.java
+++ /dev/null
@@ -1,311 +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 com.hp.hpl.jena.sparql.lang;
-
-import java.util.* ;
-
-import com.hp.hpl.jena.query.ARQ ;
-import com.hp.hpl.jena.query.Query ;
-import com.hp.hpl.jena.query.QueryParseException ;
-import com.hp.hpl.jena.query.Syntax ;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.core.VarExprList ;
-import com.hp.hpl.jena.sparql.expr.Expr ;
-import com.hp.hpl.jena.sparql.syntax.* ;
-
-/** Calculate in-scope variables from the AST */ 
-public class SyntaxVarScope
-{
-    /* SPARQL 1.1 "in scope" rules
-       These define the variables from a pattern that are in-scope
-       These are not the usage rules.
-         
-    Syntax Form                                     In-scope variables
-    
-    Basic Graph Pattern (BGP)                       v occurs in the BGP
-    Path                                            v occurs in the path
-    Group { P1 P2 ... }                             v is in-scope if in-scope in one or more
of P1, P2, ...
-    GRAPH term { P }                                v is term or v is in-scope in P
-    { P1 } UNION { P2 }                             v is in-scope in P1 or in-scope in P2
-    OPTIONAL {P}                                    v is in-scope in P
-    SERVICE term {P}                                v is term or v is in-scope in P
-    (expr AS v) for BIND, SELECT and GROUP BY       v is in-scope
-    SELECT ..v .. { P }                             v is in-scope if v is mentioned as a
project variable
-    SELECT * { P }                                  v is in-scope in P
-    VALUES var     (values)                         v is in-scope if v is in varlist
-    VALUES varlist (values)                         v is in-scope if v is in varlist
-     */
-    
-    // Weakness : EXISTS inside FILTERs?
-
-    public static void check(Query query)
-    {
-        if ( query.getQueryPattern() == null )
-            // DESCRIBE may not have a pattern
-            return ;
-        
-        checkSubQuery(query.getQueryPattern()) ;
-        checkBind(query) ;
-        // Check this level.
-        checkQueryScope(query) ;
-    
-        // Other checks.
-        Collection<Var> vars = varsOfQuery(query) ;
-        check(query, vars) ;
-    }
-
-    // Check BIND by accumulating variables and making sure BIND does not attempt to reuse
one  
-    private static void checkBind(Query query)
-    {
-        BindScopeChecker v = new BindScopeChecker() ;
-        ElementWalker.walk(query.getQueryPattern(), v) ;
-    }
-    
-    // Check subquery by finding subquries and recurisively checking.
-    // Includes appling all checks to nested subqueries.
-    private static void checkSubQuery(Element el)
-    {
-        ElementVisitor v = new SubQueryScopeChecker() ;
-        ElementWalker.walk(el, v) ;
-    }
-    
-    // Check one level of query - SELECT expressions
-    private static void checkQueryScope(Query query)
-    {
-        Collection<Var> vars = varsOfQuery(query) ;
-        checkExprListAssignment(vars, query.getProject()) ;
-    }
-    
-    // get all vars of a query
-    private static Collection<Var> varsOfQuery(Query query)
-    {
-        Collection<Var> vars = PatternVars.vars(query.getQueryPattern()) ;
-        if ( query.hasValues() )
-            vars.addAll(query.getValuesVariables()) ;
-        return vars ;
-    }
-    
-    // Other check (not scoping at this level) of a query
-    private static void check(Query query, Collection<Var> vars)
-    {
-        // Check any expressions are assigned to fresh variables.
-        checkExprListAssignment(vars, query.getProject()) ;
-        
-        // Check for SELECT * GROUP BY
-        // Legal in ARQ, not in SPARQL 1.1
-        if ( ! Syntax.syntaxARQ.equals(query.getSyntax()) )
-        {
-            if ( query.isQueryResultStar() && query.hasGroupBy() )
-                throw new QueryParseException("SELECT * not legal with GROUP BY", -1 , -1)
;
-        }
-        
-        // Check any variable in an expression is in scope (if GROUP BY) 
-        checkExprVarUse(query) ;
-        
-        // Check GROUP BY AS 
-        // ENABLE
-        if ( false && query.hasGroupBy() )
-        {
-            VarExprList exprList2 = query.getGroupBy() ;
-            checkExprListAssignment(vars, exprList2) ;
-        // CHECK 
-        }
-        
-    }
-    
-    private static void checkExprListAssignment(Collection<Var> vars, VarExprList exprList)
-    {
-        Set<Var> vars2 = new LinkedHashSet<>(vars) ;
-
-        for ( Var v : exprList.getVars() )
-        {
-            // In scope?
-            Expr e = exprList.getExpr( v );
-            checkAssignment( vars2, e, v );
-            vars2.add( v );
-        }
-    }
-    
-    private static void checkExprVarUse(Query query)
-    {
-        if ( query.hasGroupBy() )
-        {
-            VarExprList groupKey = query.getGroupBy() ;
-            
-            // Copy - we need to add variables
-            // SELECT (count(*) AS ?C)  (?C+1 as ?D) 
-            List<Var> inScopeVars = new ArrayList<>(groupKey.getVars()) ;
-            VarExprList exprList = query.getProject() ;
-
-            for ( Var v : exprList.getVars() )
-            {
-                // In scope?
-                Expr e = exprList.getExpr( v );
-                if ( e == null )
-                {
-                    if ( !inScopeVars.contains( v ) )
-                    {
-                        throw new QueryParseException( "Non-group key variable in SELECT:
" + v, -1, -1 );
-                    }
-                }
-                else
-                {
-                    Set<Var> eVars = e.getVarsMentioned();
-                    for ( Var v2 : eVars )
-                    {
-                        if ( !inScopeVars.contains( v2 ) )
-                        {
-                            throw new QueryParseException(
-                                "Non-group key variable in SELECT: " + v2 + " in expression
" + e, -1, -1 );
-                        }
-                    }
-                }
-                inScopeVars.add( v );
-            }
-        }
-    }
-    
-    private static void checkAssignment(Collection<Var> scope, Expr expr, Var var)
-    {
-        // Project SELECT ?x
-        if ( expr == null )
-            return ;
-        
-        // expr not null
-        if ( scope.contains(var) ) 
-            throw new QueryParseException("Variable used when already in-scope: "+var+" in
"+fmtAssignment(expr, var), -1 , -1) ;
-
-        // test for impossible variables - bound() is a bit odd.
-        if ( false )
-        {
-            Set<Var> vars = expr.getVarsMentioned() ;
-            for ( Var v : vars )
-            {
-                if ( !scope.contains(v) )
-                    throw new QueryParseException("Variable used in expression is not in-scope:
"+v+" in "+expr, -1 , -1) ;
-            }
-        }
-    }
-    
-    private static String fmtExprList(VarExprList exprList)
-    {
-        StringBuilder sb = new StringBuilder() ;
-        boolean first = true ;
-        for ( Var v : exprList.getVars() )
-        {
-            Expr e = exprList.getExpr( v );
-            if ( !first )
-            {
-                sb.append( " " );
-            }
-            first = false;
-            sb.append( "(" ).append( e ).append( " AS " ).append( v ).append( ")" );
-        }
-        return sb.toString() ;
-    }
-    
-    private static String fmtAssignment(Expr expr, Var var)
-    {
-        return "("+expr+" AS "+var+")" ;
-    }
-
-    // Modifed walked for variables.
-    
-    /** Visitor for subqueries scope rules . */
-    private static class SubQueryScopeChecker extends ElementVisitorBase
-    {
-        @Override
-        public void visit(ElementSubQuery el)
-        {
-            Query query = el.getQuery() ;
-            checkQueryScope(query) ;
-            // Recursively check sub-queries in sub-queries.
-            check(el.getQuery()) ;
-        }
-    }
-
-    // Applies scope rules at each point it matters.
-    // Does some recalculation in nested structures.
-    
-    public static class BindScopeChecker extends ElementVisitorBase
-    {
-        public BindScopeChecker() {}
-        
-        @Override
-        public void visit(ElementGroup el)
-        {
-            // BIND scope rules
-            // (and service warning)
-            
-            for ( int i = 0 ; i < el.getElements().size() ; i++ )
-            {
-                Element e = el.getElements().get(i) ;
-                // Tests.
-                if ( e instanceof ElementBind )
-                {
-                    Collection<Var> accScope = calcScopeAll(el.getElements(), i) ;
-                    check(accScope, (ElementBind)e) ;
-                }
-                
-                if ( e instanceof ElementService )
-                {
-                    Collection<Var> accScope = calcScopeAll(el.getElements(), i) ;
-                    check(accScope, (ElementService)e) ;
-                }
-            }
-        }
-        
-        private static Collection<Var> calcScopeAll(List<Element> elements, int
idx)
-        {
-            return calcScope(elements, 0, idx) ;
-        }
-
-        /** Calculate scope, working forwards */
-        private static Collection<Var> calcScope(List<Element> elements, int
start, int finish)
-        {
-            Collection<Var> accScope = new HashSet<>() ;
-            for ( int i = start ; i < finish ; i++ )
-            {
-                Element e = elements.get(i) ;
-                PatternVars.vars(accScope, e) ;
-            }
-            return accScope ;
-        }
-
-        // Inside filters.
-        
-        private static void check(Collection<Var> scope, ElementBind el)
-        {
-            Var var = el.getVar() ;
-            if ( scope.contains(var) ) 
-                throw new QueryParseException("BIND: Variable used when already in-scope:
"+var+" in "+el, -1 , -1) ;
-            checkAssignment(scope, el.getExpr(), var) ;
-        }
-        
-        private static void check(Collection<Var> scope, ElementService el)
-        {
-            if ( ARQ.isStrictMode() && el.getServiceNode().isVariable() )
-            {
-                Var var = Var.alloc(el.getServiceNode()) ;
-                if ( ! scope.contains(var) ) 
-                    throw new QueryParseException("SERVICE: Variable not already in-scope:
"+var+" in "+el, -1 , -1) ;
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParser.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParser.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParser.java
deleted file mode 100644
index cb1fefb..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParser.java
+++ /dev/null
@@ -1,62 +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 com.hp.hpl.jena.sparql.lang;
-
-import java.io.InputStream ;
-import java.io.Reader ;
-
-import com.hp.hpl.jena.query.QueryParseException ;
-import com.hp.hpl.jena.query.Syntax ;
-import com.hp.hpl.jena.sparql.modify.UpdateSink ;
-import com.hp.hpl.jena.util.FileUtils ;
-
-/** This class provides the root of lower level access to all the parsers.
- *  Each subclass hides the details of the per-language exception handlers and other
- *  javacc details to provide a methods that deal with setting up Query objects
- *  and using QueryException exceptions for problems.    
- */
-
-public abstract class UpdateParser
-{
-    public final void parse(UpdateSink sink, String updateString) throws QueryParseException
-    {
-        parse$(sink, updateString) ;
-    }
-
-    protected abstract void parse$(UpdateSink sink, String updateString) throws QueryParseException
;
-
-    public final void parse(UpdateSink sink, InputStream input) throws QueryParseException
-    {
-        // BOM processing moved to the grammar.
-        Reader r = FileUtils.asBufferedUTF8(input) ;
-        parse$(sink, r) ;
-    }
-    
-    protected abstract void parse$(UpdateSink sink, Reader r) throws QueryParseException
;
-
-    public static boolean canParse(Syntax syntaxURI)
-    {
-        return UpdateParserRegistry.get().containsFactory(syntaxURI) ;
-    }
-    
-    public static UpdateParser createParser(Syntax syntaxURI)
-    {
-        return UpdateParserRegistry.get().createParser(syntaxURI) ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParserFactory.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParserFactory.java b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParserFactory.java
deleted file mode 100644
index 8898fa7..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParserFactory.java
+++ /dev/null
@@ -1,30 +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 com.hp.hpl.jena.sparql.lang;
-
-import com.hp.hpl.jena.query.Syntax ;
-
-public interface UpdateParserFactory
-{
-    /** Return true if this factory can create a parser for the given syntax */
-    public boolean accept ( Syntax syntax );
-    
-    /** Return a parser for the given syntax */
-    public UpdateParser create ( Syntax syntax );
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/56534eac/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParserRegistry.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParserRegistry.java
b/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParserRegistry.java
deleted file mode 100644
index fa7dfaa..0000000
--- a/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParserRegistry.java
+++ /dev/null
@@ -1,136 +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 com.hp.hpl.jena.sparql.lang;
-
-import java.util.HashMap ;
-import java.util.Map ;
-
-import com.hp.hpl.jena.query.Syntax ;
-
-public class UpdateParserRegistry
-{
-    // the map contains the registered factories hashed by the syntaxes
-    Map<Syntax, UpdateParserFactory> factories = new HashMap<>() ;
-    
-    // Singleton
-    static UpdateParserRegistry registry = null ;
-    static synchronized public UpdateParserRegistry get()
-    {
-        if ( registry == null )
-            init() ;
-        return registry;
-    }
-    
-    private UpdateParserRegistry() { }
-    
-    private static synchronized void init()
-    {
-        UpdateParserRegistry reg = new UpdateParserRegistry() ;
-        
-        reg.add(Syntax.syntaxSPARQL_11, 
-                new UpdateParserFactory() {
-            @Override
-            public boolean accept( Syntax syntax ) { return Syntax.syntaxSPARQL_11.equals(syntax)
; } 
-            @Override
-            public UpdateParser create( Syntax syntax ) { return new ParserSPARQL11Update()
; } }) ;
-   
-        reg.add(Syntax.syntaxARQ, 
-                new UpdateParserFactory() {
-            @Override
-            public boolean accept(Syntax syntax ) { return Syntax.syntaxARQ.equals(syntax)
; } 
-            @Override
-            public UpdateParser create ( Syntax syntax ) { return new ParserARQUpdate() ;
} }) ;
-        
-        registry = reg ;
-    }
-    
-    /** Return a suitable factory for the given syntax
-     *
-     * @param syntax the syntax to be processed
-     * @return a parser factory or null if none accept the request
-     */
-    
-    public static UpdateParserFactory findFactory(Syntax syntax)
-    { return get().getFactory(syntax) ; }
-    
-    /** Return a suitable parser for the given syntax
-     *
-     * @param syntax the syntax to be processed
-     * @return a parser or null if none accept the request
-     */
-    
-    public static UpdateParser parser(Syntax syntax)
-    { return get().createParser(syntax) ; }
-    
-    /** Return a suitable parser factory for the given syntax
-     *
-     * @param syntax the syntax to be processed
-     * @return a parser factory or null if none accept the request
-     */
-    
-    public UpdateParserFactory getFactory(Syntax syntax)
-    { return factories.get(syntax) ; }
-    
-    /** Return a suitable parser for the given syntax
-     *
-     * @param syntax the syntax to be processed
-     * @return a parser or null if none accept the request
-     */
-    
-    public UpdateParser createParser(Syntax syntax)
-    {
-        UpdateParserFactory f = getFactory(syntax) ;
-        return ( f != null ) ? f.create(syntax) : null ;
-    }
-    
-    /** Register the given parser factory for the specified syntax.
-     *  If another factory is registered for the syntax it is replaced by the
-     *  given one.
-     */
-    public static void addFactory(Syntax syntax, UpdateParserFactory f)
-    { get().add(syntax, f) ; }
-    
-    /** Register the given parser factory for the specified syntax.
-     *  If another factory is registered for the syntax it is replaced by the
-     *  given one.
-     */
-    public void add(Syntax syntax, UpdateParserFactory f)
-    {
-        if ( ! f.accept(syntax) )
-            throw new IllegalArgumentException( "The given parser factory does not accept
the specified syntax." );
-        factories.put(syntax, f) ;
-    }
-    
-    /** Unregister the parser factory associated with the given syntax */
-    public static void removeFactory(Syntax syntax)
-    { get().remove(syntax) ; }
-    
-    /** Unregister the parser factory associated with the given syntax */
-    public void remove(Syntax syntax)
-    { factories.remove(syntax) ; }
-    
-    /** Checks whether a parser factory is registered for the given syntax */
-    public static boolean containsParserFactory(Syntax syntax)
-    { return get().containsFactory(syntax) ; }
-    
-    /** Checks whether a parser factory is registered for the given syntax */
-    public boolean containsFactory(Syntax syntax)
-    { return factories.containsKey(syntax) ; }
-
-}


Mime
View raw message