From: <mrp...@us...> - 2011-11-21 15:15:21
|
Revision: 5710 http://bigdata.svn.sourceforge.net/bigdata/?rev=5710&view=rev Author: mrpersonick Date: 2011-11-21 15:15:15 +0000 (Mon, 21 Nov 2011) Log Message: ----------- made the default extension factory a bit more extensible Modified Paths: -------------- branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/BSBMExtensionFactory.java branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/DefaultExtensionFactory.java Modified: branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/BSBMExtensionFactory.java =================================================================== --- branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/BSBMExtensionFactory.java 2011-11-21 15:10:13 UTC (rev 5709) +++ branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/BSBMExtensionFactory.java 2011-11-21 15:15:15 UTC (rev 5710) @@ -28,12 +28,8 @@ package com.bigdata.rdf.internal; import java.util.Collection; -import java.util.LinkedList; -import com.bigdata.rdf.internal.impl.extensions.DateTimeExtension; -import com.bigdata.rdf.internal.impl.extensions.DerivedNumericsExtension; import com.bigdata.rdf.internal.impl.extensions.USDFloatExtension; -import com.bigdata.rdf.internal.impl.extensions.XSDStringExtension; import com.bigdata.rdf.lexicon.LexiconRelation; import com.bigdata.rdf.model.BigdataLiteral; @@ -45,54 +41,14 @@ * @author <a href="mailto:tho...@us...">Bryan Thompson</a> * @version $Id$ */ -public class BSBMExtensionFactory implements IExtensionFactory { +public class BSBMExtensionFactory extends DefaultExtensionFactory { - private final Collection<IExtension> extensions; - - private volatile IExtension[] extensionsArray; - - public BSBMExtensionFactory() { + protected void _init(final LexiconRelation lex, + final Collection<IExtension> extensions) { - extensions = new LinkedList<IExtension>(); - - } - - public void init(final LexiconRelation lex) { - // Extension to inline "USD" datatypes. extensions.add(new USDFloatExtension<BigdataLiteral>(lex)); - /* - * Always going to inline the derived numeric types. - */ - extensions.add(new DerivedNumericsExtension<BigdataLiteral>(lex)); - - if (lex.isInlineDateTimes()) { - - extensions.add(new DateTimeExtension<BigdataLiteral>( - lex, lex.getInlineDateTimesTimeZone())); - - } - - if (lex.getMaxInlineStringLength() > 0) { - /* - * Note: This extension is used for both literals and URIs. It MUST - * be enabled when MAX_INLINE_TEXT_LENGTH is GT ZERO (0). Otherwise - * we will not be able to inline either the local names or the full - * text of URIs. - */ - extensions.add(new XSDStringExtension<BigdataLiteral>(lex, lex - .getMaxInlineStringLength())); - } - - extensionsArray = extensions.toArray(new IExtension[extensions.size()]); - } - public IExtension[] getExtensions() { - - return extensionsArray; - - } - } Modified: branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/DefaultExtensionFactory.java =================================================================== --- branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/DefaultExtensionFactory.java 2011-11-21 15:10:13 UTC (rev 5709) +++ branches/TERMS_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/DefaultExtensionFactory.java 2011-11-21 15:15:15 UTC (rev 5710) @@ -58,11 +58,23 @@ extensions.add(new XSDStringExtension<BigdataLiteral>(lex, lex .getMaxInlineStringLength())); } + + _init(lex, extensions); extensionsArray = extensions.toArray(new IExtension[extensions.size()]); } + /** + * Give subclasses a chance to add extensions. + */ + protected void _init(final LexiconRelation lex, + final Collection<IExtension> extensions) { + + // noop + + } + public IExtension[] getExtensions() { return extensionsArray; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |