001 /* 002 * JBoss DNA (http://www.jboss.org/dna) 003 * See the COPYRIGHT.txt file distributed with this work for information 004 * regarding copyright ownership. Some portions may be licensed 005 * to Red Hat, Inc. under one or more contributor license agreements. 006 * See the AUTHORS.txt file in the distribution for a full listing of 007 * individual contributors. 008 * 009 * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA 010 * is licensed to you under the terms of the GNU Lesser General Public License as 011 * published by the Free Software Foundation; either version 2.1 of 012 * the License, or (at your option) any later version. 013 * 014 * JBoss DNA is distributed in the hope that it will be useful, 015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 017 * Lesser General Public License for more details. 018 * 019 * You should have received a copy of the GNU Lesser General Public 020 * License along with this software; if not, write to the Free 021 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 022 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 023 */ 024 package org.jboss.dna.common.jdbc.model.api; 025 026 import java.util.Set; 027 028 /** 029 * Provides User Defined Type (UDT) specific metadata. Retrieves a description of the user-defined types (UDTs) defined in a 030 * particular schema. Schema-specific UDTs may have type JAVA_OBJECT, STRUCT, or DISTINCT. 031 * 032 * @author <a href="mailto:litsenko_sergey@yahoo.com">Sergiy Litsenko</a> 033 * @since 1.2 (JDBC 2.0) 034 */ 035 public interface UserDefinedType extends SchemaObject { 036 037 /** 038 * Returns JAVA class name for UDT 039 * 040 * @return JAVA class name for UDT 041 */ 042 String getClassName(); 043 044 /** 045 * Sets JAVA class name for UDT 046 * 047 * @param className JAVA class name for UDT 048 */ 049 void setClassName( String className ); 050 051 /** 052 * Gets SQL type from java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT 053 * 054 * @return SQL type from java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT 055 */ 056 SqlType getSqlType(); 057 058 /** 059 * Sets SQL type from java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT 060 * 061 * @param sqlType the SQL type from java.sql.Types. One of JAVA_OBJECT, STRUCT, or DISTINCT 062 */ 063 void setSqlType( SqlType sqlType ); 064 065 /** 066 * Gets SQL base type from java.sql.Types. Type code of the source type of a DISTINCT type or the type that implements the 067 * user-generated reference type of the SELF_REFERENCING_COLUMN of a structured type as defined in java.sql.Types (null if 068 * DATA_TYPE is not DISTINCT or not STRUCT with REFERENCE_GENERATION = USER_DEFINED) 069 * 070 * @return SQL base type from java.sql.Types. 071 */ 072 SqlType getBaseType(); 073 074 /** 075 * Sets SQL base type from java.sql.Types. Type code of the source type of a DISTINCT type or the type that implements the 076 * user-generated reference type of the SELF_REFERENCING_COLUMN of a structured type as defined in java.sql.Types (null if 077 * DATA_TYPE is not DISTINCT or not STRUCT with REFERENCE_GENERATION = USER_DEFINED) 078 * 079 * @param baseType the SQL base type from java.sql.Types. 080 */ 081 void setBaseType( SqlType baseType ); 082 083 /** 084 * Gets a set of UDT attributes 085 * 086 * @return a set of UDT attributes 087 */ 088 Set<Attribute> getAttributes(); 089 090 /** 091 * adds Attribute 092 * 093 * @param attribute the Attribute 094 */ 095 void addAttribute( Attribute attribute ); 096 097 /** 098 * deletes Attribute 099 * 100 * @param attribute the Attribute 101 */ 102 void deleteAttribute( Attribute attribute ); 103 104 /** 105 * Returns UDT attribute for specified attribute name or null 106 * 107 * @param attributeName the name of attribute 108 * @return UDT attribute for specified attribute name or null. 109 */ 110 Attribute findAttributeByName( String attributeName ); 111 112 // =============================================================== 113 // ------------------- JDBC 3.0 --------------------------------- 114 // =============================================================== 115 116 /** 117 * Retrieves a description of the user-defined type (UDT) hierarchies defined in a particular schema in this database. Only 118 * the immediate super type/ sub type relationship is modeled. 119 * 120 * @return super type for this UDT if any 121 * @since 1.4 (JDBC 3.0) 122 */ 123 UserDefinedType getSuperType(); 124 125 /** 126 * Sets a description of the user-defined type (UDT) hierarchies defined in a particular schema in this database. Only the 127 * immediate super type/ sub type relationship is modeled. 128 * 129 * @param superType the super type for this UDT if any 130 * @since 1.4 (JDBC 3.0) 131 */ 132 void setSuperType( UserDefinedType superType ); 133 }