01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. 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,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.axis2.clustering.context.commands;
20:
21: import org.apache.axis2.clustering.ClusteringFault;
22: import org.apache.axis2.context.ConfigurationContext;
23: import org.apache.axis2.context.ServiceGroupContext;
24: import org.apache.axis2.description.AxisServiceGroup;
25: import org.apache.commons.logging.Log;
26: import org.apache.commons.logging.LogFactory;
27:
28: /**
29: *
30: */
31: public class UpdateServiceGroupContextCommand extends
32: UpdateContextCommand {
33:
34: private static Log log = LogFactory
35: .getLog(UpdateServiceGroupContextCommand.class);
36:
37: protected String serviceGroupName;
38: protected String serviceGroupContextId;
39:
40: public String getServiceGroupName() {
41: return serviceGroupName;
42: }
43:
44: public void setServiceGroupName(String serviceGroupName) {
45: this .serviceGroupName = serviceGroupName;
46: }
47:
48: public String getServiceGroupContextId() {
49: return serviceGroupContextId;
50: }
51:
52: public void setServiceGroupContextId(String serviceGroupContextId) {
53: this .serviceGroupContextId = serviceGroupContextId;
54: }
55:
56: public void execute(ConfigurationContext configContext)
57: throws ClusteringFault {
58: ServiceGroupContext sgCtx = configContext
59: .getServiceGroupContext(serviceGroupContextId);
60:
61: // If the ServiceGroupContext is not found, create it
62: if (sgCtx == null) {
63: AxisServiceGroup axisServiceGroup = configContext
64: .getAxisConfiguration().getServiceGroup(
65: serviceGroupName);
66: if (axisServiceGroup == null) {
67: return;
68: }
69: sgCtx = new ServiceGroupContext(configContext,
70: axisServiceGroup);
71: sgCtx.setId(serviceGroupContextId);
72: configContext
73: .addServiceGroupContextIntoSoapSessionTable(sgCtx); // TODO: Check this
74: }
75: log.debug("###### Gonna update SG prop in "
76: + serviceGroupContextId + "===" + sgCtx);
77: propertyUpdater.updateProperties(sgCtx);
78: }
79:
80: public String toString() {
81: return "UpdateServiceGroupContextCommand(" + uniqueId + ")";
82: }
83: }
|