Updated Branches: refs/heads/master 0ed7ebd7e -> c9101966e
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/server/resources/META-INF/cloudstack/server-network/spring-server-network-context.xml ---------------------------------------------------------------------- diff --git a/server/resources/META-INF/cloudstack/server-network/spring-server-network-context.xml b/server/resources/META-INF/cloudstack/server-network/spring-server-network-context.xml new file mode 100644 index 0000000..553ae44 --- /dev/null +++ b/server/resources/META-INF/cloudstack/server-network/spring-server-network-context.xml @@ -0,0 +1,64 @@ +<!-- + 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. +--> +<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:aop="http://www.springframework.org/schema/aop" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-3.0.xsd" + > + + <bean id="StorageNetworkGuru" class="com.cloud.network.guru.StorageNetworkGuru"> + <property name="name" value="StorageNetworkGuru" /> + </bean> + <bean id="ExternalGuestNetworkGuru" class="com.cloud.network.guru.ExternalGuestNetworkGuru"> + <property name="name" value="ExternalGuestNetworkGuru" /> + </bean> + <bean id="PublicNetworkGuru" class="com.cloud.network.guru.PublicNetworkGuru"> + <property name="name" value="PublicNetworkGuru" /> + </bean> + <bean id="PodBasedNetworkGuru" class="com.cloud.network.guru.PodBasedNetworkGuru"> + <property name="name" value="PodBasedNetworkGuru" /> + </bean> + <bean id="ControlNetworkGuru" class="com.cloud.network.guru.ControlNetworkGuru"> + <property name="name" value="ControlNetworkGuru" /> + </bean> + <bean id="DirectNetworkGuru" class="com.cloud.network.guru.DirectNetworkGuru"> + <property name="name" value="DirectNetworkGuru" /> + </bean> + <bean id="DirectPodBasedNetworkGuru" class="com.cloud.network.guru.DirectPodBasedNetworkGuru"> + <property name="name" value="DirectPodBasedNetworkGuru" /> + </bean> + <bean id="PrivateNetworkGuru" class="com.cloud.network.guru.PrivateNetworkGuru"> + <property name="name" value="PrivateNetworkGuru" /> + </bean> + + + <bean id="SecurityGroupProvider" class="com.cloud.network.element.SecurityGroupElement"> + <property name="name" value="SecurityGroupProvider" /> + </bean> + + <bean id="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"> + <property name="name" value="VirtualRouter" /> + </bean> + +</beans> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/server/resources/META-INF/cloudstack/server-planner/module.properties ---------------------------------------------------------------------- diff --git a/server/resources/META-INF/cloudstack/server-planner/module.properties b/server/resources/META-INF/cloudstack/server-planner/module.properties new file mode 100644 index 0000000..fa82ba5 --- /dev/null +++ b/server/resources/META-INF/cloudstack/server-planner/module.properties @@ -0,0 +1,2 @@ +name=server-planner +parent=planner \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/server/resources/META-INF/cloudstack/server-planner/spring-server-planner-context.xml ---------------------------------------------------------------------- diff --git a/server/resources/META-INF/cloudstack/server-planner/spring-server-planner-context.xml b/server/resources/META-INF/cloudstack/server-planner/spring-server-planner-context.xml new file mode 100644 index 0000000..36f3ed0 --- /dev/null +++ b/server/resources/META-INF/cloudstack/server-planner/spring-server-planner-context.xml @@ -0,0 +1,34 @@ +<!-- + 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. +--> +<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:aop="http://www.springframework.org/schema/aop" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-3.0.xsd" + > + + <bean id="FirstFitPlanner" class="com.cloud.deploy.FirstFitPlanner"> + <property name="name" value="FirstFitPlanner"/> + </bean> + +</beans> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/server/resources/META-INF/cloudstack/server-storage/module.properties ---------------------------------------------------------------------- diff --git a/server/resources/META-INF/cloudstack/server-storage/module.properties b/server/resources/META-INF/cloudstack/server-storage/module.properties new file mode 100644 index 0000000..2874a1b --- /dev/null +++ b/server/resources/META-INF/cloudstack/server-storage/module.properties @@ -0,0 +1,2 @@ +name=server-storage +parent=storage \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/server/resources/META-INF/cloudstack/server-storage/spring-server-storage-context.xml ---------------------------------------------------------------------- diff --git a/server/resources/META-INF/cloudstack/server-storage/spring-server-storage-context.xml b/server/resources/META-INF/cloudstack/server-storage/spring-server-storage-context.xml new file mode 100644 index 0000000..8b90200 --- /dev/null +++ b/server/resources/META-INF/cloudstack/server-storage/spring-server-storage-context.xml @@ -0,0 +1,34 @@ +<!-- + 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. +--> +<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:aop="http://www.springframework.org/schema/aop" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-3.0.xsd" + > + + <bean id="secondaryStorageVmDefaultAllocator" + class="com.cloud.storage.secondary.SecondaryStorageVmDefaultAllocator" /> + + +</beans> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/server/resources/META-INF/cloudstack/server-template-adapter/module.properties ---------------------------------------------------------------------- diff --git a/server/resources/META-INF/cloudstack/server-template-adapter/module.properties b/server/resources/META-INF/cloudstack/server-template-adapter/module.properties new file mode 100644 index 0000000..45531d9 --- /dev/null +++ b/server/resources/META-INF/cloudstack/server-template-adapter/module.properties @@ -0,0 +1,2 @@ +name=server-template-adapter +parent=storage \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/server/resources/META-INF/cloudstack/server-template-adapter/spring-server-template-adapter-context.xml ---------------------------------------------------------------------- diff --git a/server/resources/META-INF/cloudstack/server-template-adapter/spring-server-template-adapter-context.xml b/server/resources/META-INF/cloudstack/server-template-adapter/spring-server-template-adapter-context.xml new file mode 100644 index 0000000..1eeb27c --- /dev/null +++ b/server/resources/META-INF/cloudstack/server-template-adapter/spring-server-template-adapter-context.xml @@ -0,0 +1,32 @@ +<!-- + 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. +--> +<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:aop="http://www.springframework.org/schema/aop" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-3.0.xsd" + > + + <bean id="hypervisorTemplateAdapter" class="com.cloud.template.HypervisorTemplateAdapter" /> + +</beans> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/server/src/com/cloud/api/ApiServer.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java index b73045d..fd3492d 100755 --- a/server/src/com/cloud/api/ApiServer.java +++ b/server/src/com/cloud/api/ApiServer.java @@ -82,7 +82,6 @@ import org.apache.http.protocol.ResponseDate; import org.apache.http.protocol.ResponseServer; import org.apache.log4j.Logger; import org.springframework.stereotype.Component; - import org.apache.cloudstack.acl.APIChecker; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiErrorCode; @@ -186,11 +185,11 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer @Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { - init(); return true; } - public void init() { + @Override + public boolean start() { Integer apiPort = null; // api port, null by default SearchCriteria<ConfigurationVO> sc = _configDao.createSearchCriteria(); sc.addAnd("name", SearchCriteria.Op.EQ, Config.IntegrationAPIPort.key()); @@ -245,6 +244,8 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer ListenerThread listenerThread = new ListenerThread(this, apiPort); listenerThread.start(); } + + return true; } // NOTE: handle() only handles over the wire (OTW) requests from integration.api.port 8096 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/server/src/com/cloud/consoleproxy/StaticConsoleProxyManager.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/consoleproxy/StaticConsoleProxyManager.java b/server/src/com/cloud/consoleproxy/StaticConsoleProxyManager.java index 675ff25..ef16133 100755 --- a/server/src/com/cloud/consoleproxy/StaticConsoleProxyManager.java +++ b/server/src/com/cloud/consoleproxy/StaticConsoleProxyManager.java @@ -70,6 +70,9 @@ public class StaticConsoleProxyManager extends AgentBasedConsoleProxyManager imp private String _ip = null; + public StaticConsoleProxyManager() { + + } @Override protected HostVO findHost(VMInstanceVO vm) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/server/src/com/cloud/event/ActionEventInterceptor.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/event/ActionEventInterceptor.java b/server/src/com/cloud/event/ActionEventInterceptor.java index 8396512..1820b34 100644 --- a/server/src/com/cloud/event/ActionEventInterceptor.java +++ b/server/src/com/cloud/event/ActionEventInterceptor.java @@ -20,14 +20,45 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; +import org.aopalliance.intercept.MethodInterceptor; +import org.aopalliance.intercept.MethodInvocation; import org.apache.cloudstack.context.CallContext; import com.cloud.utils.component.ComponentMethodInterceptor; -public class ActionEventInterceptor implements ComponentMethodInterceptor { +public class ActionEventInterceptor implements ComponentMethodInterceptor, MethodInterceptor { public ActionEventInterceptor() { } + + @Override + public Object invoke(MethodInvocation invocation) throws Throwable { + Method m = invocation.getMethod(); + Object target = invocation.getThis(); + + if ( getActionEvents(m).size() == 0 ) { + /* Look for annotation on impl class */ + m = target.getClass().getMethod(m.getName(), m.getParameterTypes()); + } + + Object interceptorData = null; + + boolean success = true; + try { + interceptorData = interceptStart(m, target); + + Object result = invocation.proceed(); + success = true; + + return result; + } finally { + if ( success ) { + interceptComplete(m, target, interceptorData); + } else { + interceptException(m, target, interceptorData); + } + } + } @Override public Object interceptStart(Method method, Object target) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/server/src/com/cloud/network/vpc/VpcManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java index 651e82c..f2fe69f 100644 --- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java +++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java @@ -1204,7 +1204,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis } - protected List<VpcProvider> getVpcElements() { + public List<VpcProvider> getVpcElements() { if (vpcElements == null) { vpcElements = new ArrayList<VpcProvider>(); vpcElements.add((VpcProvider)_ntwkModel.getElementImplementingProvider(Provider.VPCVirtualRouter.getName())); @@ -2178,4 +2178,9 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis return new ArrayList<Provider>(providers.values()); } + + @Inject + public void setVpcElements(List<VpcProvider> vpcElements) { + this.vpcElements = vpcElements; + } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/server/src/com/cloud/resource/ResourceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index 7a9343c..6659109 100755 --- a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -2491,4 +2491,12 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager, return false; } } + + @Override + public boolean start() { + // TODO Auto-generated method stub + return super.start(); + } + + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/services/secondary-storage/resources/META-INF/cloudstack/secondary-storage-discoverer/module.properties ---------------------------------------------------------------------- diff --git a/services/secondary-storage/resources/META-INF/cloudstack/secondary-storage-discoverer/module.properties b/services/secondary-storage/resources/META-INF/cloudstack/secondary-storage-discoverer/module.properties new file mode 100644 index 0000000..31cb715 --- /dev/null +++ b/services/secondary-storage/resources/META-INF/cloudstack/secondary-storage-discoverer/module.properties @@ -0,0 +1,2 @@ +name=secondary-storage-discoverer +parent=discoverer \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/services/secondary-storage/resources/META-INF/cloudstack/secondary-storage-discoverer/spring-secondary-storage-discoverer-context.xml ---------------------------------------------------------------------- diff --git a/services/secondary-storage/resources/META-INF/cloudstack/secondary-storage-discoverer/spring-secondary-storage-discoverer-context.xml b/services/secondary-storage/resources/META-INF/cloudstack/secondary-storage-discoverer/spring-secondary-storage-discoverer-context.xml new file mode 100644 index 0000000..30521aa --- /dev/null +++ b/services/secondary-storage/resources/META-INF/cloudstack/secondary-storage-discoverer/spring-secondary-storage-discoverer-context.xml @@ -0,0 +1,36 @@ +<!-- + 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. +--> +<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:aop="http://www.springframework.org/schema/aop" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd + http://www.springframework.org/schema/context + http://www.springframework.org/schema/context/spring-context-3.0.xsd" + > + + <bean id="SecondaryStorageDiscoverer" + class="org.apache.cloudstack.storage.resource.SecondaryStorageDiscoverer"> + <property name="name" value="SecondaryStorage" /> + </bean> + + +</beans> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/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 index 332e4ec..ae2aefe 100644 --- a/utils/src/com/cloud/utils/component/ComponentContext.java +++ b/utils/src/com/cloud/utils/component/ComponentContext.java @@ -49,6 +49,7 @@ public class ComponentContext implements ApplicationContextAware { private static final Logger s_logger = Logger.getLogger(ComponentContext.class); private static ApplicationContext s_appContext; + private static Map<Class<?>, ApplicationContext> s_appContextDelegates; private static boolean s_initializeBeans = true; @Override @@ -234,11 +235,35 @@ public class ComponentContext implements ApplicationContextAware { public static <T> T inject(Object instance) { // autowire dynamically loaded object - AutowireCapableBeanFactory beanFactory = s_appContext.getAutowireCapableBeanFactory(); + AutowireCapableBeanFactory beanFactory = getApplicationContext(instance).getAutowireCapableBeanFactory(); beanFactory.autowireBean(instance); return (T)instance; } + private static ApplicationContext getApplicationContext(Object instance) { + ApplicationContext result = null; + + if (instance != null && s_appContextDelegates != null) { + result = s_appContextDelegates.get(instance.getClass()); + } + + return result == null ? s_appContext : result; + } + + public static synchronized void addDelegateContext(Class<?> clazz, ApplicationContext context) { + if (s_appContextDelegates == null) { + s_appContextDelegates = new HashMap<Class<?>, ApplicationContext>(); + } + + s_appContextDelegates.put(clazz, context); + } + + public static synchronized void removeDelegateContext(Class<?> clazz) { + if (s_appContextDelegates != null) { + s_appContextDelegates.remove(clazz); + } + } + public boolean isInitializeBeans() { return s_initializeBeans; }
