From: Ales J. <ale...@ge...> - 2006-07-09 13:18:56
|
User: alesj Date: 06/07/09 09:18:48 Modified: src/main/org/jboss/spring/deployment SpringApplicationContextDeployer.java SpringBeanFactoryDeployer.java SpringDeployer.java SpringDeployerMBean.java Log: Reformat code + Spring-MC fix. Revision Changes Path 1.3 +9 -23 jboss-spring/src/main/org/jboss/spring/deployment/SpringApplicationContextDeployer.java (In the diff below, changes in quantity of whitespace are not shown.) Index: SpringApplicationContextDeployer.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/deployment/SpringApplicationContextDeployer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- SpringApplicationContextDeployer.java 18 Apr 2006 16:51:22 -0000 1.2 +++ SpringApplicationContextDeployer.java 9 Jul 2006 13:18:48 -0000 1.3 @@ -1,29 +1,16 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ +/*************************************** + * * + * JBoss: The OpenSource J2EE WebOS * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + ***************************************/ package org.jboss.spring.deployment; -import org.jboss.spring.factory.BeanFactoryLoader; import org.jboss.spring.factory.ApplicationContextLoaderImpl; +import org.jboss.spring.factory.BeanFactoryLoader; import javax.management.ObjectName; @@ -33,7 +20,6 @@ * extends="org.jboss.spring.deployment.SpringDeployer" */ public class SpringApplicationContextDeployer extends SpringDeployer - implements SpringApplicationContextDeployerMBean { //default object name 1.3 +8 -22 jboss-spring/src/main/org/jboss/spring/deployment/SpringBeanFactoryDeployer.java (In the diff below, changes in quantity of whitespace are not shown.) Index: SpringBeanFactoryDeployer.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/deployment/SpringBeanFactoryDeployer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- SpringBeanFactoryDeployer.java 18 Apr 2006 16:51:22 -0000 1.2 +++ SpringBeanFactoryDeployer.java 9 Jul 2006 13:18:48 -0000 1.3 @@ -1,24 +1,11 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2005, JBoss Inc., and individual contributors as indicated - * by the @authors tag. See the copyright.txt in the distribution for a - * full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ +/*************************************** + * * + * JBoss: The OpenSource J2EE WebOS * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + ***************************************/ package org.jboss.spring.deployment; @@ -33,7 +20,6 @@ * extends="org.jboss.spring.deployment.SpringDeployer" */ public class SpringBeanFactoryDeployer extends SpringDeployer - implements SpringBeanFactoryDeployerMBean { //default object name 1.11 +47 -24 jboss-spring/src/main/org/jboss/spring/deployment/SpringDeployer.java (In the diff below, changes in quantity of whitespace are not shown.) Index: SpringDeployer.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/deployment/SpringDeployer.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -b -r1.10 -r1.11 --- SpringDeployer.java 18 Apr 2006 12:13:23 -0000 1.10 +++ SpringDeployer.java 9 Jul 2006 13:18:48 -0000 1.11 @@ -39,7 +39,8 @@ * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ public abstract class SpringDeployer extends SubDeployerSupport implements - SubDeployer, SpringDeployerMBean { + SubDeployer, SpringDeployerMBean +{ protected abstract BeanFactoryLoader createBeanFactoryLoader(); @@ -50,11 +51,13 @@ * attributes. Those are read at subdeployer registration time by the MainDeployer * to alter its SuffixOrder. */ - public SpringDeployer() { + public SpringDeployer() + { initializeMainDeployer(); } - protected void initializeMainDeployer() { + protected void initializeMainDeployer() + { setSuffixes(new String[]{".spring", "-spring.xml"}); setRelativeOrder(350); //after -ds, before ejb3 } @@ -65,7 +68,8 @@ * @return True if this deployer can deploy the given DeploymentInfo. * @jmx:managed-operation */ - public boolean accepts(DeploymentInfo di) { + public boolean accepts(DeploymentInfo di) + { String urlStr = di.url.toString(); return urlStr.endsWith(".spring") || urlStr.endsWith(".spring/") || urlStr.endsWith("-spring.xml"); @@ -78,26 +82,34 @@ * @throws DeploymentException if an error occurs * @jmx:managed-operation */ - public void init(DeploymentInfo di) throws DeploymentException { - try { - if (di.watch == null) { + public void init(DeploymentInfo di) throws DeploymentException + { + try + { + if (di.watch == null) + { // resolve the watch - if (di.url.getProtocol().equals("file")) { + if (di.url.getProtocol().equals("file")) + { File file = new File(di.url.getFile()); // If not directory we watch the package - if (!file.isDirectory()) { + if (!file.isDirectory()) + { di.watch = di.url; } // If directory we watch the xml files - else { + else + { di.watch = new URL(di.url, "META-INF/jboss-spring.xml"); } - } else { + } else + { // We watch the top only, no directory support di.watch = di.url; } } - } catch (Exception e) { + } catch (Exception e) + { log.error("failed to parse Spring context document: ", e); throw new DeploymentException(e); } @@ -111,12 +123,15 @@ * @throws DeploymentException if an error occurs * @jmx:managed-operation */ - public void create(DeploymentInfo di) throws DeploymentException { - try { + public void create(DeploymentInfo di) throws DeploymentException + { + try + { beanFactoryLoader.create(di); emitNotification("Spring Deploy", di); log.info("Deployed Spring: " + di.url); - } catch (Exception e) { + } catch (Exception e) + { throw new DeploymentException(e); } } @@ -128,7 +143,8 @@ * @throws DeploymentException if an error occurs * @jmx:managed-operation */ - public void start(DeploymentInfo di) throws DeploymentException { + public void start(DeploymentInfo di) throws DeploymentException + { beanFactoryLoader.start(di); } @@ -143,12 +159,15 @@ * @param di the <code>DeploymentInfo</code> value to stop. * @jmx:managed-operation */ - public void stop(DeploymentInfo di) { + public void stop(DeploymentInfo di) + { log.info("Undeploying Spring: " + di.url); - try { + try + { beanFactoryLoader.stop(di); emitNotification("Spring Undeploy", di); - } catch (Exception e) { + } catch (Exception e) + { log.error("Failed to stop bean factory: " + di.url); } } @@ -159,17 +178,21 @@ * @param di a <code>DeploymentInfo</code> value * @jmx:managed-operation */ - public void destroy(DeploymentInfo di) { - try { + public void destroy(DeploymentInfo di) + { + try + { beanFactoryLoader.destroy(di); emitNotification("Spring Destroy", di); - } catch (DeploymentException e) { + } catch (DeploymentException e) + { log.error("Failed to destroy deployer: " + di); } } protected ObjectName getObjectName(MBeanServer server, ObjectName name) - throws MalformedObjectNameException { + throws MalformedObjectNameException + { return name == null ? getDefaultObjectName() : name; } 1.5 +21 -7 jboss-spring/src/main/org/jboss/spring/deployment/SpringDeployerMBean.java (In the diff below, changes in quantity of whitespace are not shown.) Index: SpringDeployerMBean.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/deployment/SpringDeployerMBean.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- SpringDeployerMBean.java 4 Nov 2005 15:41:45 -0000 1.4 +++ SpringDeployerMBean.java 9 Jul 2006 13:18:48 -0000 1.5 @@ -20,44 +20,58 @@ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.spring.deployment; + /** * MBean interface. + * * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public interface SpringDeployerMBean extends org.jboss.deployment.SubDeployerMBean { +public interface SpringDeployerMBean extends org.jboss.deployment.SubDeployerMBean +{ /** * Returns true if this deployer can deploy the given DeploymentInfo. + * * @return True if this deployer can deploy the given DeploymentInfo. */ - boolean accepts(org.jboss.deployment.DeploymentInfo di) ; + boolean accepts(org.jboss.deployment.DeploymentInfo di); + /** * Describe <code>init</code> method here. + * * @param di a <code>DeploymentInfo</code> value * @throws org.jboss.deployment.DeploymentException if an error occurs */ void init(org.jboss.deployment.DeploymentInfo di) throws org.jboss.deployment.DeploymentException; + /** * Describe <code>create</code> method here. + * * @param di a <code>DeploymentInfo</code> value * @throws org.jboss.deployment.DeploymentException if an error occurs */ void create(org.jboss.deployment.DeploymentInfo di) throws org.jboss.deployment.DeploymentException; + /** * The <code>start</code> method starts all the mbeans in this DeploymentInfo.. + * * @param di a <code>DeploymentInfo</code> value * @throws org.jboss.deployment.DeploymentException if an error occurs */ void start(org.jboss.deployment.DeploymentInfo di) throws org.jboss.deployment.DeploymentException; + /** * Undeploys the package at the url string specified. This will: Undeploy packages depending on this one. * Stop, destroy, and unregister all the specified mbeans Unload this package and packages this package * deployed via the classpath tag. Keep track of packages depending on this one that we undeployed so * that they can be redeployed should this one be redeployed. + * * @param di the <code>DeploymentInfo</code> value to stop. */ void stop(org.jboss.deployment.DeploymentInfo di); + /** * Describe <code>destroy</code> method here. + * * @param di a <code>DeploymentInfo</code> value */ void destroy(org.jboss.deployment.DeploymentInfo di); |