01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.corba.transaction;
17:
18: import java.util.Map;
19:
20: import org.apache.commons.logging.Log;
21: import org.apache.commons.logging.LogFactory;
22: import org.omg.CORBA.SystemException;
23: import org.omg.CosTransactions.PropagationContext;
24:
25: /**
26: * @version $Rev: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $
27: */
28: public class MappedServerTransactionPolicyConfig extends
29: AbstractServerTransactionPolicyConfig {
30: private static Log log = LogFactory
31: .getLog(MappedServerTransactionPolicyConfig.class);
32: private final Map operationToPolicyMap;
33:
34: public MappedServerTransactionPolicyConfig(Map operationToPolicyMap) {
35: this .operationToPolicyMap = operationToPolicyMap;
36: }
37:
38: protected void importTransaction(String operation,
39: PropagationContext propagationContext)
40: throws SystemException {
41: OperationTxPolicy operationTxPolicy = (OperationTxPolicy) operationToPolicyMap
42: .get(operation);
43: if (operationTxPolicy == null) {
44: //TODO figure out if there is some way to detect if the method should be mapped or shouldn't
45: //e.g. _is_a shows up but should not be mapped.
46: log.info("No tx mapping for operation: " + operation);
47: return;
48: }
49: operationTxPolicy.importTransaction(propagationContext);
50: }
51:
52: }
|