http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/conf/ThrottlingConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/conf/ThrottlingConfiguration.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/conf/ThrottlingConfiguration.java
deleted file mode 100644
index 2c43fa4..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/conf/ThrottlingConfiguration.java
+++ /dev/null
@@ -1,107 +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.manager.conf;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.stratos.throttling.manager.exception.ThrottlingException;
-import org.apache.stratos.throttling.manager.tasks.Task;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.common.util.CommonUtil;
-
-public class ThrottlingConfiguration {
-    private static final Log log = 
LogFactory.getLog(ThrottlingConfiguration.class);
-    private static final String CONFIG_NS = 
"http://wso2.com/carbon/multitenancy/usage-throttling-agent/config";;
-    List<ThrottlingTaskConfiguration> throttlingTaskConfigs;
-    List<Task> tasks;
-
-    public ThrottlingConfiguration(String throttlingConfigFile) throws 
ThrottlingException {
-        try {
-            OMElement throttlingConfig =
-                    CommonUtil.buildOMElement(new 
FileInputStream(throttlingConfigFile));
-            deserialize(throttlingConfig);
-        } catch (FileNotFoundException e) {
-            String msg = "Unable to find the file: " + throttlingConfigFile + 
".";
-            log.error(msg, e);
-            throw new ThrottlingException(msg, e);
-        } catch (Exception e) {
-            String msg = "Error in building the throttling config, config 
file: " +
-                            throttlingConfigFile + ".";
-            log.error(msg, e);
-            throw new ThrottlingException(msg, e);
-        }
-    }
-
-    public void deserialize(OMElement throttlingConfigEle) throws 
ThrottlingException {
-        OMElement throttlingManagerConfigs=null;
-        Iterator childElements = throttlingConfigEle.getChildElements();
-        while (childElements.hasNext()) {
-            Object configChildElement = childElements.next();
-
-            if (!(configChildElement instanceof OMElement)) {
-                continue;
-            }
-            OMElement configChildOMElement = (OMElement) configChildElement;
-            if (new QName(CONFIG_NS, "ThrottlingManagerTask", 
"").equals(configChildOMElement.getQName())) {
-               throttlingManagerConfigs=(OMElement)configChildElement;
-            }
-        }
-       // Iterator throttlingConfigChildIt = 
throttlingConfigEle.getChildElements();
-        Iterator throttlingConfigChildIt = 
throttlingManagerConfigs.getChildElements();
-        while (throttlingConfigChildIt.hasNext()) {
-            Object throttlingConfigChild = throttlingConfigChildIt.next();
-            if (!(throttlingConfigChild instanceof OMElement)) {
-                continue;
-            }
-            OMElement throttlingConfigChildEle = (OMElement) 
throttlingConfigChild;
-
-            if (new QName(CONFIG_NS, "tasks", 
"").equals(throttlingConfigChildEle.getQName())) {
-                throttlingTaskConfigs = new 
ArrayList<ThrottlingTaskConfiguration>();
-                tasks = new ArrayList<Task>();
-                Iterator tasksConfigChildIt = 
throttlingConfigChildEle.getChildElements();
-                while (tasksConfigChildIt.hasNext()) {
-                    Object taskConfigChild = tasksConfigChildIt.next();
-                    if (!(taskConfigChild instanceof OMElement)) {
-                        continue;
-                    }
-                    ThrottlingTaskConfiguration taskConfiguration =
-                            new ThrottlingTaskConfiguration((OMElement) 
taskConfigChild);
-                    throttlingTaskConfigs.add(taskConfiguration);
-                    tasks.add(taskConfiguration.getTask());
-                }
-            }
-        }
-    }
-
-       public List<ThrottlingTaskConfiguration> getThrottlingTaskConfigs() {
-               return throttlingTaskConfigs;
-       }
-
-       public List<Task> getThrottlingTasks() {
-               return tasks;
-       }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/conf/ThrottlingTaskConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/conf/ThrottlingTaskConfiguration.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/conf/ThrottlingTaskConfiguration.java
deleted file mode 100644
index 553881b..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/conf/ThrottlingTaskConfiguration.java
+++ /dev/null
@@ -1,120 +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.manager.conf;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.throttling.manager.exception.ThrottlingException;
-import org.apache.stratos.throttling.manager.tasks.Task;
-
-import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-public class ThrottlingTaskConfiguration {
-       private static final Log log =
-               LogFactory.getLog(ThrottlingTaskConfiguration.class);
-
-       private static final String CONFIG_NS =
-               
"http://wso2.com/carbon/multitenancy/usage-throttling-agent/config";;
-       private static final String TASK_CONF_PARAMERTERS = "parameters";
-       private static final String TASK_CONF_DATA_PROVIDERS = "dataProviders";
-       private static final String TASK_CONF_PARAM_KEY = "parameter";
-       private static final String TASK_CONF_PARAM_NAME_KEY = "name";
-
-       public static final String INTERVAL_PARAM_KEY = "interval";
-       public static final String DELAY_PARAM_KEY = "delay";
-
-       Task task;
-       List<ThrottlingTaskDataProviderConfiguration> dataProviderConfigs;
-       Map<String, String> taskParameters;
-
-    public ThrottlingTaskConfiguration(OMElement taskConfigEle) throws 
ThrottlingException {
-        dataProviderConfigs = new 
ArrayList<ThrottlingTaskDataProviderConfiguration>();
-        serialize(taskConfigEle);
-    }
-
-    private void serialize(OMElement taskConfigEle) throws ThrottlingException 
{
-        Iterator taskConfigChildIt = taskConfigEle.getChildElements();
-
-        while (taskConfigChildIt.hasNext()) {
-            Object taskConfigChildObj = taskConfigChildIt.next();
-            if (!(taskConfigChildObj instanceof OMElement)) {
-                continue;
-            }
-            OMElement taskConfigChildEle = (OMElement) taskConfigChildObj;
-            if (taskConfigChildEle.getQName().equals(new QName(CONFIG_NS, 
TASK_CONF_PARAMERTERS))) {
-                Iterator parametersIt = taskConfigChildEle.getChildElements();
-
-                taskParameters = extractTaskParameters(parametersIt);
-            } else if (taskConfigChildEle.getQName().equals(
-                    new QName(CONFIG_NS, TASK_CONF_DATA_PROVIDERS))) {
-                Iterator handlerConfigIt = 
taskConfigChildEle.getChildElements();
-                while (handlerConfigIt.hasNext()) {
-                    Object handlerConfigObj = handlerConfigIt.next();
-                    if (!(handlerConfigObj instanceof OMElement)) {
-                        continue;
-                    }
-                    OMElement handlerConfigEle = (OMElement) handlerConfigObj;
-                    ThrottlingTaskDataProviderConfiguration handlerConfig =
-                            new 
ThrottlingTaskDataProviderConfiguration(handlerConfigEle);
-                    dataProviderConfigs.add(handlerConfig);
-                }
-            }
-        }
-
-        // create the task instance
-        task = new Task(taskParameters, dataProviderConfigs);
-
-    }
-
-       private static Map<String, String> extractTaskParameters(
-               Iterator parameterIt) throws ThrottlingException {
-               Map<String, String> parameters = new HashMap<String, String>();
-               while (parameterIt.hasNext()) {
-                       Object parameterObj = parameterIt.next();
-                       if (!(parameterObj instanceof OMElement)) {
-                               continue;
-                       }
-                       OMElement configChildEle = (OMElement) parameterObj;
-                       if (!new QName(CONFIG_NS, TASK_CONF_PARAM_KEY, "")
-                               .equals(configChildEle.getQName())) {
-                               continue;
-                       }
-                       String paramName =
-                               configChildEle.getAttributeValue(new QName(
-                                       TASK_CONF_PARAM_NAME_KEY));
-                       String paramValue = configChildEle.getText();
-                       parameters.put(paramName, paramValue);
-               }
-               return parameters;
-       }
-
-       public List<ThrottlingTaskDataProviderConfiguration> 
getDataProviderConfigs() {
-               return dataProviderConfigs;
-       }
-
-       public Task getTask() {
-               return task;
-       }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/conf/ThrottlingTaskDataProviderConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/conf/ThrottlingTaskDataProviderConfiguration.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/conf/ThrottlingTaskDataProviderConfiguration.java
deleted file mode 100644
index 5187e2b..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/conf/ThrottlingTaskDataProviderConfiguration.java
+++ /dev/null
@@ -1,117 +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.manager.conf;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.stratos.throttling.manager.dataproviders.DataProvider;
-import org.apache.stratos.throttling.manager.exception.ThrottlingException;
-import org.apache.stratos.throttling.manager.utils.Util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.xml.namespace.QName;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-public class ThrottlingTaskDataProviderConfiguration {
-       private static final Log log =
-               
LogFactory.getLog(ThrottlingTaskDataProviderConfiguration.class);
-
-       private static final String CONFIG_NS =
-               "http://wso2.com/carbon/multitenancy/throttling/config";;
-       private static final String HANDLER_CONF_PARAM_KEY = "parameter";
-       private static final String HANDLER_CLASS_ATTR = "class";
-       private static final String HANDLER_CONF_PARAM_NAME_KEY = "name";
-       private static final String HANDLER_SERVICE_ATTR = "service";
-
-       private String dataProviderServiceName;
-       private Map<String, String> dataProviderParameters;
-       private DataProvider dataProvider;
-       // to keep the task class that are available.
-       private Map<String, DataProvider> dataProviders;
-
-       public ThrottlingTaskDataProviderConfiguration(OMElement 
handlerConfigEle)
-            throws ThrottlingException {
-               serialize(handlerConfigEle);
-               dataProviders = new HashMap<String, DataProvider>();
-       }
-
-    private void serialize(OMElement handlerConfigEle) throws 
ThrottlingException {
-        Iterator handlerParameterChildIt = handlerConfigEle.getChildElements();
-        Map<String, String> parameters = 
extractParameters(handlerParameterChildIt);
-        // get the task class
-        String handlerClassName = handlerConfigEle.getAttributeValue(new 
QName(HANDLER_CLASS_ATTR));
-
-        if (handlerClassName == null) {
-            dataProviderServiceName =
-                    handlerConfigEle.getAttributeValue(new 
QName(HANDLER_SERVICE_ATTR));
-            dataProviderParameters = parameters;
-        } else {
-            dataProvider = (DataProvider) 
Util.constructObject(handlerClassName);
-            dataProvider.init(parameters);
-        }
-    }
-
-    private static Map<String, String> extractParameters(Iterator parameterIt)
-            throws ThrottlingException {
-        Map<String, String> parameters = new HashMap<String, String>();
-        while (parameterIt.hasNext()) {
-            Object parameterObj = parameterIt.next();
-            if (!(parameterObj instanceof OMElement)) {
-                continue;
-            }
-            OMElement configChildEle = (OMElement) parameterObj;
-            if (!new QName(CONFIG_NS, HANDLER_CONF_PARAM_KEY, 
"").equals(configChildEle.getQName())) {
-                continue;
-            }
-            String paramName =
-                    configChildEle.getAttributeValue(new 
QName(HANDLER_CONF_PARAM_NAME_KEY));
-            String paramValue = configChildEle.getText();
-            parameters.put(paramName, paramValue);
-        }
-        return parameters;
-    }
-
-       // get task have to be called to initialize tasks which are registered 
as
-       // OSGI services
-       public DataProvider getDataProvider() throws ThrottlingException {
-               if (dataProvider == null && dataProviderServiceName != null) {
-                       dataProvider = 
dataProviders.get(dataProviderServiceName);
-                       if (dataProvider == null) {
-                               String msg =
-                                       "The scheduler helper service: " +
-                                               dataProviderServiceName + " is 
not loaded.";
-                               log.error(msg);
-                               throw new ThrottlingException(msg);
-                       }
-                       dataProvider.init(dataProviderParameters);
-               }
-               return dataProvider;
-       }
-
-       public void loadDataProviderService() throws ThrottlingException {
-               if (dataProvider == null && dataProviderServiceName != null) {
-                       dataProvider = 
dataProviders.get(dataProviderServiceName);
-                       if (dataProvider != null) {
-                               dataProvider.init(dataProviderParameters);
-                       }
-               }
-       }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingAccessValidation.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingAccessValidation.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingAccessValidation.java
deleted file mode 100644
index 0721dd4..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingAccessValidation.java
+++ /dev/null
@@ -1,73 +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.manager.dataobjects;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-public class ThrottlingAccessValidation {
-
-    Map<String, Boolean> userBlockedActions = new HashMap<String, Boolean>();
-    Map<String, Boolean> tenantBlockedActions = new HashMap<String, Boolean>();
-    Map<String, String> userBlockedMsgs = new HashMap<String, String>();
-    Map<String, String> tenantBlockedMsgs = new HashMap<String, String>();
-
-    boolean persistValidationInfo = true;
-
-    public boolean isPersistValidationInfo() {
-        return persistValidationInfo;
-    }
-
-    public void setPersistValidationInfo(boolean persistValidationInfo) {
-        this.persistValidationInfo = persistValidationInfo;
-    }
-
-    public boolean isUserBlocked(String action) {
-        Boolean result = userBlockedActions.get(action);
-        return result == null? false: result;
-    }
-
-    public String getUserBlockedMsg(String action) {
-        return userBlockedMsgs.get(action);
-    }
-
-    public void setUserBlocked(String action, boolean block, String msg) {
-        userBlockedActions.put(action, block);
-        userBlockedMsgs.put(action, msg);
-    }
-
-    public boolean isTenantBlocked(String action) {
-        Boolean result = tenantBlockedActions.get(action);
-        return result == null? false: result;
-    }
-
-    public String getTenantBlockedMsg(String action) {
-        return tenantBlockedMsgs.get(action);
-    }
-
-    public void setTenantBlocked(String action, boolean block, String msg) {
-        tenantBlockedActions.put(action, block);
-        tenantBlockedMsgs.put(action, msg);
-    }
-
-    public Set<String> getActions() {
-       return tenantBlockedActions.keySet();
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingDataContext.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingDataContext.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingDataContext.java
deleted file mode 100644
index bbe5ac2..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingDataContext.java
+++ /dev/null
@@ -1,148 +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.manager.dataobjects;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-public class ThrottlingDataContext {
-    int tenantId;
-    String userName;
-    Map<String, ThrottlingDataEntry> data;
-    boolean async = false;
-    String taskName = null;
-
-    private ThrottlingAccessValidation accessValidation;
-    boolean processingComplete;
-
-    public ThrottlingDataContext(int tenantId) {
-        this.tenantId = tenantId;
-        this.data = new HashMap<String, ThrottlingDataEntry>();
-    }
-
-    public int getTenantId() {
-        return tenantId;
-    }
-
-    public void setTenantId(int tenantId) {
-        this.tenantId = tenantId;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-
-    public ThrottlingAccessValidation getAccessValidation() {
-        return accessValidation;
-    }
-
-    public void setAccessValidation(ThrottlingAccessValidation 
accessValidation) {
-        this.accessValidation = accessValidation;
-    }
-
-    public boolean isProcessingComplete() {
-        return processingComplete;
-    }
-
-    public void setProcessingComplete(boolean processingComplete) {
-        this.processingComplete = processingComplete;
-    }
-
-    public Collection<ThrottlingDataEntry> getData() {
-        return data.values();
-    }
-
-    public void addDataString(String key, String value) {
-        ThrottlingDataEntry dataEntry = new ThrottlingDataEntry(key);
-        dataEntry.setStringValue(value);
-        data.put(key, dataEntry);
-    }
-
-    public void addDataLong(String key, long value) {
-        ThrottlingDataEntry dataEntry = new ThrottlingDataEntry(key);
-        dataEntry.setLongValue(value);
-        data.put(key, dataEntry);
-    }
-
-    public void addDataInt(String key, int value) {
-        ThrottlingDataEntry dataEntry = new ThrottlingDataEntry(key);
-        dataEntry.setIntValue(value);
-        data.put(key, dataEntry);
-    }
-
-    public void addDataObject(String key, Object value) {
-        ThrottlingDataEntry dataEntry = new ThrottlingDataEntry(key);
-        dataEntry.setObjectValue(value);
-        data.put(key, dataEntry);
-    }
-
-    public String getDataString(String key) {
-        ThrottlingDataEntry dataEntry = data.get(key);
-        if (dataEntry == null) {
-            return null;
-        }
-        return dataEntry.getStringValue();
-    }
-
-    public long getDataLong(String key) {
-        ThrottlingDataEntry dataEntry = data.get(key);
-        if (dataEntry == null) {
-            return 0;
-        }
-        return dataEntry.getLongValue();
-    }
-
-    public int getDataInt(String key) {
-        ThrottlingDataEntry dataEntry = data.get(key);
-        if (dataEntry == null) {
-            return 0;
-        }
-        return dataEntry.getIntValue();
-    }
-
-    public Object getDataObject(String key) {
-        ThrottlingDataEntry dataEntry = data.get(key);
-        if (dataEntry == null) {
-            return null;
-        }
-        return dataEntry.getObjectValue();
-    }
-
-    public boolean isAsync() {
-        return async;
-    }
-
-    public void setAsync(boolean async) {
-        this.async = async;
-    }
-
-    public String getTaskName() {
-        return taskName;
-    }
-
-    public void setTaskName(String taskName) {
-        this.taskName = taskName;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingDataEntry.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingDataEntry.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingDataEntry.java
deleted file mode 100644
index 9941e76..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingDataEntry.java
+++ /dev/null
@@ -1,87 +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.manager.dataobjects;
-
-public class ThrottlingDataEntry {
-    String key;
-    String stringValue;
-    int intValue;
-    long longValue;
-    Object objectValue;
-
-    // here we are not using enums, as pojo services may not support that.
-    // 1 - String, 2 - Int, 3 - long, 4 - object
-    int valueType;
-
-    public ThrottlingDataEntry(String key) {
-        this.key = key;
-    }
-
-    public String getKey() {
-        return key;
-    }
-
-    public void setKey(String key) {
-        this.key = key;
-    }
-
-    public String getStringValue() {
-        return stringValue;
-    }
-
-    public void setStringValue(String stringValue) {
-        this.stringValue = stringValue;
-        valueType = 1;
-    }
-
-    public int getIntValue() {
-        return intValue;
-    }
-
-    public void setIntValue(int intValue) {
-        this.intValue = intValue;
-        valueType = 2;
-    }
-
-    public long getLongValue() {
-        return longValue;
-    }
-
-    public void setLongValue(long longValue) {
-        this.longValue = longValue;
-        valueType = 3;
-    }
-
-    public Object getObjectValue() {
-        return objectValue;
-    }
-
-    public void setObjectValue(Object objectValue) {
-        this.objectValue = objectValue;
-        valueType = 4;
-    }
-
-    public int getValueType() {
-        return valueType;
-    }
-
-    public void setValueType(int valueType) {
-        this.valueType = valueType;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingDataEntryConstants.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingDataEntryConstants.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingDataEntryConstants.java
deleted file mode 100644
index 2130287..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataobjects/ThrottlingDataEntryConstants.java
+++ /dev/null
@@ -1,44 +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.manager.dataobjects;
-
-public class ThrottlingDataEntryConstants {
-
-    final public static String TENANT_INCOMING_BANDWIDTH = 
"tenantIncomingBandwidth";
-    final public static String TENANT_OUTGOING_BANDWIDTH = 
"tenantOutgoingBandwidth";
-
-    final public static String TENANT_CAPACITY = "tenantCapacity";
-    final public static String TENANT_HISTORY_CAPACITY = 
"tenantHistoryCapacity";
-
-    final public static String USERS_COUNT = "usersCount";
-
-    // some custom objects
-    final public static String CUSTOMER = "customer";
-    final public static String PACKAGE = "package";
-    final public static String USER_MANAGER = "userManager";
-    final public static String REGISTRY_INCOMING_BANDWIDTH = 
"registryIncomingBandwidth";
-    final public static String REGISTRY_OUTGOING_BANDWIDTH = 
"registryOutgoingBandwidth";
-    final public static String SERVICE_INCOMING_BANDWIDTH = 
"serviceIncomingBandwidth";
-    final public static String SERVICE_OUTGOING_BANDWIDTH = 
"serviceOutgoingBandwidth";
-    final public static String WEBAPP_INCOMING_BANDWIDTH = 
"webappIncomingBandwidth";
-    final public static String WEBAPP_OUTGOING_BANDWIDTH = 
"webappOutgoingBandwidth";
-    final public static String SERVICE_REQUEST_COUNT = "serviceRequestCount";
-    final public static String SERVICE_RESPONSE_COUNT = "serviceResponseCount";
-    
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataproviders/BillingDataProvider.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataproviders/BillingDataProvider.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataproviders/BillingDataProvider.java
deleted file mode 100644
index 48994bf..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataproviders/BillingDataProvider.java
+++ /dev/null
@@ -1,55 +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.manager.dataproviders;
-
-import org.apache.stratos.throttling.manager.dataobjects.ThrottlingDataContext;
-import 
org.apache.stratos.throttling.manager.dataobjects.ThrottlingDataEntryConstants;
-import org.apache.stratos.throttling.manager.exception.ThrottlingException;
-import org.apache.stratos.throttling.manager.utils.Util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.billing.core.dataobjects.Customer;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.billing.mgt.dataobjects.MultitenancyPackage;
-
-public class BillingDataProvider extends DataProvider {
-    private static Log log = LogFactory.getLog(BillingDataProvider.class);
-
-    
-    public void invoke(ThrottlingDataContext dataContext) throws 
ThrottlingException {
-        int tenantId = dataContext.getTenantId();
-        try {
-            Customer customer = Util.getCurrentBillingCustomer(tenantId);
-            dataContext.addDataObject(ThrottlingDataEntryConstants.CUSTOMER, 
customer);
-        } catch (RegistryException e) {
-            String msg = "Error in getting the current customer. tenant id: " 
+ tenantId + ".";
-            log.error(msg, e);
-            throw new ThrottlingException(msg, e);
-        }
-        // getting the package
-        try {
-            MultitenancyPackage mtPackage = 
Util.getCurrentBillingPackage(tenantId);
-            dataContext.addDataObject(ThrottlingDataEntryConstants.PACKAGE, 
mtPackage);
-        } catch (RegistryException e) {
-            String msg = "Error in getting the multi-tenancy package. tenant 
id: " + tenantId + ".";
-            log.error(msg, e);
-            throw new ThrottlingException(msg, e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataproviders/DataProvider.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataproviders/DataProvider.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataproviders/DataProvider.java
deleted file mode 100644
index 0df2b12..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataproviders/DataProvider.java
+++ /dev/null
@@ -1,38 +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.manager.dataproviders;
-
-import org.apache.stratos.throttling.manager.dataobjects.ThrottlingDataContext;
-import org.apache.stratos.throttling.manager.exception.ThrottlingException;
-
-import java.util.Map;
-
-public abstract class DataProvider {
-    Map<String, String> parameters;
-
-    public void init(Map<String, String> parameters) throws 
ThrottlingException {
-        this.parameters = parameters;
-    }
-
-    public Map<String, String> getParameters() {
-        return parameters;
-    }
-
-    public abstract void invoke(ThrottlingDataContext dataContext) throws 
ThrottlingException;
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataproviders/UsageDataProvider.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataproviders/UsageDataProvider.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataproviders/UsageDataProvider.java
deleted file mode 100644
index de8b689..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/dataproviders/UsageDataProvider.java
+++ /dev/null
@@ -1,106 +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.manager.dataproviders;
-
-import java.util.Calendar;
-
-import 
org.apache.stratos.throttling.manager.dataobjects.ThrottlingDataEntryConstants;
-import org.apache.stratos.throttling.manager.exception.ThrottlingException;
-import org.apache.stratos.throttling.manager.utils.Util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.throttling.manager.dataobjects.ThrottlingDataContext;
-import org.apache.stratos.usage.beans.BandwidthStatistics;
-import org.apache.stratos.usage.beans.RequestStatistics;
-import org.apache.stratos.usage.api.TenantUsageRetriever;
-import org.apache.stratos.usage.beans.TenantUsage;
-
-/**
- *
- */
-public class UsageDataProvider extends DataProvider {
-    private static final Log log = LogFactory.getLog(UsageDataProvider.class);
-    
-    @Override
-    public void invoke(ThrottlingDataContext dataContext) throws 
ThrottlingException {
-        int tenantId = dataContext.getTenantId();
-        String userName = dataContext.getUserName();
-        String yearMonth = Util.getCurrentMonthString(Calendar.getInstance());
-        TenantUsageRetriever tenantUsageRetriever = 
Util.getTenantUsageRetriever();
-        
-        try {
-            TenantUsage usage = tenantUsageRetriever.getTenantUsage(tenantId, 
yearMonth);
-            
-            //Bandwidth usages
-            long tenantIncomingBandwidth = usage.getTotalIncomingBandwidth();
-            long tenantOutgoingBandwidth = usage.getTotalOutgoingBandwidth();
-            
dataContext.addDataLong(ThrottlingDataEntryConstants.TENANT_INCOMING_BANDWIDTH,
-                    tenantIncomingBandwidth);
-            
dataContext.addDataLong(ThrottlingDataEntryConstants.TENANT_OUTGOING_BANDWIDTH,
-                    tenantOutgoingBandwidth);
-            
-            //Registry space capacity
-            long currentTenantCapacity = usage.getRegistryContentCapacity();
-            long historyTenantCapacity = 
usage.getRegistryContentHistoryCapacity();
-            
dataContext.addDataLong(ThrottlingDataEntryConstants.TENANT_CAPACITY,
-                    currentTenantCapacity);
-            
dataContext.addDataLong(ThrottlingDataEntryConstants.TENANT_HISTORY_CAPACITY,
-                    historyTenantCapacity);
-            //Assigning registry bandwidths
-            BandwidthStatistics 
totalRgistryBW=usage.getTotalRegistryBandwidth();
-            
dataContext.addDataLong(ThrottlingDataEntryConstants.REGISTRY_INCOMING_BANDWIDTH,
-                    totalRgistryBW.getIncomingBandwidth());
-            
dataContext.addDataLong(ThrottlingDataEntryConstants.REGISTRY_OUTGOING_BANDWIDTH,
-                    totalRgistryBW.getOutgoingBandwidth());
-
-            //Assigning service bandwidths
-            BandwidthStatistics 
serviceBWStatistic=usage.getTotalServiceBandwidth();
-            
dataContext.addDataLong(ThrottlingDataEntryConstants.SERVICE_INCOMING_BANDWIDTH,
-                    serviceBWStatistic.getIncomingBandwidth());
-            
dataContext.addDataLong(ThrottlingDataEntryConstants.SERVICE_OUTGOING_BANDWIDTH,
-                    serviceBWStatistic.getOutgoingBandwidth());
-            
-            //Assigning webapp bandwidths
-            BandwidthStatistics webappBWStatistic = 
usage.getTotalWebappBandwidth();
-            
dataContext.addDataLong(ThrottlingDataEntryConstants.WEBAPP_INCOMING_BANDWIDTH, 
-                    webappBWStatistic.getIncomingBandwidth());
-            
dataContext.addDataLong(ThrottlingDataEntryConstants.WEBAPP_OUTGOING_BANDWIDTH, 
-                    webappBWStatistic.getOutgoingBandwidth());
-            
-            //Assigning service requests and response
-            RequestStatistics requestStat = usage.getTotalRequestStatistics();
-            
dataContext.addDataLong(ThrottlingDataEntryConstants.SERVICE_REQUEST_COUNT, 
-                    requestStat.getRequestCount());
-            
dataContext.addDataLong(ThrottlingDataEntryConstants.SERVICE_RESPONSE_COUNT, 
-                    requestStat.getResponseCount());
-            
-            //Get number of users
-            int usersCount = usage.getNumberOfUsers();
-            dataContext.addDataInt(ThrottlingDataEntryConstants.USERS_COUNT, 
usersCount);
-
-        } catch (Exception e) {
-            String msg = "Error in retrieving Usage information. " + "tenant 
id: " + tenantId
-                    + ", user name: " + userName + ".";
-            log.error(msg, e);
-            throw new ThrottlingException(msg, e);
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/exception/ThrottlingException.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/exception/ThrottlingException.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/exception/ThrottlingException.java
deleted file mode 100644
index 681a253..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/exception/ThrottlingException.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.manager.exception;
-
-public class ThrottlingException extends Exception{
-    public ThrottlingException(String msg, Exception e) {
-        super(msg, e);
-    }
-    public ThrottlingException(String msg) {
-        super(msg);
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/internal/ThrottlingManagerServiceComponent.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/internal/ThrottlingManagerServiceComponent.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/internal/ThrottlingManagerServiceComponent.java
deleted file mode 100644
index 231e63b..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/internal/ThrottlingManagerServiceComponent.java
+++ /dev/null
@@ -1,129 +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.manager.internal;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.throttling.manager.utils.Util;
-import org.osgi.service.component.ComponentContext;
-import org.wso2.carbon.billing.core.BillingManager;
-import org.wso2.carbon.registry.core.service.RegistryService;
-import org.wso2.carbon.rule.kernel.config.RuleEngineConfigService;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.billing.mgt.api.MultitenancyBillingInfo;
-import org.apache.stratos.usage.api.TenantUsageRetriever;
-
-/**
- * @scr.component name="org.wso2.carbon.throttling.manager"
- * 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="billingManager.service"
- * interface="org.wso2.carbon.billing.core.BillingManager" cardinality="1..1"
- * policy="dynamic" bind="setBillingManager" unbind="unsetBillingManager"
- * @scr.reference name="rule.engine.config.server.component"
- * interface="org.wso2.carbon.rule.kernel.config.RuleEngineConfigService"
- * cardinality="1..1"
- * policy="dynamic" bind="setRuleEngineConfigService"
- * unbind="unsetRuleEngineConfigService"
- * @scr.reference name="metering.service"
- * interface="org.apache.stratos.usage.api.TenantUsageRetriever" 
cardinality="1..1"
- * policy="dynamic" bind="setTenantUsageRetriever" 
unbind="unsetTenantUsageRetriever"
- * @scr.reference 
name="org.wso2.carbon.billing.mgt.api.MultitenancyBillingInfo"
- * interface="org.wso2.carbon.billing.mgt.api.MultitenancyBillingInfo" 
cardinality="1..1"
- * policy="dynamic" bind="setMultitenancyBillingInfo" 
unbind="unsetMultitenancyBillingInfo"
- */
-public class ThrottlingManagerServiceComponent {
-    private static Log log = 
LogFactory.getLog(ThrottlingManagerServiceComponent.class);
-
-    protected void activate(ComponentContext context) {
-        try {
-            Util.setBundleContext(context.getBundleContext());
-            Util.loadThrottlingRules();
-            Util.registerThrottlingRuleInvoker();
-            Util.initializeThrottling();
-            log.debug(" Multitenancy Throttling Manager bundle is activated ");
-        } catch (Throwable e) {
-            log.error(" Multitenancy Throttling Manager bundle failed 
activating ", e);
-        }
-    }
-
-    protected void deactivate(ComponentContext context) {
-        log.debug("******* Multitenancy Throttling Manager bundle is 
deactivated ******* ");
-    }
-
-    protected void setRegistryService(RegistryService registryService) {
-        Util.setRegistryService(registryService);
-    }
-
-    protected void unsetRegistryService(RegistryService registryService) {
-        Util.setRegistryService(null);
-    }
-
-    protected void setRealmService(RealmService realmService) {
-        Util.setRealmService(realmService);
-    }
-
-    protected void unsetRealmService(RealmService realmService) {
-        Util.setRealmService(null);
-    }
-
-    protected void setBillingManager(BillingManager billingManager) {
-        log.debug("Receiving billingManager service");
-        Util.setBillingManager(billingManager);
-    }
-
-    protected void unsetBillingManager(BillingManager billingManager) {
-        log.debug("Halting billingManager service");
-        Util.setBillingManager(null);
-    }
-
-    protected void setRuleEngineConfigService(RuleEngineConfigService 
ruleEngineConfigService) {
-        Util.setRuleEngineConfigService(ruleEngineConfigService);
-    }
-
-    protected void unsetRuleEngineConfigService(RuleEngineConfigService 
ruleEngineConfigService) {
-        // we are not dynamically removing schedule helpers
-    }
-
-    protected void setTenantUsageRetriever(TenantUsageRetriever 
tenantUsageRetriever) {
-        log.debug("Setting Tenant Usage Retriever service");
-        Util.setTenantUsageRetriever(tenantUsageRetriever);
-    }
-
-    protected void unsetTenantUsageRetriever(TenantUsageRetriever 
tenantUsageRetriever) {
-        log.debug("Unsetting Tenant Usage Retriever service");
-        Util.setBillingManager(null);
-    }
-
-    protected void setMultitenancyBillingInfo(MultitenancyBillingInfo 
mtBillingInfo) {
-        log.debug("Setting MT billing info service");
-        Util.setMultitenancyBillingInfo(mtBillingInfo);
-    }
-
-    protected void unsetMultitenancyBillingInfo(MultitenancyBillingInfo 
mtBillingInfo) {
-        log.debug("Unsetting MT billing info service");
-        Util.setMultitenancyBillingInfo(null);
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/rules/KnowledgeBaseManager.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/rules/KnowledgeBaseManager.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/rules/KnowledgeBaseManager.java
deleted file mode 100644
index 930082b..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/rules/KnowledgeBaseManager.java
+++ /dev/null
@@ -1,73 +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.manager.rules;
-
-import java.util.List;
-
-import org.apache.stratos.throttling.manager.dataobjects.ThrottlingDataContext;
-import org.apache.stratos.throttling.manager.dataobjects.ThrottlingDataEntry;
-import org.apache.stratos.throttling.manager.exception.ThrottlingException;
-import org.apache.stratos.throttling.manager.tasks.Task;
-import org.apache.stratos.throttling.manager.validation.ValidationInfoManager;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class KnowledgeBaseManager {
-    private static final Log log = 
LogFactory.getLog(KnowledgeBaseManager.class);
-
-    public static ThrottlingDataContext feedKnowledgeBase(int tenantId, Task 
task,
-            List<Object> knowledgeBase) throws ThrottlingException {
-        // initialize the throttling context
-        ThrottlingDataContext throttlingDataContext = new 
ThrottlingDataContext(tenantId);
-
-        // prepare data from data providers
-        try {
-            task.prepareData(throttlingDataContext);
-        } catch (ThrottlingException e) {
-            String msg = "Error in preparing throttling data for tenant: " + 
tenantId + ".";
-            log.error(msg, e);
-            throw new ThrottlingException(msg, e);
-        }
-
-        // add data entries with object types separately
-        for (ThrottlingDataEntry dataEntry : throttlingDataContext.getData()) {
-            if (dataEntry.getValueType() == 4) {
-                Object object = dataEntry.getObjectValue();
-                if (object != null) {
-                    knowledgeBase.add(object);
-                }
-            }
-        }
-        // load the access validation data
-        try {
-            ValidationInfoManager.loadValidationDetails(throttlingDataContext);
-        } catch (ThrottlingException e) {
-            String msg = "Error in loading validation details. tenant id: " + 
tenantId + ".";
-            log.error(msg, e);
-            throw new ThrottlingException(msg, e);
-        }
-
-        // add metering data context
-        knowledgeBase.add(throttlingDataContext);
-        // add access validation information
-        knowledgeBase.add(throttlingDataContext.getAccessValidation());
-
-        return throttlingDataContext;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/rules/RuleInvoker.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/rules/RuleInvoker.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/rules/RuleInvoker.java
deleted file mode 100644
index c4a6218..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/rules/RuleInvoker.java
+++ /dev/null
@@ -1,92 +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.manager.rules;
-
-import java.util.List;
-
-import org.apache.stratos.throttling.manager.exception.ThrottlingException;
-import org.apache.stratos.throttling.manager.utils.Util;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.rule.common.Rule;
-import org.wso2.carbon.rule.common.RuleSet;
-import org.wso2.carbon.rule.common.util.Constants;
-import org.wso2.carbon.rule.kernel.backend.RuleBackendRuntime;
-import org.wso2.carbon.rule.kernel.backend.RuleBackendRuntimeFactory;
-import org.wso2.carbon.rule.kernel.backend.Session;
-import org.wso2.carbon.rule.kernel.config.RuleEngineProvider;
-import org.apache.stratos.common.constants.StratosConstants;
-
-public class RuleInvoker {
-    private static final Log log = LogFactory.getLog(RuleInvoker.class);
-    Session session;
-
-    public RuleInvoker() throws ThrottlingException {
-        updateRules();
-    }
-
-    public synchronized void invoke(List<Object> knowledgeBase) throws 
ThrottlingException {
-
-        try {
-            session.execute(knowledgeBase);
-        } catch (Exception e) {
-            String msg = "Error occurred while executing the throttling rules: 
" + e.getMessage();
-            log.error(msg);
-            throw new ThrottlingException(msg, e);
-        }
-    }
-
-    public synchronized void updateRules() throws ThrottlingException {
-        
-        RuleEngineProvider ruleEngineProvider = 
-                
Util.getRuleEngineConfigService().getRuleConfig().getRuleEngineProvider();
-        
-        Class ruleBackendRuntimeFactoryClass;
-        RuleBackendRuntime ruleBackendRuntime;
-        
-        try{
-            ruleBackendRuntimeFactoryClass = 
Class.forName(ruleEngineProvider.getClassName());
-            RuleBackendRuntimeFactory ruleBackendRuntimeFactory = 
-                    (RuleBackendRuntimeFactory) 
ruleBackendRuntimeFactoryClass.newInstance();
-            ruleBackendRuntime = 
-                    
ruleBackendRuntimeFactory.getRuleBackendRuntime(ruleEngineProvider.getProperties(),
 
-                                                                    
Thread.currentThread().getContextClassLoader());
-
-            // create a rule set to add
-            RuleSet ruleSet = new RuleSet();
-            Rule rule = new Rule();
-            rule.setResourceType(Constants.RULE_RESOURCE_TYPE_REGULAR);
-
-            rule.setSourceType(Constants.RULE_SOURCE_TYPE_REGISTRY);
-            rule.setValue("gov:" + StratosConstants.THROTTLING_RULES_PATH);
-            ruleSet.addRule(rule);
-
-            ruleBackendRuntime.addRuleSet(ruleSet);
-
-            this.session = 
ruleBackendRuntime.createSession(Constants.RULE_STATEFUL_SESSION);
-
-        }catch(Exception e){
-
-            String msg = "Error occurred while initializing the rule executing 
environment: " + e.getMessage();
-            log.error(msg);
-            throw new ThrottlingException(msg, e);
-        }
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/rules/RuleProperty.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/rules/RuleProperty.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/rules/RuleProperty.java
deleted file mode 100644
index 7fc45ce..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/rules/RuleProperty.java
+++ /dev/null
@@ -1,45 +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.manager.rules;
-
-public class RuleProperty {
-    String key;
-    String value;
-    
-    public RuleProperty(String key, String value) {
-        this.key = key;
-        this.value = value;
-    }
-
-    public String getKey() {
-        return key;
-    }
-
-    public void setKey(String key) {
-        this.key = key;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/scheduling/ThrottlingJob.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/scheduling/ThrottlingJob.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/scheduling/ThrottlingJob.java
deleted file mode 100644
index d3e78cf..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/scheduling/ThrottlingJob.java
+++ /dev/null
@@ -1,120 +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.manager.scheduling;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.throttling.manager.tasks.Task;
-import org.apache.stratos.throttling.manager.utils.Util;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.apache.stratos.throttling.manager.dataobjects.ThrottlingDataContext;
-import org.apache.stratos.throttling.manager.exception.ThrottlingException;
-import org.apache.stratos.throttling.manager.rules.KnowledgeBaseManager;
-import org.apache.stratos.throttling.manager.rules.RuleInvoker;
-import org.apache.stratos.throttling.manager.validation.ValidationInfoManager;
-import org.wso2.carbon.user.core.UserStoreException;
-import org.wso2.carbon.user.core.tenant.Tenant;
-import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ThrottlingJob implements Job {
-    private static final Log log = LogFactory.getLog(ThrottlingJob.class);
-    public static final String THROTTLING_TASK_CONTEXT_KEY = "throttlingTask";
-
-    public void execute(JobExecutionContext jobExecutionContext) throws 
JobExecutionException {
-        PrivilegedCarbonContext carbonContext = 
PrivilegedCarbonContext.getThreadLocalCarbonContext();
-        carbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
-        Task task = (Task) 
jobExecutionContext.getMergedJobDataMap().get(THROTTLING_TASK_CONTEXT_KEY);
-        executeTask(task);
-    }
-
-    public void executeTask(Task task) throws JobExecutionException {
-        // initialize and prepare the knowledge base.
-        List<Object> knowledgeBase = new ArrayList<Object>();
-        Map<Integer, ThrottlingDataContext> contextMap;
-        try {
-            contextMap = feedKnowledgeBase(task, knowledgeBase);
-        } catch (ThrottlingException e) {
-            String msg = "Error in feeding knowledge base.";
-            log.error(msg, e);
-            throw new JobExecutionException(msg, e);
-        }
-
-        // invoke the rule.
-        RuleInvoker ruleInvoker = task.getRuleInvoker();
-        try {
-            //updating the rule. this is important if we are having more than 
one managers running
-            ruleInvoker.updateRules();
-            ruleInvoker.invoke(knowledgeBase);
-            log.info("Throttling rules executed successfully");
-        } catch (ThrottlingException e) {
-            String msg = "Error in invoking the throttling rule invoker.";
-            log.error(msg, e);
-            throw new JobExecutionException(msg, e);
-        }
-        // now persist the access validation information
-        for (int tenantId : contextMap.keySet()) {
-            ThrottlingDataContext dataContext = contextMap.get(tenantId);
-            try {
-                ValidationInfoManager.persistValidationDetails(dataContext);
-            } catch (ThrottlingException e) {
-                String msg = "Error in persisting validation details. Tenant 
id: " + tenantId + ".";
-                log.error(msg, e);
-                throw new JobExecutionException(msg, e);
-            }
-        }
-    }
-
-    private Map<Integer, ThrottlingDataContext> feedKnowledgeBase(Task task,
-            List<Object> knowledgeBase) throws ThrottlingException {
-        Map<Integer, ThrottlingDataContext> contextMap =
-                new HashMap<Integer, ThrottlingDataContext>();
-        // execute the task for each tenant
-        Tenant[] tenants;
-        try {
-            tenants = Util.getAllTenants();
-        } catch (UserStoreException e) {
-            String msg = "Error in getting all the tenants.";
-            log.error(msg, e);
-            throw new ThrottlingException(msg, e);
-        }
-        // prepare the knowledge base using data on each tenant
-
-        for (Tenant tenant : tenants) {
-            if (!tenant.isActive()) {
-                continue;
-            }
-            int tenantId = tenant.getId();
-
-            ThrottlingDataContext throttlingDataContext =
-                    KnowledgeBaseManager.feedKnowledgeBase(tenantId, task, 
knowledgeBase);
-
-            // store the context in the map.
-            contextMap.put(tenantId, throttlingDataContext);
-        }
-        return contextMap;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/services/MultitenancyThrottlingService.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/services/MultitenancyThrottlingService.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/services/MultitenancyThrottlingService.java
deleted file mode 100644
index 577dca0..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/services/MultitenancyThrottlingService.java
+++ /dev/null
@@ -1,59 +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.manager.services;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.throttling.manager.utils.Util;
-import org.wso2.carbon.core.AbstractAdmin;
-import org.apache.stratos.throttling.agent.client.ThrottlingRuleInvoker;
-import org.apache.stratos.throttling.manager.dataobjects.ThrottlingDataContext;
-import org.apache.stratos.throttling.manager.rules.KnowledgeBaseManager;
-import org.apache.stratos.throttling.manager.rules.RuleInvoker;
-import org.apache.stratos.throttling.manager.tasks.Task;
-import org.apache.stratos.throttling.manager.validation.ValidationInfoManager;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class MultitenancyThrottlingService extends AbstractAdmin implements 
ThrottlingRuleInvoker {
-    
-    private static Log log = 
LogFactory.getLog(MultitenancyThrottlingService.class);
-
-    public void executeThrottlingRules(int tenantId) throws Exception {
-
-        //UserRegistry registry = (UserRegistry) getGovernanceUserRegistry();
-        int currentTenantId = tenantId;
-        
-        List<Task> tasks = Util.getTasks();
-        for (Task task: tasks) {
-            // initialize the knowledge base
-            List<Object> knowledgeBase = new ArrayList<Object>();
-            ThrottlingDataContext throttlingDataContext =
-                    KnowledgeBaseManager.feedKnowledgeBase(currentTenantId, 
task, knowledgeBase);
-
-            RuleInvoker ruleInvoker = task.getRuleInvoker();
-            ruleInvoker.invoke(knowledgeBase);
-
-            log.info("Throttling rules executed for tenant id: " + 
currentTenantId);
-            
-            
ValidationInfoManager.persistValidationDetails(throttlingDataContext);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/services/ThrottlingRuleEditorService.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/services/ThrottlingRuleEditorService.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/services/ThrottlingRuleEditorService.java
deleted file mode 100644
index 4a2ec6e..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/services/ThrottlingRuleEditorService.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.manager.services;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.throttling.manager.tasks.Task;
-import org.apache.stratos.throttling.manager.utils.Util;
-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.throttling.manager.rules.RuleInvoker;
-
-import java.util.List;
-
-/**
- * This is a super tenant service to manage throttling rules
- */
-public class ThrottlingRuleEditorService {
-    private static final Log log = 
LogFactory.getLog(ThrottlingRuleEditorService.class);
-
-    /**
-     * Retrieve Throttling Rules
-     *
-     * @throws Exception, if retrieving the throttling rules failed.
-     * @return, rule content
-     */
-    public String retrieveThrottlingRules() throws Exception {
-        // getting the resource content.
-        UserRegistry systemRegistry = 
Util.getSuperTenantGovernanceSystemRegistry();
-        Resource ruleContentResource = 
systemRegistry.get(StratosConstants.THROTTLING_RULES_PATH);
-        Object ruleContent = ruleContentResource.getContent();
-        if (ruleContent instanceof String) {
-            return (String) ruleContent;
-        } else if (ruleContent instanceof byte[]) {
-            return new String((byte[]) ruleContent);
-        }
-        String msg = "Unidentified type for the registry resource content. 
type: " +
-                     ruleContent.getClass().getName();
-        log.error(msg);
-        throw new Exception(msg);
-    }
-
-    /**
-     * Update throttling rules.
-     *
-     * @param ruleContent - content of the rule.
-     * @throws Exception, if updating the throttling rules failed.
-     */
-    public void updateThrottlingRules(String ruleContent) throws Exception {
-        // updating the rule content
-        boolean updateSuccess = false;
-        UserRegistry systemRegistry = 
Util.getSuperTenantGovernanceSystemRegistry();
-        try {
-            systemRegistry.beginTransaction();
-            Resource ruleContentResource = 
systemRegistry.get(StratosConstants.THROTTLING_RULES_PATH);
-            ruleContentResource.setContent(ruleContent);
-            systemRegistry.put(StratosConstants.THROTTLING_RULES_PATH, 
ruleContentResource);
-
-            List<Task> tasks = Util.getTasks();
-            for (Task task : tasks) {
-                RuleInvoker ruleInvoker = task.getRuleInvoker();
-                ruleInvoker.updateRules();
-            }
-            updateSuccess = true;
-        } finally {
-            if (updateSuccess) {
-                systemRegistry.commitTransaction();
-            } else {
-                systemRegistry.rollbackTransaction();
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/tasks/Task.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/tasks/Task.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/tasks/Task.java
deleted file mode 100644
index 1915eab..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/tasks/Task.java
+++ /dev/null
@@ -1,94 +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.manager.tasks;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.stratos.throttling.manager.conf.ThrottlingTaskConfiguration;
-import org.apache.stratos.throttling.manager.dataproviders.DataProvider;
-import org.apache.stratos.throttling.manager.exception.ThrottlingException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import 
org.apache.stratos.throttling.manager.conf.ThrottlingTaskDataProviderConfiguration;
-import org.apache.stratos.throttling.manager.dataobjects.ThrottlingDataContext;
-import org.apache.stratos.throttling.manager.rules.RuleInvoker;
-import org.apache.stratos.throttling.manager.utils.DataProviderIterator;
-
-public class Task {
-    private static final Log log = LogFactory.getLog(Task.class);
-    private static final int DEFAULT_INTERVAL = 15; // in minute
-    Map<String, String> parameters;
-    DataProviderIterator dataProviderIterator;
-    RuleInvoker ruleInvoker;
-
-    public Task(Map<String, String> parameters,
-            List<ThrottlingTaskDataProviderConfiguration> dataProviderConfigs)
-            throws ThrottlingException {
-        this.parameters = parameters;
-        this.dataProviderIterator = new 
DataProviderIterator(dataProviderConfigs);
-        // initialize the rule invokers
-        ruleInvoker = new RuleInvoker();
-    }
-
-    public void prepareData(ThrottlingDataContext dataContext) throws 
ThrottlingException {
-        dataProviderIterator.reset();
-        while (dataProviderIterator.hasNext()) {
-            final DataProvider dataProvider = (DataProvider) 
dataProviderIterator.next();
-            if (dataProvider == null) {
-                String msg =
-                        "Error in invoking the data provider. " + 
"dataProviderConfigs is null or "
-                                + "data provider is not yet loaded";
-                log.error(msg);
-                throw new ThrottlingException(msg);
-            }
-            dataProvider.invoke(dataContext);
-            if (dataContext.isProcessingComplete()) {
-                break;
-            }
-        }
-    }
-
-    public Map<String, String> getParameters() {
-        return parameters;
-    }
-
-    public int getTriggerInterval() {
-        if (this.parameters == null ||
-                
this.parameters.get(ThrottlingTaskConfiguration.INTERVAL_PARAM_KEY) == null) {
-            return DEFAULT_INTERVAL * 60 * 1000;
-        }
-        return Integer.parseInt(
-                
this.parameters.get(ThrottlingTaskConfiguration.INTERVAL_PARAM_KEY)) * 60 * 
1000;
-    }
-    
-    public int getStartDelayInterval(){
-        if (this.parameters == null || 
-                
this.parameters.get(ThrottlingTaskConfiguration.DELAY_PARAM_KEY) == null){
-            return DEFAULT_INTERVAL * 60 * 1000;
-        }
-        
-        return Integer.parseInt(
-                
this.parameters.get(ThrottlingTaskConfiguration.DELAY_PARAM_KEY)) * 60 * 1000;
-    }
-
-    public RuleInvoker getRuleInvoker() {
-        return ruleInvoker;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/utils/DataProviderIterator.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/utils/DataProviderIterator.java
 
b/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/utils/DataProviderIterator.java
deleted file mode 100644
index 5bd1e02..0000000
--- 
a/components/org.apache.stratos.throttling.manager/src/main/java/org/apache/stratos/throttling/manager/utils/DataProviderIterator.java
+++ /dev/null
@@ -1,72 +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.manager.utils;
-
-import java.util.Iterator;
-import java.util.List;
-
-import 
org.apache.stratos.throttling.manager.conf.ThrottlingTaskDataProviderConfiguration;
-import org.apache.stratos.throttling.manager.exception.ThrottlingException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-// we are dynamically initializing handlers, so uses an iterator to iteration
-public class DataProviderIterator implements Iterator {
-    private static final Log log = 
LogFactory.getLog(DataProviderIterator.class);
-    private ThreadLocal<Integer> index = new ThreadLocal<Integer>() {
-        protected Integer initialValue() {
-            return 0;
-        }
-    };
-    
-    List<ThrottlingTaskDataProviderConfiguration> dataProviderConfigs;
-    
-    public DataProviderIterator(List<ThrottlingTaskDataProviderConfiguration> 
dataProviderConfigs) {
-        this.dataProviderConfigs = dataProviderConfigs;
-        reset();
-    }
-
-    public boolean hasNext() {
-        int i = index.get();
-        return (i < dataProviderConfigs.size());
-    }
-
-    public Object next() {
-        int i = index.get();
-        ThrottlingTaskDataProviderConfiguration handlerConfig = 
dataProviderConfigs.get(i++);
-        index.set(i);
-        try {
-            return handlerConfig.getDataProvider();
-        } catch (ThrottlingException e) {
-            String msg = "DataProvider for the dataProviderConfigs config is 
null. " +
-                       "dataProviderConfigs index: " + (i - 1) + ".";
-            log.error(msg);                        
-        }
-        return null;
-    }
-
-    public void remove() {
-        // doesn't need to be remove
-    }
-
-    // additional method
-    public void reset() {
-        index.set(0);
-    }
-}

Reply via email to