KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > catalog > types > SynonymAliasInfo


1 /*
2
3    Derby - Class org.apache.derby.catalog.types.SynonymAliasInfo
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.catalog.types;
23
24 import org.apache.derby.iapi.services.io.Formatable;
25 import org.apache.derby.iapi.services.io.StoredFormatIds;
26 import org.apache.derby.catalog.AliasInfo;
27 import java.io.IOException JavaDoc;
28 import java.io.ObjectInput JavaDoc;
29 import java.io.ObjectOutput JavaDoc;
30
31 /**
32  * Describe an S (Synonym) alias.
33  *
34  * @see AliasInfo
35  */

36 public class SynonymAliasInfo implements AliasInfo, Formatable
37 {
38     private String JavaDoc schemaName = null;
39     private String JavaDoc tableName = null;
40
41     public SynonymAliasInfo() {
42     }
43
44     /**
45         Create a SynonymAliasInfo for synonym.
46     */

47     public SynonymAliasInfo(String JavaDoc schemaName, String JavaDoc tableName)
48     {
49         this.schemaName = schemaName;
50         this.tableName = tableName;
51     }
52
53     public String JavaDoc getSynonymTable() {
54         return tableName;
55     }
56
57     public String JavaDoc getSynonymSchema() {
58         return schemaName;
59     }
60
61     // Formatable methods
62

63     /**
64      * Read this object from a stream of stored objects.
65      *
66      * @param in read this.
67      *
68      * @exception IOException thrown on error
69      * @exception ClassNotFoundException thrown on error
70      */

71     public void readExternal( ObjectInput JavaDoc in )
72          throws IOException JavaDoc, ClassNotFoundException JavaDoc
73     {
74         schemaName = (String JavaDoc) in.readObject();
75         tableName = (String JavaDoc) in.readObject();
76     }
77
78     /**
79      * Write this object to a stream of stored objects.
80      *
81      * @param out write bytes here.
82      *
83      * @exception IOException thrown on error
84      */

85     public void writeExternal( ObjectOutput JavaDoc out )
86          throws IOException JavaDoc
87     {
88         out.writeObject(schemaName);
89         out.writeObject(tableName);
90     }
91  
92     /**
93      * Get the formatID which corresponds to this class.
94      *
95      * @return the formatID of this class
96      */

97     public int getTypeFormatId() { return StoredFormatIds.SYNONYM_INFO_V01_ID; }
98
99     public String JavaDoc toString() {
100         return "\"" + schemaName + "\".\"" + tableName + "\"";
101     }
102
103     public String JavaDoc getMethodName()
104     {
105         return null;
106     }
107 }
108
109
Popular Tags