Architecture refactoring - Stateless management server - Spring Framework initiatives, add missing files

This commit is contained in:
Kelven Yang 2012-10-19 15:32:12 -07:00
parent b104d22b77
commit 8e59b3acfb
3 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:annotation-config />
<context:component-scan base-package="com.cloud.cluster" />
</beans>

View File

@ -0,0 +1,24 @@
package com.cloud.cluster;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import org.springframework.stereotype.Component;
import com.cloud.utils.events.EventBusBase;
import com.cloud.utils.events.PublishScope;
@Component
public class ClusterEventBus extends EventBusBase {
@PostConstruct
public void init() {
}
@Override
public void publish(String subject, PublishScope scope, Object sender,
Serializable args) {
super.publish(subject, scope, sender, args);
}
}

View File

@ -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
// 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 com.cloud.utils.component;
import org.springframework.context.ApplicationContext;
/**
*
* ComponentContext.setApplication() and ComponentContext.getApplication()
* are not recommended to be used outside, they exist to help wire Spring Framework
*
*/
public class ComponentContext {
private static ApplicationContext s_appContext;
public static void setApplicationContext(ApplicationContext applicationContext) {
s_appContext = applicationContext;
}
public static ApplicationContext getApplicationContext() {
return s_appContext;
}
public <T> T getCompanent(String name) {
assert(s_appContext != null);
return (T)s_appContext.getBean(name);
}
}