001: /*
002:
003: Derby - Class org.apache.derby.iapi.sql.dictionary.DependencyDescriptor
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.iapi.sql.dictionary;
023:
024: import org.apache.derby.catalog.UUID;
025:
026: import org.apache.derby.iapi.reference.SQLState;
027: import org.apache.derby.iapi.services.sanity.SanityManager;
028: import org.apache.derby.iapi.sql.StatementType;
029: import org.apache.derby.catalog.DependableFinder;
030: import org.apache.derby.catalog.Dependable;
031: import org.apache.derby.iapi.services.io.StoredFormatIds;
032: import org.apache.derby.iapi.error.StandardException;
033: import org.apache.derby.iapi.sql.depend.DependencyManager;
034: import org.apache.derby.iapi.sql.depend.Dependent;
035: import org.apache.derby.iapi.sql.depend.Dependency;
036: import org.apache.derby.iapi.sql.depend.Provider;
037:
038: /**
039: * This interface is used to get information from a DependencyDescriptor.
040: *
041: * @version 0.1
042: * @author Jerry Brenner
043: */
044:
045: public class DependencyDescriptor extends TupleDescriptor implements
046: UniqueTupleDescriptor {
047: /** public interface for this class is:
048: <ol>
049: <li>public DependableFinder getDependentFinder();</li>
050: <li>public UUID getProviderID();</li>
051: <li>public DependableFinder getProviderFinder();</li>
052: </ol>
053: */
054:
055: // implementation
056: private final UUID dependentID;
057: private final DependableFinder dependentBloodhound;
058: private final UUID providerID;
059: private final DependableFinder providerBloodhound;
060:
061: /**
062: * Constructor for a DependencyDescriptor
063: *
064: * @param dependent The Dependent
065: * @param provider The Provider
066: */
067:
068: public DependencyDescriptor(Dependent dependent, Provider provider) {
069: dependentID = dependent.getObjectID();
070: dependentBloodhound = dependent.getDependableFinder();
071: providerID = provider.getObjectID();
072: providerBloodhound = provider.getDependableFinder();
073: }
074:
075: /**
076: * Constructor for a DependencyDescriptor
077: *
078: * @param dependentID The Dependent ID
079: * @param dependentBloodhound The bloodhound for finding the Dependent
080: * @param providerID The Provider ID
081: * @param providerBloodhound The bloodhound for finding the Provider
082: */
083:
084: public DependencyDescriptor(UUID dependentID,
085: DependableFinder dependentBloodhound, UUID providerID,
086: DependableFinder providerBloodhound) {
087: this .dependentID = dependentID;
088: this .dependentBloodhound = dependentBloodhound;
089: this .providerID = providerID;
090: this .providerBloodhound = providerBloodhound;
091: }
092:
093: // DependencyDescriptor interface
094:
095: /**
096: * Get the dependent's ID for the dependency.
097: *
098: * @return The dependent's ID.
099: */
100: public UUID getUUID() {
101: return dependentID;
102: }
103:
104: /**
105: * Get the dependent's type for the dependency.
106: *
107: * @return The dependent's type.
108: */
109: public DependableFinder getDependentFinder() {
110: return dependentBloodhound;
111: }
112:
113: /**
114: * Get the provider's ID for the dependency.
115: *
116: * @return The provider's ID.
117: */
118: public UUID getProviderID() {
119: return providerID;
120: }
121:
122: /**
123: * Get the provider's type for the dependency.
124: *
125: * @return The provider's type.
126: */
127: public DependableFinder getProviderFinder() {
128: return providerBloodhound;
129: }
130: }
|