http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/cache/ThrottlingInfoCache.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/cache/ThrottlingInfoCache.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/cache/ThrottlingInfoCache.java deleted file mode 100644 index 3bf9f40..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/cache/ThrottlingInfoCache.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.cache; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.registry.api.RegistryService; -import org.wso2.carbon.registry.core.RegistryConstants; -import org.wso2.carbon.registry.core.Resource; -import org.wso2.carbon.registry.core.session.UserRegistry; -import org.apache.stratos.common.constants.StratosConstants; -import org.apache.stratos.common.util.MeteringAccessValidationUtils; -import org.apache.stratos.throttling.agent.internal.ThrottlingAgentServiceComponent; - -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -/** - * In memory cache which keeps throttling information for active tenants(local to a server instance). Cache is updated - * periodically using information retrieved from registry. - */ -public class ThrottlingInfoCache { - - private static final Log log = LogFactory.getLog(ThrottlingInfoCache.class); - - private Map<Integer, TenantThrottlingInfo> tenantThrottlingInfoMap = - new ConcurrentHashMap<Integer, TenantThrottlingInfo>(); - - public void addTenant(int tenantId){ - if(!tenantThrottlingInfoMap.containsKey(tenantId)){ - tenantThrottlingInfoMap.put(tenantId, getTenantThrottlingInfoFromRegistry(tenantId)); - } - } - - public void deleteTenant(int tenantId){ - tenantThrottlingInfoMap.remove(tenantId); - } - - public Set<Integer> getActiveTenants(){ - return tenantThrottlingInfoMap.keySet(); - } - - public void updateThrottlingActionInfo(int tenantId, String action, ThrottlingActionInfo throttlingActionInfo){ - // throttlingInfo could never be null if the update and lazy loading logic are correct. - TenantThrottlingInfo throttlingInfo = tenantThrottlingInfoMap.get(tenantId); - throttlingInfo.updateThrottlingActionInfo(action, throttlingActionInfo); - } - - public ThrottlingActionInfo getThrottlingActionInfo(int tenantId, String action){ - if(tenantThrottlingInfoMap.get(tenantId) != null){ - return tenantThrottlingInfoMap.get(tenantId).getThrottlingActionInfo(action); - } - - // This could happen if user has never perform this action before or throttling info cache updating task - // has not executed for this tenant. TODO: Check the validity - return null; - } - - public TenantThrottlingInfo getTenantThrottlingInfo(int tenantId){ - if(!tenantThrottlingInfoMap.containsKey(tenantId)){ - tenantThrottlingInfoMap.put(tenantId, getTenantThrottlingInfoFromRegistry(tenantId)); - } - return tenantThrottlingInfoMap.get(tenantId); - } - - private TenantThrottlingInfo getTenantThrottlingInfoFromRegistry (int tenantId) { - log.info("Tenant throttling info is not in the cache. Hence, getting it from registry"); - RegistryService registryService = ThrottlingAgentServiceComponent.getThrottlingAgent(). - getRegistryService(); - TenantThrottlingInfo tenantThrottlingInfo = new TenantThrottlingInfo(); - try{ - UserRegistry superTenantGovernanceRegistry = (UserRegistry)registryService.getGovernanceSystemRegistry(); - String tenantValidationInfoResourcePath = - StratosConstants.TENANT_USER_VALIDATION_STORE_PATH + - RegistryConstants.PATH_SEPARATOR + tenantId; - - if (superTenantGovernanceRegistry.resourceExists(tenantValidationInfoResourcePath)) { - Resource tenantValidationInfoResource = - superTenantGovernanceRegistry.get(tenantValidationInfoResourcePath); - Properties properties = tenantValidationInfoResource.getProperties(); - Set<String> actions = MeteringAccessValidationUtils.getAvailableActions(properties); - for (String action : actions) { - String blocked = - tenantValidationInfoResource.getProperty(MeteringAccessValidationUtils - .generateIsBlockedPropertyKey(action)); - - String blockMessage = - tenantValidationInfoResource.getProperty(MeteringAccessValidationUtils - .generateErrorMsgPropertyKey(action)); - - tenantThrottlingInfo.updateThrottlingActionInfo(action, - new ThrottlingActionInfo("true".equals(blocked), blockMessage)); - } - } - } catch (Exception e){ - log.error("Error occurred while obtaining governance system registry from registry service", e); - } - - return tenantThrottlingInfo; - - } -}
http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/cache/ThrottlingInfoCacheUpdaterTask.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/cache/ThrottlingInfoCacheUpdaterTask.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/cache/ThrottlingInfoCacheUpdaterTask.java deleted file mode 100644 index 3bfdda4..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/cache/ThrottlingInfoCacheUpdaterTask.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.cache; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.common.constants.StratosConstants; -import org.apache.stratos.common.util.MeteringAccessValidationUtils; -import org.wso2.carbon.registry.core.RegistryConstants; -import org.wso2.carbon.registry.core.Resource; -import org.wso2.carbon.registry.core.exceptions.RegistryException; -import org.wso2.carbon.registry.core.session.UserRegistry; - -import java.util.Properties; -import java.util.Set; - -public class ThrottlingInfoCacheUpdaterTask implements Runnable { - private static final Log log = LogFactory.getLog(ThrottlingInfoCacheUpdaterTask.class); - - private ThrottlingInfoCache cache; - private UserRegistry governanceSystemRegistry; - - public ThrottlingInfoCacheUpdaterTask(ThrottlingInfoCache cache, UserRegistry governanceSystemRegistry) { - this.cache = cache; - this.governanceSystemRegistry = governanceSystemRegistry; - } - - public void run() { - log.info("Running throttling info cache updater task"); - Set<Integer> activeTenants = cache.getActiveTenants(); - for (Integer tenant : activeTenants) { - String tenantValidationInfoResourcePath = - StratosConstants.TENANT_USER_VALIDATION_STORE_PATH + - RegistryConstants.PATH_SEPARATOR + tenant; - try { - if (governanceSystemRegistry.resourceExists(tenantValidationInfoResourcePath)) { - Resource tenantValidationInfoResource = - governanceSystemRegistry.get(tenantValidationInfoResourcePath); - Properties properties = tenantValidationInfoResource.getProperties(); - Set<String> actions = MeteringAccessValidationUtils.getAvailableActions(properties); - for (String action : actions) { - String blocked = - tenantValidationInfoResource.getProperty(MeteringAccessValidationUtils - .generateIsBlockedPropertyKey(action)); - if(log.isDebugEnabled()){ - log.debug("Action: " + action + " blocked: " + blocked + " tenant: " + tenant); - } - - String blockMessage = - tenantValidationInfoResource.getProperty(MeteringAccessValidationUtils - .generateErrorMsgPropertyKey(action)); - TenantThrottlingInfo tenantThrottlingInfo = cache.getTenantThrottlingInfo(tenant); - - tenantThrottlingInfo.updateThrottlingActionInfo(action, - new ThrottlingActionInfo("true".equals(blocked), blockMessage)); - } - } - } catch (RegistryException re) { - String msg = - "Error while getting throttling info for tenant " + tenant + "."; - log.error(msg, re); - } - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/client/MultitenancyThrottlingServiceClient.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/client/MultitenancyThrottlingServiceClient.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/client/MultitenancyThrottlingServiceClient.java deleted file mode 100644 index d554fbe..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/client/MultitenancyThrottlingServiceClient.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.client; - -import org.apache.axis2.client.Options; -import org.apache.axis2.client.ServiceClient; -import org.wso2.carbon.authenticator.proxy.AuthenticationAdminClient; -import org.apache.stratos.throttling.agent.internal.ThrottlingAgentServiceComponent; -import org.apache.stratos.throttling.agent.stub.services.MultitenancyThrottlingServiceStub; - -public class MultitenancyThrottlingServiceClient implements ThrottlingRuleInvoker { - MultitenancyThrottlingServiceStub stub; - - public MultitenancyThrottlingServiceClient(String serverUrl, String userName, String password) - throws Exception { - stub = - new MultitenancyThrottlingServiceStub(ThrottlingAgentServiceComponent.getThrottlingAgent().getConfigurationContextService() - .getClientConfigContext(), serverUrl + "MultitenancyThrottlingService"); - ServiceClient client = stub._getServiceClient(); - Options option = client.getOptions(); - option.setManageSession(true); - String cookie = login(serverUrl, userName, password); - option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie); - } - - public static String login(String serverUrl, String userName, String password) throws Exception { - String sessionCookie = null; - try { - AuthenticationAdminClient client = - new AuthenticationAdminClient(ThrottlingAgentServiceComponent.getThrottlingAgent().getConfigurationContextService() - .getClientConfigContext(), serverUrl, null, null, false); - // TODO : get the correct IP - boolean isLogin = client.login(userName, password, "127.0.0.1"); - if (isLogin) { - sessionCookie = client.getAdminCookie(); - } - } catch (Exception e) { - throw new Exception("Error in login to throttling manager. server: " + serverUrl + - "username: " + userName + ".", e); - } - return sessionCookie; - } - - - public void executeThrottlingRules(int tenantId) throws Exception { - stub.executeThrottlingRules(tenantId); - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/client/ThrottlingRuleInvoker.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/client/ThrottlingRuleInvoker.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/client/ThrottlingRuleInvoker.java deleted file mode 100644 index 10bdc8e..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/client/ThrottlingRuleInvoker.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.client; - -public interface ThrottlingRuleInvoker { - public void executeThrottlingRules(int tenantId) throws Exception; -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/conf/ThrottlingAgentConfiguration.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/conf/ThrottlingAgentConfiguration.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/conf/ThrottlingAgentConfiguration.java deleted file mode 100644 index b4fb8af..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/conf/ThrottlingAgentConfiguration.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.conf; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.axiom.om.OMElement; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.common.util.CommonUtil; - -public class ThrottlingAgentConfiguration { - private static final Log log = LogFactory.getLog(ThrottlingAgentConfiguration.class); - private static final String CONFIG_NS = - "http://wso2.com/carbon/multitenancy/throttling/agent/config"; - private static final String PARAMTERS_ELEMENT_NAME = "parameters"; - private static final String PARAMTER_ELEMENT_NAME = "parameter"; - private static final String PARAMTER_NAME_ATTR_NAME = "name"; - private Map<String, String> parameters = new HashMap<String, String>(); - - public ThrottlingAgentConfiguration(String throttlingConfigFile) throws Exception { - try { - OMElement meteringConfig = - CommonUtil.buildOMElement(new FileInputStream(throttlingConfigFile)); - deserialize(meteringConfig); - } catch (FileNotFoundException e) { - String msg = "Unable to find the file: " + throttlingConfigFile + "."; - log.error(msg, e); - throw new Exception(msg, e); - } - } - - public void deserialize(OMElement throttlingConfigEle) throws Exception { - Iterator meteringConfigChildIt = throttlingConfigEle.getChildElements(); - while (meteringConfigChildIt.hasNext()) { - Object meteringConfigChild = meteringConfigChildIt.next(); - if (!(meteringConfigChild instanceof OMElement)) { - continue; - } - OMElement meteringConfigChildEle = (OMElement) meteringConfigChild; - if (new QName(CONFIG_NS, PARAMTERS_ELEMENT_NAME, "").equals(meteringConfigChildEle - .getQName())) { - Iterator parametersChildIt = meteringConfigChildEle.getChildElements(); - while (parametersChildIt.hasNext()) { - Object taskConfigChild = parametersChildIt.next(); - if (!(taskConfigChild instanceof OMElement)) { - continue; - } - OMElement parameterChildEle = (OMElement) taskConfigChild; - if (!new QName(CONFIG_NS, PARAMTER_ELEMENT_NAME, "").equals(parameterChildEle - .getQName())) { - continue; - } - String parameterName = - parameterChildEle.getAttributeValue(new QName(PARAMTER_NAME_ATTR_NAME)); - String parameterValue = parameterChildEle.getText(); - parameters.put(parameterName, parameterValue); - } - } - } - } - - public Map<String, String> getParameters() { - return parameters; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/internal/ThrottlingAgentServiceComponent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/internal/ThrottlingAgentServiceComponent.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/internal/ThrottlingAgentServiceComponent.java deleted file mode 100644 index 161ae37..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/internal/ThrottlingAgentServiceComponent.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.internal; - -import org.apache.stratos.throttling.agent.cache.Axis2ConfigurationContextObserverImpl; -import org.apache.stratos.throttling.agent.cache.ThrottlingInfoCache; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.framework.BundleContext; -import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.base.ServerConfiguration; -import org.wso2.carbon.registry.core.exceptions.RegistryException; -import org.wso2.carbon.registry.core.service.RegistryService; -import org.apache.stratos.throttling.agent.ThrottlingAgent; -import org.apache.stratos.throttling.agent.listeners.WebAppRequestListener; -import org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve; -import org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer; -import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.utils.Axis2ConfigurationContextObserver; -import org.wso2.carbon.utils.ConfigurationContextService; -import org.apache.stratos.common.util.StratosConfiguration; - -import java.util.ArrayList; - -/** - * @scr.component name="org.wso2.carbon.throttling.agent" - * immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="1..1" - * policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" policy="dynamic" bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="1..1" policy="dynamic" bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="stratos.config.service" - * interface="org.apache.stratos.common.util.StratosConfiguration" cardinality="1..1" - * policy="dynamic" bind="setStratosConfigurationService" unbind="unsetStratosConfigurationService" - */ -public class ThrottlingAgentServiceComponent { - private static Log log = LogFactory.getLog(ThrottlingAgentServiceComponent.class); - - private static ThrottlingAgent throttlingAgent; - private static RealmService realmService; - private static RegistryService registryService; - private static ConfigurationContextService contextService; - private static StratosConfiguration stratosConfiguration; - - protected void activate(ComponentContext context) { - try { - BundleContext bundleContext = context.getBundleContext(); - throttlingAgent = new ThrottlingAgent(bundleContext); - throttlingAgent.setConfigurationContextService(contextService); - throttlingAgent.setRealmService(realmService); - throttlingAgent.setRegistryService(registryService); - throttlingAgent.setStratosConfiguration(stratosConfiguration); - - try { - // Throttling agent initialization require registry service. - throttlingAgent.init(); - } catch (RegistryException e) { - String errMessage = "Failed to initialize throttling agent."; - log.error(errMessage, e); - throw new RuntimeException(errMessage, e); - } - - if("true".equals(ServerConfiguration.getInstance().getFirstProperty("EnableMetering"))){ - // Register the Tomcat Valve - ArrayList<CarbonTomcatValve> valves = new ArrayList<CarbonTomcatValve>(); - valves.add(new WebAppRequestListener(throttlingAgent)); - TomcatValveContainer.addValves(valves); - - registerAxis2ConfigurationContextObserver(bundleContext, throttlingAgent.getThrottlingInfoCache()); - }else{ - log.debug("WebAppRequestListener valve was not added because metering is disabled in the configuration"); - log.debug("Axis2ConfigurationContextObserver was not registered because metering is disabled"); - } - - registerThrottlingAgent(bundleContext); - - log.debug("Multitenancy Throttling Agent bundle is activated."); - } catch (Throwable e) { - log.error("Multitenancy Throttling Agent bundle failed activating.", e); - } - - } - - private void registerAxis2ConfigurationContextObserver(BundleContext bundleContext, ThrottlingInfoCache cache) { - bundleContext.registerService(Axis2ConfigurationContextObserver.class.getName(), - new Axis2ConfigurationContextObserverImpl(cache), - null); - } - - /** - * Register throttling agent service that use to update throttling rules when users try to - * upgrade down grade usage plans - * - * @param bundleContext bundle context that need to initialize throttling agent - */ - public void registerThrottlingAgent(BundleContext bundleContext) { - try { - bundleContext.registerService(ThrottlingAgent.class.getName(), - throttlingAgent, - null); - } - catch (Exception e) { - - } - } - - protected void deactivate(ComponentContext context) { - //Util.uninitializeThrottlingRuleInvokerTracker(); - log.debug("******* Multitenancy Throttling Agent bundle is deactivated ******* "); - } - - protected void setRegistryService(RegistryService registryService) { - ThrottlingAgentServiceComponent.registryService = registryService; - } - - protected void unsetRegistryService(RegistryService registryService) { - ThrottlingAgentServiceComponent.registryService = null; - throttlingAgent.setRegistryService(null); - } - - protected void setRealmService(RealmService realmService) { - ThrottlingAgentServiceComponent.realmService = realmService; - } - - protected void unsetRealmService(RealmService realmService) { - ThrottlingAgentServiceComponent.realmService = null; - throttlingAgent.setRealmService(null); - } - - protected void setConfigurationContextService(ConfigurationContextService contextService) { - ThrottlingAgentServiceComponent.contextService = contextService; - - //this module is not necessary when we have the WebAppRequestListerner. - //It takes care of webapps and services. But this is not working for ESb - //When a solution for ESB is found, this module can be engaged again - /*try { - contextService.getServerConfigContext().getAxisConfiguration().engageModule( - "usagethrottling"); - } catch (AxisFault e) { - log.error("Failed to engage usage throttling module", e); - }*/ - } - - protected void unsetConfigurationContextService(ConfigurationContextService contextService) { - /*try { - AxisConfiguration axisConfig = - contextService.getServerConfigContext().getAxisConfiguration(); - axisConfig.disengageModule(axisConfig.getModule("usagethrottling")); - } catch (AxisFault e) { - log.error("Failed to disengage usage throttling module", e); - }*/ - ThrottlingAgentServiceComponent.contextService = null; - throttlingAgent.setConfigurationContextService(null); - } - - public static ThrottlingAgent getThrottlingAgent() { - return throttlingAgent; - } - - protected void setStratosConfigurationService(StratosConfiguration stratosConfigService) { - ThrottlingAgentServiceComponent.stratosConfiguration=stratosConfigService; - } - - protected void unsetStratosConfigurationService(StratosConfiguration ccService) { - ThrottlingAgentServiceComponent.stratosConfiguration = null; - throttlingAgent.setStratosConfiguration(null); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/PerRegistryRequestListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/PerRegistryRequestListener.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/PerRegistryRequestListener.java deleted file mode 100644 index 826cc76..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/PerRegistryRequestListener.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.listeners; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.CarbonConstants; -import org.apache.stratos.common.constants.StratosConstants; -import org.wso2.carbon.registry.core.Resource; -import org.wso2.carbon.registry.core.config.RegistryContext; -import org.wso2.carbon.registry.core.exceptions.RegistryException; -import org.wso2.carbon.registry.core.jdbc.handlers.Handler; -import org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager; -import org.wso2.carbon.registry.core.jdbc.handlers.RequestContext; -import org.wso2.carbon.registry.core.jdbc.handlers.filters.Filter; -import org.wso2.carbon.registry.core.jdbc.handlers.filters.URLMatcher; -import org.wso2.carbon.registry.core.session.CurrentSession; -import org.apache.stratos.throttling.agent.cache.TenantThrottlingInfo; -import org.apache.stratos.throttling.agent.cache.ThrottlingActionInfo; -import org.apache.stratos.throttling.agent.internal.ThrottlingAgentServiceComponent; -import org.wso2.carbon.utils.multitenancy.MultitenantConstants; - -public class PerRegistryRequestListener extends Handler { - - private static final Log log = LogFactory.getLog(PerRegistryRequestListener.class); - - @Override - public void put(RequestContext context) throws RegistryException { - validateRegistryAction(StratosConstants.THROTTLING_IN_DATA_ACTION); - } - - @Override - public void importResource(RequestContext context) throws RegistryException { - validateRegistryAction(StratosConstants.THROTTLING_IN_DATA_ACTION); - } - - @Override - public Resource get(RequestContext context) throws RegistryException { - validateRegistryAction(StratosConstants.THROTTLING_OUT_DATA_ACTION); - return null; - } - - @Override - public void dump(RequestContext requestContext) throws RegistryException { - validateRegistryAction(StratosConstants.THROTTLING_OUT_DATA_ACTION); - } - - @Override - public void restore(RequestContext requestContext) throws RegistryException { - validateRegistryAction(StratosConstants.THROTTLING_IN_DATA_ACTION); - } - - private void validateRegistryAction(String action) throws RegistryException { - if (CurrentSession.getCallerTenantId() == MultitenantConstants.SUPER_TENANT_ID - || CurrentSession.getTenantId() == MultitenantConstants.SUPER_TENANT_ID) { - // no limitations for the super tenant - return; - } - if (CarbonConstants.REGISTRY_SYSTEM_USERNAME.equals(CurrentSession.getUser()) || - CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME.equals(CurrentSession.getUser())) { - // skipping tracking for anonymous and system user - return; - } - - // called only once per request.. - if (CurrentSession.getAttribute(StratosConstants.REGISTRY_ACTION_VALIDATED_SESSION_ATTR) != null) { - return; - } - CurrentSession.setAttribute(StratosConstants.REGISTRY_ACTION_VALIDATED_SESSION_ATTR, true); - - int tenantId = CurrentSession.getTenantId(); - - TenantThrottlingInfo tenantThrottlingInfo = - ThrottlingAgentServiceComponent.getThrottlingAgent().getThrottlingInfoCache() - .getTenantThrottlingInfo(tenantId); - if(tenantThrottlingInfo!=null){ - ThrottlingActionInfo actionInfo = tenantThrottlingInfo.getThrottlingActionInfo(action); - - if (actionInfo != null && actionInfo.isBlocked()) { - String blockedMsg = actionInfo.getMessage(); - String msg = - "The throttling action is blocked. message: " + blockedMsg + ", action: " + - action + "."; - log.error(msg); - // we are only throwing the blocked exception, as it is a error - // message for the user - throw new RegistryException(blockedMsg); - } - } - } - - public static void registerPerRegistryRequestListener(RegistryContext registryContext) { - HandlerManager handlerManager = registryContext.getHandlerManager(); - PerRegistryRequestListener storeBandwidthHandler = new PerRegistryRequestListener(); - URLMatcher anyUrlMatcher = new URLMatcher(); - anyUrlMatcher.setPattern(".*"); - String[] applyingFilters = - new String[] { Filter.PUT, Filter.IMPORT, Filter.GET, Filter.DUMP, Filter.RESTORE, }; - - handlerManager.addHandlerWithPriority( - applyingFilters, anyUrlMatcher, storeBandwidthHandler); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/PerUserAddListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/PerUserAddListener.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/PerUserAddListener.java deleted file mode 100644 index f4ec4be..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/PerUserAddListener.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.listeners; - -import org.apache.stratos.throttling.agent.cache.ThrottlingActionInfo; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.CarbonConstants; -import org.wso2.carbon.base.ServerConfiguration; -import org.apache.stratos.common.constants.StratosConstants; -import org.apache.stratos.throttling.agent.cache.TenantThrottlingInfo; -import org.apache.stratos.throttling.agent.internal.ThrottlingAgentServiceComponent; -import org.wso2.carbon.user.core.UserStoreException; -import org.wso2.carbon.user.core.UserStoreManager; -import org.wso2.carbon.user.core.common.AbstractUserStoreManagerListener; -import org.wso2.carbon.user.core.listener.AuthorizationManagerListener; -import org.wso2.carbon.utils.multitenancy.MultitenantConstants; - -import java.util.Map; - -public class PerUserAddListener extends AbstractUserStoreManagerListener { - private static final Log log = LogFactory.getLog(PerUserAddListener.class); - - public int getExecutionOrderId() { - return AuthorizationManagerListener.MULTITENANCY_USER_RESTRICTION_HANDLER; - } - - @Override - public boolean addUser(String userName, Object credential, String[] roleList, - Map<String, String> claims, String profileName, UserStoreManager userStoreManager) - throws UserStoreException { - - //If this is not a cloud deployment there is no way to run the throttling rules - //This means the product is being used in the tenant mode - //Therefore we can ommit running the throttling rules - if("false".equals(ServerConfiguration.getInstance().getFirstProperty(CarbonConstants.IS_CLOUD_DEPLOYMENT))){ - log.info("Omitting executing throttling rules becasue this is not a cloud deployment."); - return true; - } - int tenantId = userStoreManager.getTenantId(); - if (tenantId == MultitenantConstants.SUPER_TENANT_ID) { - return true; - } - // running the rules invoking the remote throttling manager. - String[] users = userStoreManager.listUsers("*", -1); - if (users.length <= 1) { - // no filtering if the users count < 1 - return true; - } - - try { - ThrottlingAgentServiceComponent.getThrottlingAgent().executeManagerThrottlingRules(tenantId); - ThrottlingAgentServiceComponent.getThrottlingAgent().updateThrottlingCacheForTenant(); - } catch (Exception e1) { - String msg = "Error in executing the throttling rules in manager."; - log.error(msg + " tenantId: " + tenantId + ".", e1); - throw new UserStoreException(msg, e1); - } - TenantThrottlingInfo throttlingInfo = ThrottlingAgentServiceComponent.getThrottlingAgent() - .getThrottlingInfoCache().getTenantThrottlingInfo(tenantId); - if(throttlingInfo!=null){ - ThrottlingActionInfo actionInfo = throttlingInfo.getThrottlingActionInfo(StratosConstants.THROTTLING_ADD_USER_ACTION); - - if (actionInfo!=null && actionInfo.isBlocked()) { - String blockedMsg = actionInfo.getMessage(); - String msg = "The add user action is blocked. message: " + blockedMsg + "."; - log.error(msg); - // we are only throwing the blocked exception, as it is a error message for the user - throw new UserStoreException(blockedMsg); - } - } - return true; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/ServiceRequestListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/ServiceRequestListener.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/ServiceRequestListener.java deleted file mode 100644 index 5498b86..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/ServiceRequestListener.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.listeners; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.context.MessageContext; -import org.apache.axis2.description.AxisService; -import org.apache.axis2.description.Parameter; -import org.apache.axis2.handlers.AbstractHandler; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.common.constants.StratosConstants; -import org.wso2.carbon.core.transports.metering.MeteredServletRequest; -import org.apache.stratos.throttling.agent.cache.ThrottlingActionInfo; -import org.apache.stratos.throttling.agent.cache.ThrottlingInfoCache; -import org.apache.stratos.throttling.agent.internal.ThrottlingAgentServiceComponent; - -/** - * Checks whether the axis2 operations (service calls) are allowed. - */ -public class ServiceRequestListener extends AbstractHandler { - private static final Log log = LogFactory.getLog(ServiceRequestListener.class); - - public InvocationResponse invoke(MessageContext messageContext) throws AxisFault { - if (log.isDebugEnabled()) { - log.debug("Staring throttling handler invocation. Incoming message: " + - messageContext.getEnvelope().toString()); - } - AxisService service = messageContext.getAxisService(); - Parameter param = service.getParameter("adminService"); - - if (param != null && "true".equals(param.getValue())) { - //We will allow admin services to proceed. - return InvocationResponse.CONTINUE; - } - - int tenantId = getTenantId(messageContext); - if(tenantId <= 0){ - //We can allow all super tenant actions - return InvocationResponse.CONTINUE; - } - - ThrottlingInfoCache throttlingInfoCache = ThrottlingAgentServiceComponent.getThrottlingAgent().getThrottlingInfoCache(); - String[] actions = new String[]{StratosConstants.THROTTLING_SERVICE_IN_BANDWIDTH_ACTION, - StratosConstants.THROTTLING_SERVICE_OUT_BANDWIDTH_ACTION, - StratosConstants.THROTTLING_SERVICE_REQUEST_ACTION, - StratosConstants.THROTTLING_SERVICE_RESPONSE_ACTION - }; - ThrottlingActionInfo actionInfo = throttlingInfoCache.getTenantThrottlingInfo(tenantId).getThrottlingActionInfo(actions); - - if (actionInfo.isBlocked()) { - String blockedMsg = actionInfo.getMessage(); - String msg = "The throttling action is blocked. message: " + blockedMsg; - log.error(msg); - // we are only throwing the blocked exception, as it is a error message for the user - throw new AxisFault(blockedMsg); - } - - return InvocationResponse.CONTINUE; - } - - private int getTenantId(MessageContext messageContext) { - Object obj = messageContext.getProperty("transport.http.servletRequest"); - if (obj == null) { - // TODO: check for cause of the error. - log.debug("Servlet request is null. Skip monitoring."); - return 0; - } - if (!(obj instanceof MeteredServletRequest)) { - log.debug("HttpServletRequest is not of type MeteredServletRequest. Skip monitoring."); - return 0; - } - - MeteredServletRequest servletRequest = (MeteredServletRequest) obj; - String address = servletRequest.getRequestURI(); - String servicesPrefix = "/services/t/"; - if (address != null && address.contains(servicesPrefix)) { - int domainNameStartIndex = - address.indexOf(servicesPrefix) + servicesPrefix.length(); - int domainNameEndIndex = address.indexOf('/', domainNameStartIndex); - String domainName = address.substring(domainNameStartIndex, - domainNameEndIndex == -1 ? address.length() : domainNameEndIndex); - - // return tenant id if domain name is not null - if (domainName != null) { - try { - return ThrottlingAgentServiceComponent.getThrottlingAgent().getRealmService().getTenantManager().getTenantId(domainName); - } catch (org.wso2.carbon.user.api.UserStoreException e) { - log.error("An error occurred while obtaining the tenant id.", e); - } - } - } - - // return 0 if the domain name is null - return 0; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/ThrottlingModule.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/ThrottlingModule.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/ThrottlingModule.java deleted file mode 100644 index 04d956d..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/ThrottlingModule.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.listeners; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.description.AxisDescription; -import org.apache.axis2.description.AxisModule; -import org.apache.axis2.modules.Module; -import org.apache.neethi.Assertion; -import org.apache.neethi.Policy; - -/** - * - */ -public class ThrottlingModule implements Module { - - public void applyPolicy(Policy arg0, AxisDescription arg1) throws AxisFault { - } - - public boolean canSupportAssertion(Assertion arg0) { - return true; - } - - public void engageNotify(AxisDescription arg0) throws AxisFault { - } - - public void init(ConfigurationContext arg0, AxisModule arg1) throws AxisFault { - } - - public void shutdown(ConfigurationContext arg0) throws AxisFault { - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/WebAppRequestListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/WebAppRequestListener.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/WebAppRequestListener.java deleted file mode 100644 index cd7fec9..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/listeners/WebAppRequestListener.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.listeners; - -import org.apache.stratos.throttling.agent.cache.ThrottlingActionInfo; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.CarbonContext; -import org.apache.stratos.common.constants.StratosConstants; -import org.apache.stratos.throttling.agent.ThrottlingAgent; -import org.apache.stratos.throttling.agent.cache.TenantThrottlingInfo; -import org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve; -import org.wso2.carbon.user.api.UserStoreException; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class WebAppRequestListener implements CarbonTomcatValve { - - private static final Log log = LogFactory.getLog(WebAppRequestListener.class); - - private static final Pattern servicesURLPattern = Pattern.compile("\\/services\\/t\\/(.*?)\\/"); - private static final Pattern webAppsURLPattern = Pattern.compile("\\/t\\/(.*?)\\/webapps\\/"); - - private static final String CONTEXT_SERVICES = "services"; - private static final String CONTEXT_WEBAPPS = "webapps"; - - private ThrottlingAgent throttlingAgent; - - public WebAppRequestListener(ThrottlingAgent throttlingAgent) { - this.throttlingAgent = throttlingAgent; - } - - public void invoke(HttpServletRequest request, HttpServletResponse response) { - String requestURI = request.getRequestURI(); - String tenantDomainName = CarbonContext.getCurrentContext(). - getTenantDomain(); - String urlContext = getContext(requestURI); - if (tenantDomainName != null && urlContext != null) { - try { - int tenantId = throttlingAgent.getRealmService().getTenantManager(). - getTenantId(tenantDomainName); - if (tenantId <= 0) { - //Allow to proceed - } else { - if (!throttlingAgent.getRealmService().getTenantManager().getTenant(tenantId). - isActive()) { - //Check weather activated tenant or not - String msg = "You are sending request to a deactivated tenant. for Domain: " - + tenantDomainName; - log.error(msg); - try { - response.sendError(403, msg); - } catch (IOException e) { - String message = "Error in sending throttling rule violation message by an inactive tenant." + - " Tenant Domain: " + tenantDomainName; - log.error(message, e); - } - } else { - //check weather request come to webapps - if (CONTEXT_WEBAPPS.equals(urlContext)) { - //if tenant is active we will throttle other parameters such as bandwidth in/out - try { - TenantThrottlingInfo throttlingInfo = - throttlingAgent.getThrottlingInfoCache(). - getTenantThrottlingInfo(tenantId); - if (throttlingInfo != null) { - String[] actions = - new String[]{StratosConstants.THROTTLING_WEBAPP_IN_BANDWIDTH_ACTION, - StratosConstants.THROTTLING_WEBAPP_OUT_BANDWIDTH_ACTION}; - ThrottlingActionInfo actionInfo; - - actionInfo = throttlingInfo.getThrottlingActionInfo(actions); - if (actionInfo != null && actionInfo.isBlocked()) { - String blockedMsg = actionInfo.getMessage(); - String msg = "This action is blocked. Reason: " - + blockedMsg; - log.error(msg); - response.sendError(509, msg); - } - } - } catch (Exception ex) { - String msg = "Error in sending throttling rule violation message." + - " Tenant Domain: " + tenantDomainName; - log.error(msg, ex); - return; - } - } else if (CONTEXT_SERVICES.equals(urlContext)) { - try { - TenantThrottlingInfo throttlingInfo = - throttlingAgent.getThrottlingInfoCache(). - getTenantThrottlingInfo(tenantId); - if (throttlingInfo != null) { - String[] actions = - new String[]{StratosConstants.THROTTLING_SERVICE_IN_BANDWIDTH_ACTION, - StratosConstants.THROTTLING_SERVICE_OUT_BANDWIDTH_ACTION}; - ThrottlingActionInfo actionInfo; - - actionInfo = throttlingInfo.getThrottlingActionInfo(actions); - if (actionInfo != null && actionInfo.isBlocked()) { - String blockedMsg = actionInfo.getMessage(); - String msg = "This action is blocked. Reason: " + - blockedMsg; - log.error(msg); - response.sendError(509, msg); - } - } - } catch (Exception ex) { - String msg = "Error in sending throttling rule violation message." + - " Tenant Domain: " + tenantDomainName; - log.error(msg, ex); - } - } - - } - } - } catch (UserStoreException e) { - String msg = "Error in getting tenant id to evaluate throttling rule. " + - "Tenant Domain: " + tenantDomainName; - log.error(msg, e); - } - - } - } - - /** - * Extract tenant domain from request url - * - * @return tenant domain - */ - public String getTenantName(String requestUrl) { - Matcher matcher = servicesURLPattern.matcher(requestUrl); - if (matcher.find()) { - return matcher.group(1); - } - - matcher = webAppsURLPattern.matcher(requestUrl); - if (matcher.find()) { - return matcher.group(1); - } - - return MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; - } - - /** - * Extract context from the request url - * - * @return context string - */ - public String getContext(String requestUrl) { - if (requestUrl.contains("/services") && requestUrl.contains("/t")) { - return CONTEXT_SERVICES; - } - - if (requestUrl.contains("/t") && requestUrl.contains("/webapps")) { - return CONTEXT_WEBAPPS; - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/validation/ValidationException.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/validation/ValidationException.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/validation/ValidationException.java deleted file mode 100644 index f0f8737..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/validation/ValidationException.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.validation; - -public class ValidationException extends Exception { - public ValidationException(String msg, Exception e) { - super(msg, e); - } - public ValidationException(String msg) { - super(msg); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/validation/ValidationInfo.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/validation/ValidationInfo.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/validation/ValidationInfo.java deleted file mode 100644 index d313e28..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/validation/ValidationInfo.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.validation; - -public class ValidationInfo { - boolean isActionBlocked; - String blockedActionMsg; - - public ValidationInfo(){ - isActionBlocked = false; - } - - public boolean isActionBlocked() { - return isActionBlocked; - } - public void setActionBlocked(boolean isBlocked) { - this.isActionBlocked = isBlocked; - } - public String getBlockedActionMsg() { - return blockedActionMsg; - } - public void setBlockedActionMsg(String blockedMsg) { - this.blockedActionMsg = blockedMsg; - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/validation/ValidationInfoRetriever.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/validation/ValidationInfoRetriever.java b/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/validation/ValidationInfoRetriever.java deleted file mode 100644 index b65b1c5..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/java/org/apache/stratos/throttling/agent/validation/ValidationInfoRetriever.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.stratos.throttling.agent.validation; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.registry.core.RegistryConstants; -import org.wso2.carbon.registry.core.Resource; -import org.wso2.carbon.registry.core.exceptions.RegistryException; -import org.wso2.carbon.registry.core.session.UserRegistry; -import org.apache.stratos.common.constants.StratosConstants; -import org.apache.stratos.common.util.MeteringAccessValidationUtils; - -public class ValidationInfoRetriever { - private static final Log log = LogFactory.getLog(ValidationInfoRetriever.class); - UserRegistry governanceSystemRegistry; - - public ValidationInfoRetriever(UserRegistry governanceSystemRegistry) { - this.governanceSystemRegistry = governanceSystemRegistry; - } - - public ValidationInfo getValidationInfo(String action, int tenantId) throws ValidationException { - ValidationInfo validationInfo = new ValidationInfo(); - Resource validationInfoResource = getResource(tenantId); - if(validationInfoResource == null){ - //this means, the user is allowed to proceed - return validationInfo; - } - - // first get the validation info for all actions - checkAction(StratosConstants.THROTTLING_ALL_ACTION, validationInfoResource, validationInfo); - if (validationInfo.isActionBlocked()) { - return validationInfo; - } - checkAction(action, validationInfoResource, validationInfo); - return validationInfo; - } - - public ValidationInfo getValidationInfo(String[] actions, int tenantId) throws ValidationException { - ValidationInfo validationInfo = new ValidationInfo(); - Resource validationInfoResource = getResource(tenantId); - if(validationInfoResource == null){ - //this means, the user is allowed to proceed - return validationInfo; - } - - // first get the validation info for all actions - checkAction(StratosConstants.THROTTLING_ALL_ACTION, validationInfoResource, validationInfo); - if (validationInfo.isActionBlocked()) { - return validationInfo; - } - - for(String action : actions){ - checkAction(action, validationInfoResource, validationInfo); - if (validationInfo.isActionBlocked()) { - return validationInfo; - } - } - return validationInfo; - } - - private Resource getResource (int tenantId) throws ValidationException{ - // first retrieve validation info for the tenant - String tenantValidationInfoResourcePath = - StratosConstants.TENANT_USER_VALIDATION_STORE_PATH + - RegistryConstants.PATH_SEPARATOR + tenantId; - Resource tenantValidationInfoResource = null; - try { - if (governanceSystemRegistry.resourceExists(tenantValidationInfoResourcePath)) { - tenantValidationInfoResource = - governanceSystemRegistry.get(tenantValidationInfoResourcePath); - } - } catch (RegistryException e) { - String msg = "Error in getting the tenant validation info for tenant:" + tenantId; - log.error(msg, e); - throw new ValidationException(msg, e); - } - return tenantValidationInfoResource; - } - - private void checkAction(String action, Resource tenantValidationInfoResource, - ValidationInfo validationInfo){ - String blockActionStr = - tenantValidationInfoResource.getProperty( - MeteringAccessValidationUtils.generateIsBlockedPropertyKey(action)); - - if ("true".equals(blockActionStr)) { - validationInfo.setActionBlocked(true); - - String blockActionMsg = - tenantValidationInfoResource.getProperty( - MeteringAccessValidationUtils.generateErrorMsgPropertyKey(action)); - validationInfo.setBlockedActionMsg(blockActionMsg); - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/resources/META-INF/module.xml ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/resources/META-INF/module.xml b/components/org.apache.stratos.throttling.agent/src/main/resources/META-INF/module.xml deleted file mode 100644 index dcf21af..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/resources/META-INF/module.xml +++ /dev/null @@ -1,34 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> -<module name="usagethrottling" class="org.apache.stratos.throttling.agent.listeners.ThrottlingModule"> - <InFlow> - <handler name="InFlowUsageThrottlingHandler" - class="org.apache.stratos.throttling.agent.listeners.ServiceRequestListener"> - <order phase="OpPhase" after="AuthorizationHandler"/> - </handler> - </InFlow> - - <InFaultFlow> - <handler name="FaultInFlowUsageThrottlingHandler" - class="org.apache.stratos.throttling.agent.listeners.ServiceRequestListener"> - <order phase="OpPhase" after="AuthorizationHandler"/> - </handler> - </InFaultFlow> - <parameter name="adminModule" locked="true">true</parameter> -</module> http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.agent/src/main/resources/MultitenancyThrottlingService.wsdl ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.agent/src/main/resources/MultitenancyThrottlingService.wsdl b/components/org.apache.stratos.throttling.agent/src/main/resources/MultitenancyThrottlingService.wsdl deleted file mode 100644 index 90248ca..0000000 --- a/components/org.apache.stratos.throttling.agent/src/main/resources/MultitenancyThrottlingService.wsdl +++ /dev/null @@ -1,101 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you 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. - --> - -<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://services.manager.throttling.carbon.wso2.org" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://services.manager.throttling.carbon.wso2.org"> - <wsdl:documentation>MultitenancyThrottlingService</wsdl:documentation> - <wsdl:types> - <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://services.manager.throttling.carbon.wso2.org"> - <xs:element name="executeThrottlingRulesException"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="executeThrottlingRulesException" nillable="true" type="ns:Exception" /> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:complexType name="Exception"> - <xs:sequence> - <xs:element minOccurs="0" name="Message" nillable="true" type="xs:string" /> - </xs:sequence> - </xs:complexType> - <xs:element name="executeThrottlingRules"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="tenantId" type="xs:int" /> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:schema> - </wsdl:types> - <wsdl:message name="executeThrottlingRulesRequest"> - <wsdl:part name="parameters" element="ns:executeThrottlingRules" /> - </wsdl:message> - <wsdl:message name="executeThrottlingRulesException"> - <wsdl:part name="parameters" element="ns:executeThrottlingRulesException" /> - </wsdl:message> - <wsdl:portType name="MultitenancyThrottlingServicePortType"> - <wsdl:operation name="executeThrottlingRules"> - <wsdl:input message="ns:executeThrottlingRulesRequest" wsaw:Action="urn:executeThrottlingRules" /> - <wsdl:fault message="ns:executeThrottlingRulesException" name="executeThrottlingRulesException" wsaw:Action="urn:executeThrottlingRulesexecuteThrottlingRulesException" /> - </wsdl:operation> - </wsdl:portType> - <wsdl:binding name="MultitenancyThrottlingServiceSoap11Binding" type="ns:MultitenancyThrottlingServicePortType"> - <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> - <wsdl:operation name="executeThrottlingRules"> - <soap:operation soapAction="urn:executeThrottlingRules" style="document" /> - <wsdl:input> - <soap:body use="literal" /> - </wsdl:input> - <wsdl:fault name="executeThrottlingRulesException"> - <soap:fault use="literal" name="executeThrottlingRulesException" /> - </wsdl:fault> - </wsdl:operation> - </wsdl:binding> - <wsdl:binding name="MultitenancyThrottlingServiceSoap12Binding" type="ns:MultitenancyThrottlingServicePortType"> - <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> - <wsdl:operation name="executeThrottlingRules"> - <soap12:operation soapAction="urn:executeThrottlingRules" style="document" /> - <wsdl:input> - <soap12:body use="literal" /> - </wsdl:input> - <wsdl:fault name="executeThrottlingRulesException"> - <soap12:fault use="literal" name="executeThrottlingRulesException" /> - </wsdl:fault> - </wsdl:operation> - </wsdl:binding> - <wsdl:binding name="MultitenancyThrottlingServiceHttpBinding" type="ns:MultitenancyThrottlingServicePortType"> - <http:binding verb="POST" /> - <wsdl:operation name="executeThrottlingRules"> - <http:operation location="executeThrottlingRules" /> - <wsdl:input> - <mime:content type="text/xml" part="parameters" /> - </wsdl:input> - </wsdl:operation> - </wsdl:binding> - <wsdl:service name="MultitenancyThrottlingService"> - <wsdl:port name="MultitenancyThrottlingServiceHttpsSoap11Endpoint" binding="ns:MultitenancyThrottlingServiceSoap11Binding"> - <soap:address location="https://192.168.1.100:9443/services/MultitenancyThrottlingService.MultitenancyThrottlingServiceHttpsSoap11Endpoint/" /> - </wsdl:port> - <wsdl:port name="MultitenancyThrottlingServiceHttpsSoap12Endpoint" binding="ns:MultitenancyThrottlingServiceSoap12Binding"> - <soap12:address location="https://192.168.1.100:9443/services/MultitenancyThrottlingService.MultitenancyThrottlingServiceHttpsSoap12Endpoint/" /> - </wsdl:port> - <wsdl:port name="MultitenancyThrottlingServiceHttpsEndpoint" binding="ns:MultitenancyThrottlingServiceHttpBinding"> - <http:address location="https://192.168.1.100:9443/services/MultitenancyThrottlingService.MultitenancyThrottlingServiceHttpsEndpoint/" /> - </wsdl:port> - </wsdl:service> -</wsdl:definitions> http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/pom.xml ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.throttling.manager/pom.xml b/components/org.apache.stratos.throttling.manager/pom.xml deleted file mode 100644 index c83df9c..0000000 --- a/components/org.apache.stratos.throttling.manager/pom.xml +++ /dev/null @@ -1,177 +0,0 @@ -<!-- - # Licensed to the Apache Software Foundation (ASF) under one - # or more contributor license agreements. See the NOTICE file - # distributed with this work for additional information - # regarding copyright ownership. The ASF licenses this file - # to you 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. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>org.apache.stratos</groupId> - <artifactId>stratos-components-parent</artifactId> - <version>4.0.0-SNAPSHOT</version> - </parent> - - <modelVersion>4.0.0</modelVersion> - <artifactId>org.apache.stratos.throttling.manager</artifactId> - <packaging>bundle</packaging> - <name>Apache Stratos - Throttling Manager</name> - - <build> - - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-scr-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <excludes> - <exclude>**/BaseTestCase.java</exclude> - <exclude>**/ThrottlingTest.java</exclude> - </excludes> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - - <extensions>true</extensions> - <configuration> - <instructions> - <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> - <Bundle-Name>${project.artifactId}</Bundle-Name> - <Export-Package> - org.apache.stratos.throttling.manager.dataobjects, - </Export-Package> - <Private-Package> - !org.apache.stratos.throttling.manager.dataobjects, - org.apache.stratos.throttling.manager.*, - </Private-Package> - <!--<Require-Bundle> - drools;visibility:=reexport - </Require-Bundle>--> - <Import-Package> - org.wso2.carbon.rule.*, - org.apache.stratos.common.*, - org.apache.throttling.agent.*, - org.wso2.carbon.billing.mgt.*, - org.wso2.carbon.registry.core.*;version=1.0.1, - org.wso2.carbon.registry.resource.*, - org.quartz.*; version=2.1.1, - !javax.xml.namespace, - javax.xml.namespace; version=0.0.0, - javax.servlet;version="${imp.pkg.version.javax.servlet}", - javax.servlet.http;version="${imp.pkg.version.javax.servlet}", - org.apache.axiom.*; version="${axiom.osgi.version.range}", - *;resolution:=optional - </Import-Package> - <DynamicImport-Package>*</DynamicImport-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> - - <dependencies> - - <dependency> - <groupId>org.apache.axis2.wso2</groupId> - <artifactId>axis2</artifactId> - </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.registry.core</artifactId> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.utils</artifactId> - <version>4.2.0</version> - </dependency> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.registry.extensions</artifactId> - <version>${carbon.platform.version}</version> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.registry.resource</artifactId> - <version>${carbon.platform.version}</version> - </dependency> - <dependency> - <groupId>org.apache.stratos</groupId> - <artifactId>org.apache.stratos.common</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.stratos</groupId> - <artifactId>org.apache.stratos.usage</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.billing.mgt</artifactId> - <version>2.1.3</version> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.rule.kernel</artifactId> - <version>${carbon.platform.version}</version> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.rule.common</artifactId> - <version>${carbon.platform.version}</version> - </dependency> - <dependency> - <groupId>org.wso2.carbon</groupId> - <artifactId>org.wso2.carbon.rule.backend</artifactId> - <version>${carbon.platform.version}</version> - </dependency> - <dependency> - <groupId>org.apache.synapse</groupId> - <artifactId>synapse-tasks</artifactId> - <version>2.1.1-wso2v4</version> - </dependency> - <dependency> - <groupId>org.apache.synapse</groupId> - <artifactId>synapse-commons</artifactId> - <version>2.1.1-wso2v4</version> - </dependency> - <dependency> - <groupId>org.apache.stratos</groupId> - <artifactId>org.apache.stratos.throttling.agent</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.stratos</groupId> - <artifactId>org.apache.stratos.usage.agent</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - -</project>
