Search in sources :

Example 6 with NotImplementedException

use of org.apache.commons.lang.NotImplementedException in project h2o-2 by h2oai.

the class Tree method getSkip.

public static int getSkip(AutoBuffer ab, int leftSize, boolean regression) {
    int numLeaves = 0;
    int numLeftLeaves = 0;
    int startPos = ab.position();
    boolean prevIsS = false;
    while (ab.position() < startPos + leftSize) {
        byte currentNodeType = (byte) ab.get1();
        if (currentNodeType == 'S' || currentNodeType == 'E') {
            // skip col and split value.
            ab.get2();
            // skip col and split value.
            ab.get4f();
            int skipSize = ab.get1();
            if (skipSize == 0) {
                ab.get3();
            }
            prevIsS = true;
        } else if (currentNodeType == '[') {
            numLeaves++;
            if (regression)
                ab.get4f();
            else
                ab.get1();
            if (prevIsS)
                numLeftLeaves++;
            prevIsS = false;
        } else {
            throw new NotImplementedException();
        }
    }
    ab.position(startPos);
    // only for regression tree.
    return 2 * numLeaves - numLeftLeaves;
}
Also used : NotImplementedException(org.apache.commons.lang.NotImplementedException)

Example 7 with NotImplementedException

use of org.apache.commons.lang.NotImplementedException in project symmetric-ds by JumpMind.

the class AbstractTriggerTemplate method fillOutColumnTemplate.

