01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2006 Continuent, Inc.
04: * Contact: sequoia@continuent.org
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: *
18: * Initial developer(s): Damian Arregui.
19: * Contributor(s): ______________________.
20: */package org.continuent.sequoia.controller.virtualdatabase.protocol;
21:
22: import java.io.Serializable;
23: import java.sql.SQLException;
24:
25: import org.continuent.hedera.common.Member;
26: import org.continuent.sequoia.common.exceptions.ControllerException;
27: import org.continuent.sequoia.controller.requests.AbstractRequest;
28: import org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase;
29:
30: /**
31: * This class defines a GetPreparedStatementMetadata
32: *
33: * @author <a href="mailto:damian.arregui@continuent.com">Damian Arregui</a>
34: * @version 1.0
35: */
36: public class GetPreparedStatementMetadata extends
37: DistributedVirtualDatabaseMessage {
38: private static final long serialVersionUID = 4898077898219570560L;
39:
40: private AbstractRequest request;
41:
42: /**
43: * Creates a new <code>GetPreparedStatementMetadata</code> object
44: *
45: * @param request the request containig the statement to get metadata for.
46: */
47: public GetPreparedStatementMetadata(AbstractRequest request) {
48: this .request = request;
49: }
50:
51: /**
52: * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedVirtualDatabaseMessage#handleMessageSingleThreaded(org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase,
53: * org.continuent.hedera.common.Member)
54: */
55: public Object handleMessageSingleThreaded(
56: DistributedVirtualDatabase dvdb, Member sender) {
57: try {
58: return dvdb.getRequestManager()
59: .getPreparedStatementGetMetaData(request);
60: } catch (SQLException e) {
61: return new ControllerException(e);
62: }
63: }
64:
65: /**
66: * @see org.continuent.sequoia.controller.virtualdatabase.protocol.DistributedVirtualDatabaseMessage#handleMessageMultiThreaded(org.continuent.sequoia.controller.virtualdatabase.DistributedVirtualDatabase,
67: * org.continuent.hedera.common.Member, java.lang.Object)
68: */
69: public Serializable handleMessageMultiThreaded(
70: DistributedVirtualDatabase dvdb, Member sender,
71: Object handleMessageSingleThreadedResult) {
72: return (Serializable) handleMessageSingleThreadedResult;
73: }
74:
75: }
|