KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sql99 > ddl > schemamanipulation > alterdomainstatement


1 package com.daffodilwoods.daffodildb.server.sql99.ddl.schemamanipulation;
2
3 import com.daffodilwoods.daffodildb.server.sql99.expression.
4
    booleanvalueexpression.domainname;
5 import com.daffodilwoods.daffodildb.server.sql99.token.*;
6 import com.daffodilwoods.daffodildb.server.sql99.ddl.descriptors.
7
    DomainDescriptor;
8 import com.daffodilwoods.daffodildb.server.serversystem.*;
9 import com.daffodilwoods.database.resource.*;
10 import com.daffodilwoods.daffodildb.server.sql99.utils._Reference;
11 import com.daffodilwoods.daffodildb.server.sql99.ddl.utility.GeneralUtility;
12
13 public class alterdomainstatement
14     implements SQLschemamanipulationstatement {
15   public alterdomainaction _alterdomainaction0;
16   public domainname _domainname1;
17   public SRESERVEDWORD1206543922 _SRESERVEDWORD12065439222;
18   public SRESERVEDWORD1206543922 _SRESERVEDWORD12065439223;
19
20   /**
21    * algo for alter domain statement
22    * intialize -- serverSession, systemSession, domainDescriptor.
23    * setDomainName
24    * a. set catalog Name
25    * b. set schema Name
26    * c. set domain Name
27    * getSchemaOwner
28    * validateUserRights
29    * executeAlterDomainAction
30    * deleteTable
31    */

32
33
34   public Object JavaDoc run(Object JavaDoc object) throws DException {
35     _ServerSession serverSession = (_ServerSession) object;
36     _ServerSession systemSession = serverSession.getSystemServerSession();
37     DomainDescriptor domainDescriptor = new DomainDescriptor();
38     setDomainName(serverSession,domainDescriptor);
39     String JavaDoc schemaOwner = GeneralUtility.getSchemaOwner(domainDescriptor.
40         catalog_name, domainDescriptor.schema_name, serverSession);
41     GeneralUtility.validateUserRights(schemaOwner, serverSession);
42     executeAlterDomainActions(serverSession, domainDescriptor);
43     systemSession.deleteTable(domainDescriptor.getQualifiedIdentifier(), false);
44     return null;
45   }
46
47   private void executeAlterDomainActions(_ServerSession currentSession,
48                                         DomainDescriptor domainDescriptor) throws
49   DException {
50     _alterdomainaction0.setDomainDescriptor(domainDescriptor);
51     _alterdomainaction0.run(currentSession);
52   }
53
54   private void setDomainName(_ServerSession currentSession, DomainDescriptor domainDescriptor) throws DException{
55     domainDescriptor.catalog_name = _domainname1.getCatalogName();
56     domainDescriptor.schema_name = _domainname1.getSchemaName();
57     domainDescriptor.domain_name = _domainname1.getDomainName();
58
59     if(domainDescriptor.catalog_name==null)
60       domainDescriptor.catalog_name = currentSession.getCurrentCatalog();
61
62     if(domainDescriptor.schema_name == null)
63       domainDescriptor.schema_name = currentSession.getCurrentSchema();
64
65     try {
66       domainDescriptor.load(currentSession);
67     }
68     catch (DException ex) {
69       throw new DException("DSE8116",
70                            new Object JavaDoc[] {domainDescriptor.domain_name});
71     }
72   }
73
74   public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
75     return this;
76   }
77   public String JavaDoc toString()
78   {
79     StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
80     sb.append(" ");
81     sb.append(_SRESERVEDWORD12065439223);
82     sb.append(" ");
83     sb.append(_SRESERVEDWORD12065439222);
84     sb.append(" ");
85     sb.append(_domainname1);
86     sb.append(" ");
87     sb.append(_alterdomainaction0);
88     return sb.toString();
89   }
90 }
91
Popular Tags