You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by David Nalley <da...@gnsa.us> on 2012/10/20 00:44:22 UTC

Re: git commit: Architecture refactoring - Stateless management server - Spring Framework initiatives, add missing files

Please add license header to applicationContext.xml.in

On Fri, Oct 19, 2012 at 6:33 PM,  <ke...@apache.org> wrote:
> Updated Branches:
>   refs/heads/javelin b104d22b7 -> 8e59b3acf
>
>
> Architecture refactoring - Stateless management server - Spring Framework initiatives, add missing files
>
>
> Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
> Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/8e59b3ac
> Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/8e59b3ac
> Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/8e59b3ac
>
> Branch: refs/heads/javelin
> Commit: 8e59b3acfbfcab0169d6b18ad3d00317b897ddab
> Parents: b104d22
> Author: Kelven Yang <ke...@citrix.com>
> Authored: Fri Oct 19 15:32:12 2012 -0700
> Committer: Kelven Yang <ke...@citrix.com>
> Committed: Fri Oct 19 15:32:24 2012 -0700
>
> ----------------------------------------------------------------------
>  client/tomcatconf/applicationContext.xml.in        |   12 ++++
>  server/src/com/cloud/cluster/ClusterEventBus.java  |   24 ++++++++
>  .../cloud/utils/component/ComponentContext.java    |   43 +++++++++++++++
>  3 files changed, 79 insertions(+), 0 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8e59b3ac/client/tomcatconf/applicationContext.xml.in
> ----------------------------------------------------------------------
> diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in
> new file mode 100644
> index 0000000..6acd9b3
> --- /dev/null
> +++ b/client/tomcatconf/applicationContext.xml.in
> @@ -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>
>
> http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8e59b3ac/server/src/com/cloud/cluster/ClusterEventBus.java
> ----------------------------------------------------------------------
> diff --git a/server/src/com/cloud/cluster/ClusterEventBus.java b/server/src/com/cloud/cluster/ClusterEventBus.java
> new file mode 100644
> index 0000000..4df5d37
> --- /dev/null
> +++ b/server/src/com/cloud/cluster/ClusterEventBus.java
> @@ -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);
> +       }
> +}
>
> http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8e59b3ac/utils/src/com/cloud/utils/component/ComponentContext.java
> ----------------------------------------------------------------------
> diff --git a/utils/src/com/cloud/utils/component/ComponentContext.java b/utils/src/com/cloud/utils/component/ComponentContext.java
> new file mode 100644
> index 0000000..153c500
> --- /dev/null
> +++ b/utils/src/com/cloud/utils/component/ComponentContext.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
> +// 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);
> +    }
> +}
>