/*
* Copyright WSO2, Inc. (http://wso2.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.cloud.csg;
import org.wso2.carbon.cloud.csg.common.CSGConstant;
import org.wso2.carbon.cloud.csg.common.CSGException;
import org.wso2.carbon.cloud.csg.jms.JMSCSGProxyService;
/**
* <p>CSGProxyServiceConfigLayer </p> provides the wrapping around underling mode of operation.
*/
public class CSGProxyServiceConfigLayer {
/**
* This keeps track which mode of operation should be used. Currently we have a JMS based model only.
*/
private String operationMode = CSGConstant.JMS_MODE_OF_OPERATION;
public CSGProxyServiceConfigLayer() {
if (System.getProperty(CSGConstant.CSG_MODE_OF_OPERATION) != null) {
operationMode = System.getProperty(CSGConstant.CSG_MODE_OF_OPERATION);
}
}
public CSGProxyService getCSGServiceProxy()
throws CSGException {
if (CSGConstant.JMS_MODE_OF_OPERATION.equals(operationMode)) {
return new JMSCSGProxyService();
} else {
throw new CSGException("Operation mode " + operationMode + " doesn't support. Only a JMS based" +
" model is supported");
}
}
}