001/*
002 * ModeShape (http://www.modeshape.org)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *       http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.modeshape.jdbc;
017
018/**
019 * Specialized implementation for ModeShape-specific features.
020 */
021public class ModeShapeMetaData extends JcrMetaData {
022
023    public ModeShapeMetaData( JcrConnection connection ) {
024        super(connection);
025    }
026
027    /**
028     * {@inheritDoc}
029     * <p>
030     * ModeShape does support <code>FULL OUTER JOIN</code>, so this method returns true when this driver connects to a ModeShape
031     * JCR repository.
032     * </p>
033     * 
034     * @see java.sql.DatabaseMetaData#supportsFullOuterJoins()
035     */
036    @Override
037    public boolean supportsFullOuterJoins() {
038        return true;
039    }
040
041    /**
042     * {@inheritDoc}
043     * <p>
044     * ModeShape does support <code>UNION</code>, so this method returns true when this driver connects to a ModeShape JCR
045     * repository.
046     * </p>
047     * 
048     * @see java.sql.DatabaseMetaData#supportsUnion()
049     */
050    @Override
051    public boolean supportsUnion() {
052        return true;
053    }
054
055    /**
056     * {@inheritDoc}
057     * <p>
058     * ModeShape does support <code>UNION ALL</code>, so this method returns true when this driver connects to a ModeShape JCR
059     * repository.
060     * </p>
061     * 
062     * @see java.sql.DatabaseMetaData#supportsUnionAll()
063     */
064    @Override
065    public boolean supportsUnionAll() {
066        return true;
067    }
068
069    /**
070     * {@inheritDoc}
071     * <p>
072     * ModeShape uses arithmetic operations in criteria, and in the current implementation if one operand is null then the
073     * operations returns the other. Therefore, 'null + X = X', so this method returns <code>false</code>.
074     * </p>
075     * 
076     * @see java.sql.DatabaseMetaData#nullPlusNonNullIsNull()
077     */
078    @Override
079    public boolean nullPlusNonNullIsNull() {
080        return false;
081    }
082
083    /**
084     * {@inheritDoc}
085     * <p>
086     * ModeShape definitely uses sort order. Therefore, this method always returns <code>false</code>.
087     * </p>
088     * 
089     * @see java.sql.DatabaseMetaData#nullsAreSortedAtEnd()
090     */
091    @Override
092    public boolean nullsAreSortedAtEnd() {
093        return false;
094    }
095
096    /**
097     * {@inheritDoc}
098     * <p>
099     * ModeShape definitely uses sort order. Therefore, this method always returns <code>false</code>.
100     * </p>
101     * 
102     * @see java.sql.DatabaseMetaData#nullsAreSortedAtStart()
103     */
104    @Override
105    public boolean nullsAreSortedAtStart() {
106        return false;
107    }
108
109    /**
110     * {@inheritDoc}
111     * <p>
112     * ModeShape sorts null values to be lower than non-null values. Therefore, this method returns <code>false</code>.
113     * </p>
114     * 
115     * @see java.sql.DatabaseMetaData#nullsAreSortedHigh()
116     */
117    @Override
118    public boolean nullsAreSortedHigh() {
119        return false;
120    }
121
122    /**
123     * {@inheritDoc}
124     * <p>
125     * ModeShape sorts null values to be lower than non-null values. Therefore, this method returns <code>true</code>.
126     * </p>
127     * 
128     * @see java.sql.DatabaseMetaData#nullsAreSortedLow()
129     */
130    @Override
131    public boolean nullsAreSortedLow() {
132        return true;
133    }
134
135}