http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/exceptions/NoSampleValuesFoundException.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/exceptions/NoSampleValuesFoundException.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/exceptions/NoSampleValuesFoundException.java deleted file mode 100644 index d94d914..0000000 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/exceptions/NoSampleValuesFoundException.java +++ /dev/null @@ -1,26 +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.cloud.controller.iaases.mock.service.exceptions; - -/** - * No sample values found exception. - */ -public class NoSampleValuesFoundException extends Exception { -}
http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/exceptions/NoStatisticsFoundException.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/exceptions/NoStatisticsFoundException.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/exceptions/NoStatisticsFoundException.java deleted file mode 100644 index 940d24f..0000000 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/exceptions/NoStatisticsFoundException.java +++ /dev/null @@ -1,26 +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.cloud.controller.iaases.mock.service.exceptions; - -/** - * No statistics found exception. - */ -public class NoStatisticsFoundException extends Exception { -} http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/exceptions/StopStatisticsPublishingException.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/exceptions/StopStatisticsPublishingException.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/exceptions/StopStatisticsPublishingException.java deleted file mode 100644 index d31177b..0000000 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/exceptions/StopStatisticsPublishingException.java +++ /dev/null @@ -1,26 +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.cloud.controller.iaases.mock.service.exceptions; - -/** - * Stop statistics publishing exception. - */ -public class StopStatisticsPublishingException extends Exception { -} http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/MockHealthStatistics.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/MockHealthStatistics.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/MockHealthStatistics.java deleted file mode 100644 index d782166..0000000 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/MockHealthStatistics.java +++ /dev/null @@ -1,122 +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.cloud.controller.iaases.mock.service.statistics; - -import org.apache.stratos.cloud.controller.iaases.mock.service.MockAutoscalingFactor; -import org.apache.stratos.cloud.controller.iaases.mock.service.exceptions.NoStatisticsFoundException; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Mock health statistics singleton class. - */ -public class MockHealthStatistics { - private final static int DEFAULT_MEMORY_CONSUMPTION = 20; - private final static int DEFAULT_LOAD_AVERAGE = 20; - private final static int DEFAULT_REQUESTS_IN_FLIGHT = 1; - - private static volatile MockHealthStatistics instance; - - private Map<String, Map<String, Integer>> statisticsMap; - - private MockHealthStatistics() { - statisticsMap = new ConcurrentHashMap<String, Map<String, Integer>>(); - } - - public static MockHealthStatistics getInstance() { - if (instance == null) { - synchronized (MockHealthStatistics.class) { - if (instance == null) { - instance = new MockHealthStatistics(); - } - } - } - return instance; - } - - /** - * Add statistics value for a cartridge type, autoscaling factor - * @param cartridgeType - * @param autoscalingFactor - * @param value - */ - public void addStatistics(String cartridgeType, MockAutoscalingFactor autoscalingFactor, Integer value) { - Map<String, Integer> factorValueMap = statisticsMap.get(cartridgeType); - if(factorValueMap == null) { - synchronized (MockHealthStatistics.class) { - if(factorValueMap == null) { - factorValueMap = new ConcurrentHashMap<String, Integer>(); - statisticsMap.put(cartridgeType, factorValueMap); - } - } - } - factorValueMap.put(autoscalingFactor.toString(), value); - } - - /** - * Returns current statistics of the given cartridge type, autoscaling factor - * @param cartridgeType - * @param autoscalingFactor - * @return - */ - public int getStatistics(String cartridgeType, MockAutoscalingFactor autoscalingFactor) throws NoStatisticsFoundException { - Map<String, Integer> factorValueMap = statisticsMap.get(cartridgeType); - if(factorValueMap != null) { - if(factorValueMap.containsKey(autoscalingFactor.toString())) { - return factorValueMap.get(autoscalingFactor.toString()); - } else { - throw new NoStatisticsFoundException(); - } - } - // No statistics patterns found, return default - return findDefault(autoscalingFactor); - } - - /** - * Remove statistics found for the cartridge type, autoscaling factor - * @param cartridgeType - * @param autoscalingFactor - */ - public void removeStatistics(String cartridgeType, MockAutoscalingFactor autoscalingFactor) { - Map<String, Integer> factorValueMap = statisticsMap.get(cartridgeType); - if(factorValueMap != null) { - if(factorValueMap.containsKey(autoscalingFactor.toString())) { - factorValueMap.remove(autoscalingFactor.toString()); - } - } - } - - /** - * Find default statistics value of the given autoscaling factor - * @param autoscalingFactor - * @return - */ - private int findDefault(MockAutoscalingFactor autoscalingFactor) { - if(autoscalingFactor == MockAutoscalingFactor.MemoryConsumption) { - return DEFAULT_MEMORY_CONSUMPTION; - } else if(autoscalingFactor == MockAutoscalingFactor.LoadAverage) { - return DEFAULT_LOAD_AVERAGE; - } else if(autoscalingFactor == MockAutoscalingFactor.RequestInFlight) { - return DEFAULT_REQUESTS_IN_FLIGHT; - } - throw new RuntimeException("An unknown autoscaling factor found: " + autoscalingFactor); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/StatisticsPatternMode.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/StatisticsPatternMode.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/StatisticsPatternMode.java deleted file mode 100644 index f4a2b39..0000000 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/StatisticsPatternMode.java +++ /dev/null @@ -1,27 +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.cloud.controller.iaases.mock.service.statistics; - -/** - * Statistics pattern mode. - */ -public enum StatisticsPatternMode { - Loop, Continue, Stop -} http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/generator/MockHealthStatisticsGenerator.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/generator/MockHealthStatisticsGenerator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/generator/MockHealthStatisticsGenerator.java deleted file mode 100644 index 2766928..0000000 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/generator/MockHealthStatisticsGenerator.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.cloud.controller.iaases.mock.service.statistics.generator; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.cloud.controller.iaases.mock.service.config.MockIaasConfig; -import org.apache.stratos.common.threading.StratosThreadPool; - -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - -/** - * Mock health statistics generator. - */ -public class MockHealthStatisticsGenerator { - - private static final Log log = LogFactory.getLog(MockHealthStatisticsGenerator.class); - - private static volatile MockHealthStatisticsGenerator instance; - private static final ScheduledExecutorService scheduledExecutorService = - StratosThreadPool.getScheduledExecutorService("MOCK_STATISTICS_GENERATOR_EXECUTOR_SERVICE", 10); - - private boolean scheduled; - // Map<ServiceName, List<ScheduledFuture>> - private Map<String, Map<String, ScheduledFuture>> serviceNameToTaskListMap; - - public static MockHealthStatisticsGenerator getInstance() { - if (instance == null) { - synchronized (MockHealthStatisticsGenerator.class) { - if (instance == null) { - instance = new MockHealthStatisticsGenerator(); - } - } - } - return instance; - } - - private MockHealthStatisticsGenerator() { - serviceNameToTaskListMap = new ConcurrentHashMap<String, Map<String, ScheduledFuture>>(); - } - - /** - * Schedule statistics updater tasks for the given service/cartridge type. - * - * @param serviceName - */ - public void scheduleStatisticsUpdaterTasks(String serviceName) { - synchronized (MockHealthStatisticsGenerator.class) { - if (!statisticsUpdaterTasksScheduled(serviceName)) { - List<MockHealthStatisticsPattern> statisticsPatterns = MockIaasConfig.getInstance(). - getMockHealthStatisticsConfig().getStatisticsPatterns(); - - Map<String, ScheduledFuture> taskList = serviceNameToTaskListMap.get(serviceName); - if (taskList == null) { - taskList = new ConcurrentHashMap<String, ScheduledFuture>(); - serviceNameToTaskListMap.put(serviceName, taskList); - } - - for (MockHealthStatisticsPattern statisticsPattern : statisticsPatterns) { - if (statisticsPattern.getCartridgeType().equals(serviceName) && - (statisticsPattern.getSampleDuration() > 0)) { - MockHealthStatisticsUpdater runnable = new MockHealthStatisticsUpdater(statisticsPattern); - ScheduledFuture<?> task = scheduledExecutorService.scheduleAtFixedRate(runnable, 0, - statisticsPattern.getSampleDuration(), TimeUnit.SECONDS); - taskList.put(statisticsPattern.getFactor().toString(), task); - } - } - - if (log.isInfoEnabled()) { - log.info(String.format("Mock statistics updaters scheduled: [service-name] %s", serviceName)); - } - } - } - } - - /** - * Stop statistics updater tasks of the given service/cartridge type. - * - * @param serviceName - */ - public void stopStatisticsUpdaterTasks(String serviceName) { - synchronized (MockHealthStatisticsGenerator.class) { - Map<String, ScheduledFuture> taskMap = serviceNameToTaskListMap.get(serviceName); - if ((taskMap != null) && (taskMap.size() > 0)) { - Iterator<String> factorIterator = taskMap.keySet().iterator(); - while(factorIterator.hasNext()) { - String factor = factorIterator.next(); - stopStatisticsUpdaterTask(serviceName, factor); - } - } - } - } - - /** - * Stop statistics updater task of a service/cartridge type, factor. - * @param serviceName - * @param factor - */ - public void stopStatisticsUpdaterTask(String serviceName, String factor) { - Map<String, ScheduledFuture> factorToTaskMap = serviceNameToTaskListMap.get(serviceName); - if(factorToTaskMap != null) { - ScheduledFuture task = factorToTaskMap.get(factor); - if(task != null) { - task.cancel(true); - factorToTaskMap.remove(factor); - - if (log.isInfoEnabled()) { - log.info(String.format("Mock statistics updater task stopped: [service-name] %s" + - " [factor] %s", serviceName, factor)); - } - } - } - } - - /** - * Returns true if there are statistics updater tasks scheduled for the given service/cartridge type - * else returns false. - * @param serviceName - * @return - */ - public boolean statisticsUpdaterTasksScheduled(String serviceName) { - Map<String, ScheduledFuture> tasks = serviceNameToTaskListMap.get(serviceName); - return ((tasks != null) && (tasks.size() > 0)); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/generator/MockHealthStatisticsPattern.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/generator/MockHealthStatisticsPattern.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/generator/MockHealthStatisticsPattern.java deleted file mode 100644 index d7db919..0000000 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/generator/MockHealthStatisticsPattern.java +++ /dev/null @@ -1,110 +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.cloud.controller.iaases.mock.service.statistics.generator; - -import org.apache.stratos.cloud.controller.iaases.mock.service.MockAutoscalingFactor; -import org.apache.stratos.cloud.controller.iaases.mock.service.exceptions.ContinueLastSampleValueException; -import org.apache.stratos.cloud.controller.iaases.mock.service.exceptions.NoSampleValuesFoundException; -import org.apache.stratos.cloud.controller.iaases.mock.service.exceptions.StopStatisticsPublishingException; -import org.apache.stratos.cloud.controller.iaases.mock.service.statistics.StatisticsPatternMode; - -import java.util.Iterator; -import java.util.List; - -/** - * Mock health statistics pattern definition. - */ -public class MockHealthStatisticsPattern { - - private String cartridgeType; - private MockAutoscalingFactor factor; - private StatisticsPatternMode mode; - private List<Integer> sampleValues; - private int sampleDuration; - private Iterator sampleValuesIterator; - - public MockHealthStatisticsPattern(String cartridgeType, MockAutoscalingFactor factor, StatisticsPatternMode mode, List<Integer> sampleValues, - int sampleDuration) { - this.cartridgeType = cartridgeType; - this.factor = factor; - this.mode = mode; - this.sampleValues = sampleValues; - this.sampleValuesIterator = this.sampleValues.iterator(); - this.sampleDuration = sampleDuration; - } - - public String getCartridgeType() { - return cartridgeType; - } - - /** - * Returns autoscaling factor - * @return - */ - public MockAutoscalingFactor getFactor() { - return factor; - } - - /** - * Returns statistics pattern mode - * @return - */ - public StatisticsPatternMode getMode() { - return mode; - } - - /** - * Returns next sample value - * @return - */ - public int getNextSample() throws NoSampleValuesFoundException, StopStatisticsPublishingException, - ContinueLastSampleValueException { - if((sampleValues == null) || (sampleValues.size() < 1)) { - throw new NoSampleValuesFoundException(); - } - - if(!sampleValuesIterator.hasNext()) { - // Iterator has come to the end of the list - if(getMode() == StatisticsPatternMode.Loop) { - // Looping: reset the iterator - sampleValuesIterator = sampleValues.iterator(); - return Integer.parseInt(sampleValuesIterator.next().toString()); - } else if(getMode() == StatisticsPatternMode.Continue) { - // Continue: return the last value - int lastSampleValue = Integer.parseInt(sampleValues.get(sampleValues.size() - 1).toString()); - throw new ContinueLastSampleValueException(lastSampleValue); - } else if(getMode() == StatisticsPatternMode.Stop) { - throw new StopStatisticsPublishingException(); - } else { - throw new RuntimeException("An unknown statistics pattern mode found"); - } - } else { - return Integer.parseInt(sampleValuesIterator.next().toString()); - } - } - - /** - * Returns sample duration in seconds - * @return - */ - public int getSampleDuration() { - return sampleDuration; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/generator/MockHealthStatisticsUpdater.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/generator/MockHealthStatisticsUpdater.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/generator/MockHealthStatisticsUpdater.java deleted file mode 100644 index 083aa21..0000000 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/generator/MockHealthStatisticsUpdater.java +++ /dev/null @@ -1,83 +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.cloud.controller.iaases.mock.service.statistics.generator; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.cloud.controller.iaases.mock.service.exceptions.ContinueLastSampleValueException; -import org.apache.stratos.cloud.controller.iaases.mock.service.exceptions.NoSampleValuesFoundException; -import org.apache.stratos.cloud.controller.iaases.mock.service.exceptions.StopStatisticsPublishingException; -import org.apache.stratos.cloud.controller.iaases.mock.service.statistics.MockHealthStatistics; - -/** - * Update health statistics according to the given sample pattern, for each pattern there will be - * one updater runnable created. - */ -public class MockHealthStatisticsUpdater implements Runnable { - - private static final Log log = LogFactory.getLog(MockHealthStatisticsUpdater.class); - - private MockHealthStatisticsPattern statisticsPattern; - - public MockHealthStatisticsUpdater(MockHealthStatisticsPattern statisticsPattern) { - this.statisticsPattern = statisticsPattern; - } - - @Override - public void run() { - try { - int nextSample = statisticsPattern.getNextSample(); - MockHealthStatistics.getInstance().addStatistics(statisticsPattern.getCartridgeType(), - statisticsPattern.getFactor(), nextSample); - - if (log.isInfoEnabled()) { - log.info(String.format("Mock statistics updated: [cartridge-type] %s [factor] %s [value] %d", - statisticsPattern.getCartridgeType(), statisticsPattern.getFactor().toString(), nextSample)); - } - } catch (NoSampleValuesFoundException ignore) { - if (log.isDebugEnabled()) { - log.debug(String.format("No sample values found for: [cartridge-type] %s [factor] %s", - statisticsPattern.getCartridgeType(), statisticsPattern.getFactor().toString())); - } - } catch (ContinueLastSampleValueException e) { - if (log.isInfoEnabled()) { - log.info(String.format("Continuing last sample value: [cartridge-type] %s [factor] %s [value] %d", - statisticsPattern.getCartridgeType(), statisticsPattern.getFactor().toString(), - e.getLastSampleValue())); - } - // Stop statistics updater task - MockHealthStatisticsGenerator.getInstance().stopStatisticsUpdaterTask(statisticsPattern.getCartridgeType(), - statisticsPattern.getFactor().toString()); - } catch (StopStatisticsPublishingException action) { - // Remove statistics - MockHealthStatistics.getInstance().removeStatistics(statisticsPattern.getCartridgeType(), - statisticsPattern.getFactor()); - if (log.isDebugEnabled()) { - log.debug(String.format("Statistics removed: [cartridge-type] %s [factor] %s", - statisticsPattern.getCartridgeType(), statisticsPattern.getFactor().toString())); - } - // Stop statistics updater task - MockHealthStatisticsGenerator.getInstance().stopStatisticsUpdaterTask(statisticsPattern.getCartridgeType(), - statisticsPattern.getFactor().toString()); - } catch (Exception e) { - log.error("Could not update mock statistics", e); - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/publisher/MockHealthStatisticsNotifier.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/publisher/MockHealthStatisticsNotifier.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/publisher/MockHealthStatisticsNotifier.java deleted file mode 100644 index 9aef223..0000000 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/publisher/MockHealthStatisticsNotifier.java +++ /dev/null @@ -1,104 +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.cloud.controller.iaases.mock.service.statistics.publisher; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.cloud.controller.iaases.mock.service.MockAutoscalingFactor; -import org.apache.stratos.cloud.controller.iaases.mock.service.MockMemberContext; -import org.apache.stratos.cloud.controller.iaases.mock.service.exceptions.NoStatisticsFoundException; -import org.apache.stratos.cloud.controller.iaases.mock.service.statistics.MockHealthStatistics; - -/** - * Health statistics notifier thread for publishing statistics periodically to CEP. - */ -public class MockHealthStatisticsNotifier implements Runnable { - private static final Log log = LogFactory.getLog(MockHealthStatisticsNotifier.class); - - public static final String MEMORY_CONSUMPTION = "memory_consumption"; - public static final String LOAD_AVERAGE = "load_average"; - - private final MockMemberContext mockMemberContext; - private final MockHealthStatisticsPublisher statsPublisher; - - public MockHealthStatisticsNotifier(MockMemberContext mockMemberContext) { - this.mockMemberContext = mockMemberContext; - this.statsPublisher = new MockHealthStatisticsPublisher(); - this.statsPublisher.setEnabled(true); - } - - @Override - public void run() { - if (!statsPublisher.isEnabled()) { - if (log.isWarnEnabled()) { - log.warn("Statistics publisher is disabled"); - } - return; - } - - try { - double memoryConsumption = MockHealthStatistics.getInstance().getStatistics( - mockMemberContext.getServiceName(), MockAutoscalingFactor.MemoryConsumption); - - if (log.isDebugEnabled()) { - log.debug(String.format("Publishing memory consumption: [member-id] %s [value] %f", - mockMemberContext.getMemberId(), memoryConsumption)); - } - statsPublisher.publish( - mockMemberContext.getClusterId(), - mockMemberContext.getClusterInstanceId(), - mockMemberContext.getNetworkPartitionId(), - mockMemberContext.getMemberId(), - mockMemberContext.getPartitionId(), - MEMORY_CONSUMPTION, - memoryConsumption - ); - } catch (NoStatisticsFoundException ignore) { - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Could not publish health statistics", e); - } - } - - - try { - double loadAvereage = MockHealthStatistics.getInstance().getStatistics( - mockMemberContext.getServiceName(), MockAutoscalingFactor.LoadAverage); - if (log.isDebugEnabled()) { - log.debug(String.format("Publishing load average: [member-id] %s [value] %f", - mockMemberContext.getMemberId(), loadAvereage)); - } - statsPublisher.publish( - mockMemberContext.getClusterId(), - mockMemberContext.getClusterInstanceId(), - mockMemberContext.getNetworkPartitionId(), - mockMemberContext.getMemberId(), - mockMemberContext.getPartitionId(), - LOAD_AVERAGE, - loadAvereage - ); - } catch (NoStatisticsFoundException ignore) { - } catch (Exception e) { - if (log.isErrorEnabled()) { - log.error("Could not publish health statistics", e); - } - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/publisher/MockHealthStatisticsPublisher.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/publisher/MockHealthStatisticsPublisher.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/publisher/MockHealthStatisticsPublisher.java deleted file mode 100644 index b2a5b27..0000000 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/mock/service/statistics/publisher/MockHealthStatisticsPublisher.java +++ /dev/null @@ -1,91 +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.cloud.controller.iaases.mock.service.statistics.publisher; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.common.statistics.publisher.WSO2CEPStatisticsPublisher; -import org.wso2.carbon.databridge.commons.Attribute; -import org.wso2.carbon.databridge.commons.AttributeType; -import org.wso2.carbon.databridge.commons.StreamDefinition; - -import java.util.ArrayList; -import java.util.List; - -/** - * Health statistics publisher for publishing statistics to CEP. - */ -public class MockHealthStatisticsPublisher extends WSO2CEPStatisticsPublisher { - private static final Log log = LogFactory.getLog(MockHealthStatisticsPublisher.class); - - private static final String DATA_STREAM_NAME = "cartridge_agent_health_stats"; - private static final String VERSION = "1.0.0"; - - private static StreamDefinition createStreamDefinition() { - try { - StreamDefinition streamDefinition = new StreamDefinition(DATA_STREAM_NAME, VERSION); - streamDefinition.setNickName("agent health stats"); - streamDefinition.setDescription("agent health stats"); - // Payload definition - List<Attribute> payloadData = new ArrayList<Attribute>(); - payloadData.add(new Attribute("cluster_id", AttributeType.STRING)); - payloadData.add(new Attribute("cluster_instance_id", AttributeType.STRING)); - payloadData.add(new Attribute("network_partition_id", AttributeType.STRING)); - payloadData.add(new Attribute("member_id", AttributeType.STRING)); - payloadData.add(new Attribute("partition_id", AttributeType.STRING)); - payloadData.add(new Attribute("health_description", AttributeType.STRING)); - payloadData.add(new Attribute("value", AttributeType.DOUBLE)); - streamDefinition.setPayloadData(payloadData); - return streamDefinition; - } catch (Exception e) { - throw new RuntimeException("Could not create stream definition", e); - } - } - - public MockHealthStatisticsPublisher() { - super(createStreamDefinition()); - } - - /** - * Publish health statistics to cep. - * @param clusterId - * @param networkPartitionId - * @param memberId - * @param partitionId - * @param health - * @param value - */ - public void publish(String clusterId, String clusterInstanceId, String networkPartitionId, String memberId, String partitionId, String health, double value) { - if(log.isDebugEnabled()) { - log.debug(String.format("Publishing health statistics: [cluster] %s [network-partition] %s [partition] %s [member] %s [health] %s [value] %f", - clusterId, networkPartitionId, partitionId, memberId, health, value)); - } - List<Object> payload = new ArrayList<Object>(); - // Payload values - payload.add(clusterId); - payload.add(clusterInstanceId); - payload.add(networkPartitionId); - payload.add(memberId); - payload.add(partitionId); - payload.add(health); - payload.add(value); - super.publish(payload.toArray()); - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerServiceComponent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerServiceComponent.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerServiceComponent.java index 9269ab3..4686b5c 100644 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerServiceComponent.java +++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/CloudControllerServiceComponent.java @@ -21,19 +21,16 @@ package org.apache.stratos.cloud.controller.internal; */ import com.hazelcast.core.HazelcastInstance; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.cloud.controller.context.CloudControllerContext; -import org.apache.stratos.cloud.controller.iaases.mock.service.MockIaasService; -import org.apache.stratos.cloud.controller.iaases.mock.service.config.MockIaasConfig; +import org.apache.stratos.cloud.controller.exception.CloudControllerException; +import org.apache.stratos.cloud.controller.messaging.publisher.TopologySynchronizerTaskScheduler; import org.apache.stratos.cloud.controller.messaging.receiver.application.ApplicationEventReceiver; import org.apache.stratos.cloud.controller.messaging.receiver.cluster.status.ClusterStatusTopicReceiver; -import org.apache.stratos.cloud.controller.exception.CloudControllerException; +import org.apache.stratos.cloud.controller.messaging.receiver.instance.status.InstanceStatusTopicReceiver; import org.apache.stratos.cloud.controller.services.CloudControllerService; import org.apache.stratos.cloud.controller.services.impl.CloudControllerServiceImpl; -import org.apache.stratos.cloud.controller.messaging.publisher.TopologySynchronizerTaskScheduler; -import org.apache.stratos.cloud.controller.messaging.receiver.instance.status.InstanceStatusTopicReceiver; import org.apache.stratos.common.clustering.DistributedObjectProvider; import org.apache.stratos.common.threading.StratosThreadPool; import org.apache.stratos.messaging.broker.publish.EventPublisherPool; @@ -66,6 +63,7 @@ import java.util.concurrent.ExecutorService; public class CloudControllerServiceComponent { private static final Log log = LogFactory.getLog(CloudControllerServiceComponent.class); + private ClusterStatusTopicReceiver clusterStatusTopicReceiver; private InstanceStatusTopicReceiver instanceStatusTopicReceiver; private ApplicationEventReceiver applicationEventReceiver; @@ -105,11 +103,6 @@ public class CloudControllerServiceComponent { } else { executeCoordinatorTasks(); } - - if(MockIaasConfig.getInstance().isEnabled()) { - // Start mock members if they were in running state earlier - MockIaasService.getInstance().startMockMembers(); - } } catch (Exception e) { log.error("Could not activate cloud controller service component", e); } http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/ServiceReferenceHolder.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/ServiceReferenceHolder.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/ServiceReferenceHolder.java index bbee450..ef4015a 100644 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/ServiceReferenceHolder.java +++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/internal/ServiceReferenceHolder.java @@ -30,7 +30,8 @@ import org.wso2.carbon.registry.core.session.UserRegistry; */ public class ServiceReferenceHolder { - private static ServiceReferenceHolder instance; + private static volatile ServiceReferenceHolder instance; + private TaskService taskService; private Registry registry; private AxisConfiguration axisConfiguration; @@ -42,7 +43,11 @@ public class ServiceReferenceHolder { public static ServiceReferenceHolder getInstance() { if (instance == null) { - instance = new ServiceReferenceHolder(); + synchronized (ServiceReferenceHolder.class) { + if(instance == null) { + instance = new ServiceReferenceHolder(); + } + } } return instance; } http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java index bf3e1f8..c0259a9 100644 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java +++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java @@ -1058,11 +1058,13 @@ public class CloudControllerServiceImpl implements CloudControllerService { for (PortMapping portMap : portMappings) { if (portMap.isKubernetesServicePortMapping()) { String accessUrl = - portMap.getProtocol() + ":".concat("//")+ appClusterCtxt.getHostName() + ":" + portMap.getKubernetesServicePort(); + portMap.getProtocol() + "\\://" + appClusterCtxt.getHostName() + ":" + + portMap.getKubernetesServicePort(); accessUrlPerCluster.add(accessUrl); } else { String accessUrl = - portMap.getProtocol()+ ":".concat("//") + appClusterCtxt.getHostName() + ":" + portMap.getProxyPort(); + portMap.getProtocol() + "\\://" + appClusterCtxt.getHostName() + ":" + + portMap.getProxyPort(); accessUrlPerCluster.add(accessUrl); } } @@ -1080,7 +1082,12 @@ public class CloudControllerServiceImpl implements CloudControllerService { CloudControllerContext.getInstance().addClusterContext(clusterContext); - // Create cluster object + Cartridge cartridge=CloudControllerContext.getInstance().getCartridge(clusterContext.getCartridgeType()); + if(cartridge.getCategory().equals("lb")){ + + } + + // Create cluster object Cluster cluster = new Cluster(appClusterCtxt.getCartridgeType(), appClusterCtxt.getClusterId(), appClusterCtxt.getDeploymentPolicyName(), appClusterCtxt.getAutoscalePolicyName(), appId); cluster.setLbCluster(false); http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AxiomXpathParserUtil.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AxiomXpathParserUtil.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AxiomXpathParserUtil.java deleted file mode 100644 index 913289d..0000000 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/AxiomXpathParserUtil.java +++ /dev/null @@ -1,260 +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.cloud.controller.util; - -import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMFactory; -import org.apache.axiom.om.OMNode; -import org.apache.axiom.om.impl.builder.StAXOMBuilder; -import org.apache.axiom.om.impl.dom.DOOMAbstractFactory; -import org.apache.axiom.om.impl.dom.ElementImpl; -import org.apache.axiom.om.xpath.AXIOMXPath; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.cloud.controller.exception.MalformedConfigurationFileException; -import org.jaxen.JaxenException; -import org.w3c.dom.Element; -import org.wso2.securevault.SecretResolver; -import org.wso2.securevault.SecretResolverFactory; -import org.xml.sax.SAXException; - -import javax.xml.XMLConstants; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.transform.Source; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import javax.xml.validation.Validator; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.*; - -/** - * This class is parsing configuration files using Axiom Xpath. - */ -public class AxiomXpathParserUtil { - - private static final Log LOG = LogFactory.getLog(AxiomXpathParserUtil.class); - - private AxiomXpathParserUtil(){} - - public static OMElement parse(File xmlSource) throws MalformedConfigurationFileException, - IllegalArgumentException { - - OMElement documentElement; - - if (xmlSource == null) { - String msg = "File is null."; - LOG.error(msg); - throw new IllegalArgumentException(msg); - } - - try { - documentElement = new StAXOMBuilder(xmlSource.getPath()).getDocumentElement(); - return documentElement; - - } catch (XMLStreamException e) { - String msg = "Failed to parse the configuration file : " + xmlSource.getPath(); - LOG.error(msg, e); - throw new MalformedConfigurationFileException(msg, e); - } catch (FileNotFoundException e) { - String msg = "Configuration file cannot be found : " + xmlSource.getPath(); - LOG.error(msg); - throw new MalformedConfigurationFileException(msg); - } - - } - - private static Element getDOMElement(final OMElement omElement) { - - // Get the StAX reader from the created element - XMLStreamReader llomReader = omElement.getXMLStreamReader(); - - // Create the DOOM OMFactory - OMFactory doomFactory = DOOMAbstractFactory.getOMFactory(); - - // Create the new builder - StAXOMBuilder doomBuilder = new StAXOMBuilder(doomFactory, llomReader); - - // Get the document element - OMElement newElem = doomBuilder.getDocumentElement(); - - return newElem instanceof Element ? (Element) newElem : null; - } - - private static OMElement getElement(final Object obj) { - OMNode node; - if ((obj instanceof OMNode) && (node = (OMNode) obj).getType() == OMNode.ELEMENT_NODE) { - - OMElement element = (OMElement) node; - - return element; - - } - - return null; - } - - public static OMElement getElement(final String fileName, final OMElement rootElt, - final String eltStr, final String xpath) { - List<?> nodes = getMatchingNodes(xpath, rootElt); - neglectingWarn(fileName, eltStr, nodes.size()); - OMElement element = getElement(nodes.get(0)); - return element; - } - - public static OMElement getFirstChildElement(final OMElement root, final String childName) { - Iterator<?> it = root.getChildrenWithName(new QName(childName)); - if (it.hasNext()) { - return (OMElement) it.next(); - } - - return null; - } - - private static void neglectingWarn(final String fileName, final String elt, final int size) { - if (size > 1) { - LOG.warn(fileName + " contains more than one " + elt + " elements!" + - " Elements other than the first will be neglected."); - } - } - - public static void plainTextWarn(final String elt) { - LOG.warn("Unable to find a value for " + elt + " element from Secure Vault." + - "Hence we will try to assign the plain text value (if specified)."); - } - - /** - * @param xpath - * XPATH expression to be read. - * @param elt - * OMElement to be used for the search. - * @return List matching OMNode list - */ - @SuppressWarnings("unchecked") - public static OMNode getFirstMatchingNode(final String xpath, final OMElement elt) throws MalformedConfigurationFileException{ - - AXIOMXPath axiomXpath; - List<OMNode> nodeList = null; - try { - axiomXpath = new AXIOMXPath(xpath); - nodeList = axiomXpath.selectNodes(elt); - return nodeList.isEmpty() ? null : nodeList.get(0); - } catch (JaxenException e) { - String msg = "Error occurred while reading the Xpath (" + xpath + ")"; - LOG.error(msg, e); - throw new MalformedConfigurationFileException(msg, e); - } - - } - - /** - * @param xpath - * XPATH expression to be read. - * @return List matching list - */ - @SuppressWarnings("unchecked") - public static List<OMNode> getMatchingNodes(OMElement elt, final String xpath) throws MalformedConfigurationFileException{ - - AXIOMXPath axiomXpath; - List<OMNode> nodeList = null; - try { - axiomXpath = new AXIOMXPath(xpath); - nodeList = axiomXpath.selectNodes(elt); - return nodeList; - } catch (JaxenException e) { - String msg = "Error occurred while reading the Xpath (" + xpath + ")"; - LOG.error(msg, e); - throw new MalformedConfigurationFileException(msg, e); - } - - } - - /** - * @param xpath - * XPATH expression to be read. - * @param elt - * OMElement to be used for the search. - * @return List matching OMNode list - */ - @SuppressWarnings("unchecked") - public static List<OMNode> getMatchingNodes(final String xpath, final OMElement elt) throws MalformedConfigurationFileException{ - - AXIOMXPath axiomXpath; - List<OMNode> nodeList = null; - try { - axiomXpath = new AXIOMXPath(xpath); - nodeList = axiomXpath.selectNodes(elt); - return nodeList; - } catch (JaxenException e) { - String msg = "Error occurred while reading the Xpath (" + xpath + ")"; - LOG.error(msg, e); - throw new MalformedConfigurationFileException(msg, e); - } - - } - - public static void validate(final OMElement omElement, final File schemaFile) throws SAXException, IOException { - - Element sourceElement; - - // if the OMElement is created using DOM implementation use it - if (omElement instanceof ElementImpl) { - sourceElement = (Element) omElement; - } else { // else convert from llom to dom - sourceElement = getDOMElement(omElement); - } - - // Create a SchemaFactory capable of understanding WXS schemas. - - // Load a WXS schema, represented by a Schema instance. - SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); - Source source = new StreamSource(schemaFile); - - // Create a Validator object, which can be used to validate - // an instance document. - Schema schema = factory.newSchema(source); - Validator validator = schema.newValidator(); - - // Validate the DOM tree. - validator.validate(new DOMSource(sourceElement)); - } - - public static String resolveSecret(final OMElement docElt, final OMElement elt) { - // retrieve the value using secure vault - SecretResolver secretResolver = SecretResolverFactory.create(docElt, false); - - String alias = elt.getAttributeValue(new QName( - CloudControllerConstants.ALIAS_NAMESPACE, - CloudControllerConstants.ALIAS_ATTRIBUTE, - CloudControllerConstants.ALIAS_ATTRIBUTE_PREFIX)); - - // retrieve the secured password - if (secretResolver != null && secretResolver.isInitialized() && - secretResolver.isTokenProtected(alias)) { - return secretResolver.resolve(alias); - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomValidationTest.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomValidationTest.java b/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomValidationTest.java index 7f75802..16c59b6 100644 --- a/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomValidationTest.java +++ b/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomValidationTest.java @@ -21,7 +21,7 @@ package org.apache.cartridge.autoscaler.service.axiom; import java.io.File; import org.apache.axiom.om.OMElement; -import org.apache.stratos.cloud.controller.util.AxiomXpathParserUtil; +import org.apache.stratos.common.util.AxiomXpathParserUtil; import org.xml.sax.SAXParseException; import junit.framework.TestCase; http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomXpathParserTest.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomXpathParserTest.java b/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomXpathParserTest.java index f2eded6..93683d6 100644 --- a/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomXpathParserTest.java +++ b/components/org.apache.stratos.cloud.controller/src/test/java/org/apache/cartridge/autoscaler/service/axiom/AxiomXpathParserTest.java @@ -23,7 +23,7 @@ import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNode; import org.apache.stratos.cloud.controller.config.CloudControllerConfig; import org.apache.stratos.cloud.controller.config.parser.CloudControllerConfigParser; -import org.apache.stratos.cloud.controller.util.AxiomXpathParserUtil; +import org.apache.stratos.common.util.AxiomXpathParserUtil; import java.io.File; import java.util.List; http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/exception/MalformedConfigurationFileException.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/exception/MalformedConfigurationFileException.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/exception/MalformedConfigurationFileException.java new file mode 100644 index 0000000..d6ad833 --- /dev/null +++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/exception/MalformedConfigurationFileException.java @@ -0,0 +1,43 @@ +/* + * 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.common.exception; + +public class MalformedConfigurationFileException extends RuntimeException { + + private static final long serialVersionUID = -1662095377704279326L; + private String message; + + public MalformedConfigurationFileException(String msg) { + super(msg); + this.setMessage(msg); + } + + public MalformedConfigurationFileException(String msg, Exception ex) { + super(msg, ex); + this.setMessage(msg); + } + + private void setMessage(String msg) { + this.message = msg; + } + + public String getMessage() { + return this.message; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/internal/StratosCommonServiceComponent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/internal/StratosCommonServiceComponent.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/internal/StratosCommonServiceComponent.java index 3378a92..275128b 100644 --- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/internal/StratosCommonServiceComponent.java +++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/internal/StratosCommonServiceComponent.java @@ -50,7 +50,7 @@ import org.wso2.carbon.utils.ConfigurationContextService; * unbind="unsetRealmService" * @scr.reference name="configuration.context.service" interface="org.wso2.carbon.utils.ConfigurationContextService" * cardinality="1..1" policy="dynamic" bind="setConfigurationContextService" unbind="unsetConfigurationContextService" - + * */ public class StratosCommonServiceComponent { http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/util/AxiomXpathParserUtil.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/util/AxiomXpathParserUtil.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/util/AxiomXpathParserUtil.java new file mode 100644 index 0000000..d5f6bd1 --- /dev/null +++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/util/AxiomXpathParserUtil.java @@ -0,0 +1,262 @@ +/* + * 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.common.util; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNode; +import org.apache.axiom.om.impl.builder.StAXOMBuilder; +import org.apache.axiom.om.impl.dom.DOOMAbstractFactory; +import org.apache.axiom.om.impl.dom.ElementImpl; +import org.apache.axiom.om.xpath.AXIOMXPath; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.stratos.common.exception.MalformedConfigurationFileException; +import org.jaxen.JaxenException; +import org.w3c.dom.Element; +import org.wso2.securevault.SecretResolver; +import org.wso2.securevault.SecretResolverFactory; +import org.xml.sax.SAXException; + +import javax.xml.XMLConstants; +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.transform.Source; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +/** + * This class is parsing configuration files using Axiom Xpath. + */ +public class AxiomXpathParserUtil { + + private static final Log LOG = LogFactory.getLog(AxiomXpathParserUtil.class); + + public static final String ALIAS_ATTRIBUTE = "secretAlias"; + public static final String ALIAS_ATTRIBUTE_PREFIX = "svns"; + public static final String ALIAS_NAMESPACE = "http://org.wso2.securevault/configuration"; + + private AxiomXpathParserUtil(){} + + public static OMElement parse(File xmlSource) throws MalformedConfigurationFileException, + IllegalArgumentException { + + OMElement documentElement; + + if (xmlSource == null) { + String msg = "File is null."; + LOG.error(msg); + throw new IllegalArgumentException(msg); + } + + try { + documentElement = new StAXOMBuilder(xmlSource.getPath()).getDocumentElement(); + return documentElement; + + } catch (XMLStreamException e) { + String msg = "Failed to parse the configuration file : " + xmlSource.getPath(); + LOG.error(msg, e); + throw new MalformedConfigurationFileException(msg, e); + } catch (FileNotFoundException e) { + String msg = "Configuration file cannot be found : " + xmlSource.getPath(); + LOG.error(msg); + throw new MalformedConfigurationFileException(msg); + } + + } + + private static Element getDOMElement(final OMElement omElement) { + + // Get the StAX reader from the created element + XMLStreamReader llomReader = omElement.getXMLStreamReader(); + + // Create the DOOM OMFactory + OMFactory doomFactory = DOOMAbstractFactory.getOMFactory(); + + // Create the new builder + StAXOMBuilder doomBuilder = new StAXOMBuilder(doomFactory, llomReader); + + // Get the document element + OMElement newElem = doomBuilder.getDocumentElement(); + + return newElem instanceof Element ? (Element) newElem : null; + } + + private static OMElement getElement(final Object obj) { + OMNode node; + if ((obj instanceof OMNode) && (node = (OMNode) obj).getType() == OMNode.ELEMENT_NODE) { + + OMElement element = (OMElement) node; + + return element; + + } + + return null; + } + + public static OMElement getElement(final String fileName, final OMElement rootElt, + final String eltStr, final String xpath) { + List<?> nodes = getMatchingNodes(xpath, rootElt); + neglectingWarn(fileName, eltStr, nodes.size()); + OMElement element = getElement(nodes.get(0)); + return element; + } + + public static OMElement getFirstChildElement(final OMElement root, final String childName) { + Iterator<?> it = root.getChildrenWithName(new QName(childName)); + if (it.hasNext()) { + return (OMElement) it.next(); + } + + return null; + } + + private static void neglectingWarn(final String fileName, final String elt, final int size) { + if (size > 1) { + LOG.warn(fileName + " contains more than one " + elt + " elements!" + + " Elements other than the first will be neglected."); + } + } + + public static void plainTextWarn(final String elt) { + LOG.warn("Unable to find a value for " + elt + " element from Secure Vault." + + "Hence we will try to assign the plain text value (if specified)."); + } + + /** + * @param xpath + * XPATH expression to be read. + * @param elt + * OMElement to be used for the search. + * @return List matching OMNode list + */ + @SuppressWarnings("unchecked") + public static OMNode getFirstMatchingNode(final String xpath, final OMElement elt) throws MalformedConfigurationFileException{ + + AXIOMXPath axiomXpath; + List<OMNode> nodeList = null; + try { + axiomXpath = new AXIOMXPath(xpath); + nodeList = axiomXpath.selectNodes(elt); + return nodeList.isEmpty() ? null : nodeList.get(0); + } catch (JaxenException e) { + String msg = "Error occurred while reading the Xpath (" + xpath + ")"; + LOG.error(msg, e); + throw new MalformedConfigurationFileException(msg, e); + } + + } + + /** + * @param xpath + * XPATH expression to be read. + * @return List matching list + */ + @SuppressWarnings("unchecked") + public static List<OMNode> getMatchingNodes(OMElement elt, final String xpath) throws MalformedConfigurationFileException{ + + AXIOMXPath axiomXpath; + List<OMNode> nodeList = null; + try { + axiomXpath = new AXIOMXPath(xpath); + nodeList = axiomXpath.selectNodes(elt); + return nodeList; + } catch (JaxenException e) { + String msg = "Error occurred while reading the Xpath (" + xpath + ")"; + LOG.error(msg, e); + throw new MalformedConfigurationFileException(msg, e); + } + + } + + /** + * @param xpath + * XPATH expression to be read. + * @param elt + * OMElement to be used for the search. + * @return List matching OMNode list + */ + @SuppressWarnings("unchecked") + public static List<OMNode> getMatchingNodes(final String xpath, final OMElement elt) throws MalformedConfigurationFileException{ + + AXIOMXPath axiomXpath; + List<OMNode> nodeList = null; + try { + axiomXpath = new AXIOMXPath(xpath); + nodeList = axiomXpath.selectNodes(elt); + return nodeList; + } catch (JaxenException e) { + String msg = "Error occurred while reading the Xpath (" + xpath + ")"; + LOG.error(msg, e); + throw new MalformedConfigurationFileException(msg, e); + } + + } + + public static void validate(final OMElement omElement, final File schemaFile) throws SAXException, IOException { + + Element sourceElement; + + // if the OMElement is created using DOM implementation use it + if (omElement instanceof ElementImpl) { + sourceElement = (Element) omElement; + } else { // else convert from llom to dom + sourceElement = getDOMElement(omElement); + } + + // Create a SchemaFactory capable of understanding WXS schemas. + + // Load a WXS schema, represented by a Schema instance. + SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + Source source = new StreamSource(schemaFile); + + // Create a Validator object, which can be used to validate + // an instance document. + Schema schema = factory.newSchema(source); + Validator validator = schema.newValidator(); + + // Validate the DOM tree. + validator.validate(new DOMSource(sourceElement)); + } + + public static String resolveSecret(final OMElement docElt, final OMElement elt) { + // retrieve the value using secure vault + SecretResolver secretResolver = SecretResolverFactory.create(docElt, false); + + String alias = elt.getAttributeValue(new QName( + ALIAS_NAMESPACE, ALIAS_ATTRIBUTE, ALIAS_ATTRIBUTE_PREFIX)); + + // retrieve the secured password + if (secretResolver != null && secretResolver.isInitialized() && + secretResolver.isTokenProtected(alias)) { + return secretResolver.resolve(alias); + } + return null; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.custom.handlers/pom.xml ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.custom.handlers/pom.xml b/components/org.apache.stratos.custom.handlers/pom.xml index c15fb5c..1189915 100644 --- a/components/org.apache.stratos.custom.handlers/pom.xml +++ b/components/org.apache.stratos.custom.handlers/pom.xml @@ -20,7 +20,6 @@ <artifactId>org.wso2.carbon.identity.oauth</artifactId> <version>4.2.3</version> </dependency> - <dependency> <groupId>com.nimbusds</groupId> <artifactId>nimbus-jose-jwt</artifactId> @@ -36,7 +35,6 @@ <artifactId>org.wso2.carbon.logging</artifactId> <version>${wso2carbon.version}</version> </dependency> - <dependency> <groupId>org.wso2.carbon</groupId> <artifactId>org.wso2.carbon.core</artifactId> http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.messaging/pom.xml ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/pom.xml b/components/org.apache.stratos.messaging/pom.xml index 6779fc4..9753660 100644 --- a/components/org.apache.stratos.messaging/pom.xml +++ b/components/org.apache.stratos.messaging/pom.xml @@ -87,15 +87,6 @@ <build> <plugins> - <!--plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <suiteXmlFiles> - <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile> - </suiteXmlFiles> - </configuration> - </plugin--> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-scr-plugin</artifactId> http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.metadata.service/pom.xml ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.metadata.service/pom.xml b/components/org.apache.stratos.metadata.service/pom.xml index 0daf649..9982467 100644 --- a/components/org.apache.stratos.metadata.service/pom.xml +++ b/components/org.apache.stratos.metadata.service/pom.xml @@ -27,7 +27,7 @@ <modelVersion>4.0.0</modelVersion> <artifactId>org.apache.stratos.metadata.service</artifactId> <packaging>war</packaging> - <name>Apache Stratos - Meta Data Service</name> + <name>Apache Stratos - Metadata Service</name> <profiles> <profile> @@ -82,6 +82,7 @@ </build> <dependencies> + <!-- Dependency scope is set to provided to avoid dependent jar files being packaged with the war file --> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-bundle</artifactId> @@ -146,6 +147,7 @@ <groupId>org.wso2.carbon</groupId> <artifactId>org.wso2.carbon.ntask.core</artifactId> <version>${wso2carbon.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.wso2.carbon</groupId> @@ -157,6 +159,7 @@ <groupId>com.nimbusds.wso2</groupId> <artifactId>nimbus-jose-jwt</artifactId> <version>2.26.1.wso2v2</version> + <scope>provided</scope> </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/stratos/blob/e16acd17/components/org.apache.stratos.mock.iaas.api/pom.xml ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.mock.iaas.api/pom.xml b/components/org.apache.stratos.mock.iaas.api/pom.xml new file mode 100644 index 0000000..fe8be8c --- /dev/null +++ b/components/org.apache.stratos.mock.iaas.api/pom.xml @@ -0,0 +1,115 @@ +<!-- + ~ 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.1.0-SNAPSHOT</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + <artifactId>org.apache.stratos.mock.iaas.api</artifactId> + <version>4.1.0-SNAPSHOT</version> + <packaging>war</packaging> + <name>Apache Stratos - Mock IaaS API</name> + + <profiles> + <profile> + <id>prod</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <properties> + <appName>mock-iaas-api</appName> + </properties> + </profile> + </profiles> + + <build> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + <version>2.3.2</version> + </plugin> + <plugin> + <artifactId>maven-war-plugin</artifactId> + <version>2.2</version> + <configuration> + <webResources> + <resource> + <!-- this is relative to the pom.xml directory --> + <directory>src/main/webapp/${appName}</directory> + </resource> + </webResources> + <warName>mock-iaas-api</warName> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <!-- Dependency scope is set to provided to avoid dependent jar files being packaged with the war file --> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-bundle</artifactId> + <version>2.7.12</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.wso2.carbon</groupId> + <artifactId>org.wso2.carbon.core</artifactId> + <version>${wso2carbon.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.wso2.carbon</groupId> + <artifactId>org.wso2.carbon.utils</artifactId> + <version>${wso2carbon.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.wso2.carbon</groupId> + <artifactId>org.wso2.carbon.identity.oauth.stub</artifactId> + <version>${wso2carbon.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.wso2.carbon</groupId> + <artifactId>org.wso2.carbon.tenant.mgt</artifactId> + <version>2.2.2</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.stratos</groupId> + <artifactId>org.apache.stratos.common</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.stratos</groupId> + <artifactId>org.apache.stratos.mock.iaas</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + </dependencies> +</project>
