diff options
| author | Shireesh Anjal <shireesh@gluster.com> | 2011-02-08 21:09:29 +0530 |
|---|---|---|
| committer | Shireesh Anjal <shireesh@gluster.com> | 2011-02-08 21:09:29 +0530 |
| commit | 9438d94101e33638affc463953bd22d18ca0c6d6 (patch) | |
| tree | 8f25d09622ef0f628bea92f7c52c7dd4f9e738a9 /com.gluster.storage.management.server/src | |
| parent | cf9c3498b400ea5b04a2d93e019e94c85759ea8a (diff) | |
Introduced server discovery task
Diffstat (limited to 'com.gluster.storage.management.server/src')
| -rw-r--r-- | com.gluster.storage.management.server/src/applicationContext.xml | 16 | ||||
| -rw-r--r-- | com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/ServerDiscoveryTask.java | 51 |
2 files changed, 66 insertions, 1 deletions
diff --git a/com.gluster.storage.management.server/src/applicationContext.xml b/com.gluster.storage.management.server/src/applicationContext.xml index 4167b5cd..90566c7f 100644 --- a/com.gluster.storage.management.server/src/applicationContext.xml +++ b/com.gluster.storage.management.server/src/applicationContext.xml @@ -1,8 +1,22 @@ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" + xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd - http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd + http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"> <context:component-scan base-package="com.gluster.storage.management.server" /> + <task:scheduler id="taskScheduler" /> + <task:executor id="taskExecutor" pool-size="1" /> + <task:annotation-driven executor="taskExecutor" + scheduler="taskScheduler" /> + + <task:scheduled-tasks> + <task:scheduled ref="serverDiscoveryTask" method="discoverServers" fixed-delay="60000"/> + </task:scheduled-tasks> + + <bean id="environment" class="java.lang.String"> + <constructor-arg value="aws"/> + </bean> </beans>
\ No newline at end of file diff --git a/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/ServerDiscoveryTask.java b/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/ServerDiscoveryTask.java new file mode 100644 index 00000000..6bc25e81 --- /dev/null +++ b/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/ServerDiscoveryTask.java @@ -0,0 +1,51 @@ +/** + * ServerDiscoveryTask.java + * + * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com> + * This file is part of Gluster Management Console. + * + * Gluster Management Console is free software; you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Gluster Management Console is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License + * for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * <http://www.gnu.org/licenses/>. + */ +package com.gluster.storage.management.server.tasks; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * Task for auto-discovery of servers eligible to be added to the Gluster cluster. This task runs periodically and keeps + * the discovered server list at a common place. The server resource can then pick it and send to client whenever + * demanded. + */ +@Component +public class ServerDiscoveryTask { + private static final String ENV_AWS = "aws"; + private static final String ENV_VMWARE = "vmware"; + private static final String ENV_PHYCAL = "physical"; + + @Autowired + private String environment; + + public void discoverServers() { + System.out.println("Starting discovery in [" + environment + "]"); + + /** + * TODO: Flow should be as follows <br> + * 1) Get the discovery policy specific for the environment <br> + * 2) Execute discovery to get list of auto-discovered server <br> + * 3) Probe each one of them to fetch server details <br> + * 4) Store the details in a common place which can be read by the server resource <br> + */ + } +}
\ No newline at end of file |