protected ColumnString fillOutColumnTemplate(String origTableAlias, String tableAlias, String columnPrefix, Table table, Column column, DataEventType dml, boolean isOld, Channel channel, Trigger trigger) {
    boolean isLob = symmetricDialect.getPlatform().isLob(column.getMappedTypeCode());
    String templateToUse = null;
    if (column.getJdbcTypeName() != null && (column.getJdbcTypeName().toUpperCase().contains(TypeMap.GEOMETRY)) && StringUtils.isNotBlank(geometryColumnTemplate)) {
        templateToUse = geometryColumnTemplate;
    } else if (column.getJdbcTypeName() != null && (column.getJdbcTypeName().toUpperCase().contains(TypeMap.GEOGRAPHY)) && StringUtils.isNotBlank(geographyColumnTemplate)) {
        templateToUse = geographyColumnTemplate;
    } else {
        switch(column.getMappedTypeCode()) {
            case Types.TINYINT:
            case Types.SMALLINT:
            case Types.INTEGER:
            case Types.BIGINT:
            case Types.FLOAT:
            case Types.REAL:
            case Types.DOUBLE:
            case Types.NUMERIC:
            case Types.DECIMAL:
                templateToUse = numberColumnTemplate;
                break;
            case Types.CHAR:
            case Types.NCHAR:
            case Types.VARCHAR:
            case ColumnTypes.NVARCHAR:
                templateToUse = stringColumnTemplate;
                break;
            case ColumnTypes.SQLXML:
                templateToUse = xmlColumnTemplate;
                break;
            case Types.ARRAY:
                templateToUse = arrayColumnTemplate;
                break;
            case Types.LONGVARCHAR:
            case ColumnTypes.LONGNVARCHAR:
                if (!isLob) {
                    templateToUse = stringColumnTemplate;
                    break;
                }
            case Types.CLOB:
                if (isOld && symmetricDialect.needsToSelectLobData()) {
                    templateToUse = emptyColumnTemplate;
                } else {
                    templateToUse = clobColumnTemplate;
                }
                break;
            case Types.BINARY:
            case Types.VARBINARY:
                if (isNotBlank(binaryColumnTemplate)) {
                    templateToUse = binaryColumnTemplate;
                    break;
                }
            case Types.BLOB:
                if (requiresWrappedBlobTemplateForBlobType()) {
                    templateToUse = wrappedBlobColumnTemplate;
                    break;
                }
            case Types.LONGVARBINARY:
            case // SQL-Server ntext binary type
            -10:
                if (column.getJdbcTypeName() != null && (column.getJdbcTypeName().toUpperCase().contains(TypeMap.IMAGE)) && StringUtils.isNotBlank(imageColumnTemplate)) {
                    if (isOld) {
                        templateToUse = emptyColumnTemplate;
                    } else {
                        templateToUse = imageColumnTemplate;
                    }
                } else if (isOld && symmetricDialect.needsToSelectLobData()) {
                    templateToUse = emptyColumnTemplate;
                } else {
                    templateToUse = blobColumnTemplate;
                }
                break;
            case Types.DATE:
                if (noDateColumnTemplate()) {
                    templateToUse = datetimeColumnTemplate;
                    break;
                }
                templateToUse = dateColumnTemplate;
                break;
            case Types.TIME:
                if (noTimeColumnTemplate()) {
                    templateToUse = datetimeColumnTemplate;
                    break;
                }
                templateToUse = timeColumnTemplate;
                break;
            case Types.TIMESTAMP:
                templateToUse = datetimeColumnTemplate;
                break;
            case Types.BOOLEAN:
            case Types.BIT:
                templateToUse = booleanColumnTemplate;
                break;
            default:
                if (column.getJdbcTypeName() != null) {
                    if (column.getJdbcTypeName().toUpperCase().equals(TypeMap.INTERVAL)) {
                        templateToUse = numberColumnTemplate;
                        break;
                    } else if (column.getMappedType().equals(TypeMap.TIMESTAMPTZ) && StringUtils.isNotBlank(this.dateTimeWithTimeZoneColumnTemplate)) {
                        templateToUse = this.dateTimeWithTimeZoneColumnTemplate;
                        break;
                    } else if (column.getMappedType().equals(TypeMap.TIMESTAMPLTZ) && StringUtils.isNotBlank(this.dateTimeWithLocalTimeZoneColumnTemplate)) {
                        templateToUse = this.dateTimeWithLocalTimeZoneColumnTemplate;
                        break;
                    }
                }
                if (StringUtils.isBlank(templateToUse) && StringUtils.isNotBlank(this.otherColumnTemplate)) {
                    templateToUse = this.otherColumnTemplate;
                    break;
                }
                throw new NotImplementedException(column.getName() + " is of type " + column.getMappedType() + " with JDBC type of " + column.getJdbcTypeName());
        }
    }
    if (dml == DataEventType.DELETE && isLob && requiresEmptyLobTemplateForDeletes()) {
        templateToUse = emptyColumnTemplate;
    } else if (isLob && trigger.isUseStreamLobs()) {
        templateToUse = emptyColumnTemplate;
    }
    if (templateToUse != null) {
        templateToUse = templateToUse.trim();
    } else {
        throw new NotImplementedException();
    }
    String formattedColumnText = FormatUtils.replace("columnName", String.format("%s%s", columnPrefix, column.getName()), templateToUse);
    formattedColumnText = FormatUtils.replace("columnSize", getColumnSize(table, column), formattedColumnText);
    formattedColumnText = FormatUtils.replace("masterCollation", symmetricDialect.getMasterCollation(), formattedColumnText);
    if (isLob) {
        formattedColumnText = symmetricDialect.massageForLob(formattedColumnText, channel);
    }
    formattedColumnText = FormatUtils.replace("origTableAlias", origTableAlias, formattedColumnText);
    formattedColumnText = FormatUtils.replace("tableAlias", tableAlias, formattedColumnText);
    formattedColumnText = FormatUtils.replace("prefixName", symmetricDialect.getTablePrefix(), formattedColumnText);
    return new ColumnString(formattedColumnText, isLob);
}
Also used : NotImplementedException(org.apache.commons.lang.NotImplementedException)

Example 8 with NotImplementedException

use of org.apache.commons.lang.NotImplementedException in project intellij-elixir by KronicDeth.

the class ElixirPsiImplUtil method quote.

@Contract(pure = true)
@NotNull
public static OtpErlangObject quote(@NotNull final In in) {
    PsiElement[] children = in.getChildren();
    if (children.length != 3) {
        throw new NotImplementedException("BinaryOperation expected to have 3 children (left operand, operator, right operand");
    }
    Quotable leftOperand = (Quotable) children[0];
    OtpErlangObject quotedLeftOperand = leftOperand.quote();
    Quotable operator = (Quotable) children[1];
    OtpErlangObject quotedOperator = operator.quote();
    Quotable rightOperand = (Quotable) children[2];
    OtpErlangObject quotedRightOperand = rightOperand.quote();
    OtpErlangObject quoted = null;
    // @see https://github.com/elixir-lang/elixir/blob/6c288be7300509ff7b809002a3563c6a02dc13fa/lib/elixir/src/elixir_parser.yrl#L583
    if (Macro.isExpression(quotedLeftOperand)) {
        OtpErlangTuple leftExpression = (OtpErlangTuple) quotedLeftOperand;
        OtpErlangObject leftOperator = leftExpression.elementAt(0);
        for (OtpErlangAtom rearrangedUnaryOperator : REARRANGED_UNARY_OPERATORS) {
            /* build_op({_Kind, Line, 'in'}, {UOp, _, [Left]}, Right) when ?rearrange_uop(UOp) ->
                     {UOp, meta(Line), [{'in', meta(Line), [Left, Right]}]}; */
            if (leftOperator.equals(rearrangedUnaryOperator)) {
                OtpErlangObject unaryOperatorArguments = leftExpression.elementAt(2);
                OtpErlangObject originalUnaryOperand;
                if (unaryOperatorArguments instanceof OtpErlangString) {
                    OtpErlangString unaryOperatorPrintableArguments = (OtpErlangString) unaryOperatorArguments;
                    int codePoint = unaryOperatorPrintableArguments.stringValue().codePointAt(0);
                    originalUnaryOperand = new OtpErlangLong(codePoint);
                } else if (unaryOperatorArguments instanceof OtpErlangList) {
                    OtpErlangList unaryOperatorArgumentList = (OtpErlangList) unaryOperatorArguments;
                    originalUnaryOperand = unaryOperatorArgumentList.elementAt(0);
                } else {
                    throw new NotImplementedException("Expected REARRANGED_UNARY_OPERATORS operand to be quoted as an OtpErlangString or OtpErlangList");
                }
                OtpErlangList operatorMetadata = metadata(operator);
                quoted = quotedFunctionCall(leftOperator, operatorMetadata, quotedFunctionCall(quotedOperator, operatorMetadata, originalUnaryOperand, quotedRightOperand));
            }
        }
    }
    if (quoted == null) {
        quoted = quotedFunctionCall(quotedOperator, metadata(operator), quotedLeftOperand, quotedRightOperand);
    }
    return quoted;
}
Also used : NotImplementedException(org.apache.commons.lang.NotImplementedException) LeafPsiElement(com.intellij.psi.impl.source.tree.LeafPsiElement) Contract(org.jetbrains.annotations.Contract) NotNull(org.jetbrains.annotations.NotNull)

Example 9 with NotImplementedException

use of org.apache.commons.lang.NotImplementedException in project iaf by ibissource.

the class XMLSchemaFactory method newSchema.

public Schema newSchema(Source[] schemas) throws SAXException {
    // this will let the loader store parsed Grammars into the pool.
    XMLGrammarPoolImplExtension pool = new XMLGrammarPoolImplExtension();
    fXMLGrammarPoolWrapper.setGrammarPool(pool);
    XMLInputSource[] xmlInputSources = new XMLInputSource[schemas.length];
    InputStream inputStream;
    Reader reader;
    for (int i = 0; i < schemas.length; ++i) {
        Source source = schemas[i];
        if (source instanceof StreamSource) {
            StreamSource streamSource = (StreamSource) source;
            String publicId = streamSource.getPublicId();
            String systemId = streamSource.getSystemId();
            inputStream = streamSource.getInputStream();
            reader = streamSource.getReader();
            XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, null);
            xmlInputSource.setByteStream(inputStream);
            xmlInputSource.setCharacterStream(reader);
            xmlInputSources[i] = xmlInputSource;
        } else if (source instanceof SAXSource) {
            SAXSource saxSource = (SAXSource) source;
            InputSource inputSource = saxSource.getInputSource();
            if (inputSource == null) {
                throw new SAXException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "SAXSourceNullInputSource", null));
            }
            xmlInputSources[i] = new SAXInputSource(saxSource.getXMLReader(), inputSource);
        } else if (source instanceof DOMSource) {
            DOMSource domSource = (DOMSource) source;
            Node node = domSource.getNode();
            String systemID = domSource.getSystemId();
            xmlInputSources[i] = new DOMInputSource(node, systemID);
        } else // }
        if (source == null) {
            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "SchemaSourceArrayMemberNull", null));
        } else {
            throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "SchemaFactorySourceUnrecognized", new Object[] { source.getClass().getName() }));
        }
    }
    try {
        fXMLSchemaLoader.loadGrammar(xmlInputSources);
    } catch (XNIException e) {
        // this should have been reported to users already.
        throw Util.toSAXException(e);
    } catch (IOException e) {
        // this hasn't been reported, so do so now.
        SAXParseException se = new SAXParseException(e.getMessage(), null, e);
        if (fErrorHandler != null) {
            fErrorHandler.error(se);
        }
        // and we must throw it.
        throw se;
    }
    // Clear reference to grammar pool.
    fXMLGrammarPoolWrapper.setGrammarPool(null);
    // Select Schema implementation based on grammar count.
    final int grammarCount = pool.getGrammarCount();
    AbstractXMLSchema schema = null;
    if (fUseGrammarPoolOnly) {
        throw new NotImplementedException("fUseGrammarPoolOnly");
    // if (grammarCount > 1) {
    // schema = new XMLSchemaHack(new ReadOnlyGrammarPool(pool));
    // }
    // else if (grammarCount == 1) {
    // Grammar[] grammars = pool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_SCHEMA);
    // schema = new XMLSchemaHack(grammars[0]);
    // }
    // else {
    // schema = new XMLSchemaHack();
    // }
    } else {
        schema = new XMLSchema(new ReadOnlyGrammarPool(pool), false);
    }
    propagateFeatures(schema);
    return schema;
}
Also used : InputSource(org.xml.sax.InputSource) XMLInputSource(org.apache.xerces.xni.parser.XMLInputSource) DOMInputSource(org.apache.xerces.util.DOMInputSource) SAXInputSource(org.apache.xerces.util.SAXInputSource) DOMSource(javax.xml.transform.dom.DOMSource) XMLInputSource(org.apache.xerces.xni.parser.XMLInputSource) Node(org.w3c.dom.Node) NotImplementedException(org.apache.commons.lang.NotImplementedException) XMLEventReader(javax.xml.stream.XMLEventReader) Reader(java.io.Reader) DOMSource(javax.xml.transform.dom.DOMSource) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source) InputSource(org.xml.sax.InputSource) XMLInputSource(org.apache.xerces.xni.parser.XMLInputSource) DOMInputSource(org.apache.xerces.util.DOMInputSource) SAXSource(javax.xml.transform.sax.SAXSource) StAXSource(javax.xml.transform.stax.StAXSource) SAXInputSource(org.apache.xerces.util.SAXInputSource) XNIException(org.apache.xerces.xni.XNIException) SAXException(org.xml.sax.SAXException) SAXParseException(org.xml.sax.SAXParseException) InputStream(java.io.InputStream) StreamSource(javax.xml.transform.stream.StreamSource) IOException(java.io.IOException) DOMInputSource(org.apache.xerces.util.DOMInputSource) SAXSource(javax.xml.transform.sax.SAXSource) SAXInputSource(org.apache.xerces.util.SAXInputSource)

Example 10 with NotImplementedException

use of org.apache.commons.lang.NotImplementedException in project accumulo by apache.

the class VolumeManagerImpl method rename.

@Override
public boolean rename(Path path, Path newPath) throws IOException {
    Volume srcVolume = getVolumeByPath(path);
    Volume destVolume = getVolumeByPath(newPath);
    FileSystem source = srcVolume.getFileSystem();
    FileSystem dest = destVolume.getFileSystem();
    if (source != dest) {
        throw new NotImplementedException("Cannot rename files across volumes: " + path + " -> " + newPath);
    }
    return source.rename(path, newPath);
}
Also used : Volume(org.apache.accumulo.core.volume.Volume) NonConfiguredVolume(org.apache.accumulo.core.volume.NonConfiguredVolume) FileSystem(org.apache.hadoop.fs.FileSystem) DistributedFileSystem(org.apache.hadoop.hdfs.DistributedFileSystem) NotImplementedException(org.apache.commons.lang.NotImplementedException)

Aggregations

NotImplementedException (org.apache.commons.lang.NotImplementedException)36 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Path (org.apache.hadoop.fs.Path)4 ASTNode (com.intellij.lang.ASTNode)3 IElementType (com.intellij.psi.tree.IElementType)3 File (java.io.File)3 Collection (java.util.Collection)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 Entry (java.util.Map.Entry)3 NotNull (org.jetbrains.annotations.NotNull)3 LeafPsiElement (com.intellij.psi.impl.source.tree.LeafPsiElement)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Set (java.util.Set)2 TableName (org.apache.hadoop.hbase.TableName)2 DMLProgram (org.apache.sysml.parser.DMLProgram)2 XSDConstrainingFacet (org.eclipse.xsd.XSDConstrainingFacet)2