You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
(544) |
May
(1715) |
Jun
(1059) |
Jul
(886) |
Aug
(1214) |
Sep
(1375) |
Oct
(1664) |
Nov
(1153) |
Dec
(1084) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(1630) |
Feb
(1634) |
Mar
(1979) |
Apr
(1119) |
May
(1850) |
Jun
(1231) |
Jul
(1168) |
Aug
(1840) |
Sep
(1038) |
Oct
(1127) |
Nov
(1458) |
Dec
(854) |
2004 |
Jan
(1145) |
Feb
(1064) |
Mar
(2242) |
Apr
(1728) |
May
(1346) |
Jun
(1280) |
Jul
(1681) |
Aug
(2388) |
Sep
(2233) |
Oct
(3246) |
Nov
(3248) |
Dec
(1775) |
2005 |
Jan
(3407) |
Feb
(3049) |
Mar
(2402) |
Apr
(3687) |
May
(3289) |
Jun
(5731) |
Jul
(3905) |
Aug
(5843) |
Sep
(5149) |
Oct
(6866) |
Nov
(4051) |
Dec
(4646) |
2006 |
Jan
(7356) |
Feb
(4713) |
Mar
(9447) |
Apr
(6553) |
May
(6206) |
Jun
(4301) |
Jul
(1160) |
Aug
(23) |
Sep
(11) |
Oct
(19) |
Nov
(26) |
Dec
(15) |
2007 |
Jan
(28) |
Feb
(24) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Ales J. <ale...@ge...> - 2006-07-09 15:05:45
|
User: alesj Date: 06/07/09 11:05:42 Log: Directory /cvsroot/jboss/jboss-spring/src/test/org/jboss/spring/test/ear/business added to the repository |
From: Ales J. <ale...@ge...> - 2006-07-09 15:05:01
|
User: alesj Date: 06/07/09 11:04:58 Log: Directory /cvsroot/jboss/jboss-spring/src/resources/ear/spring/META-INF added to the repository |
From: Ales J. <ale...@ge...> - 2006-07-09 15:04:47
|
User: alesj Date: 06/07/09 11:04:45 Log: Directory /cvsroot/jboss/jboss-spring/src/resources/ear/business/META-INF added to the repository |
From: Ales J. <ale...@ge...> - 2006-07-09 15:04:19
|
User: alesj Date: 06/07/09 11:04:16 Log: Directory /cvsroot/jboss/jboss-spring/src/resources/ear/spring added to the repository |
From: Ales J. <ale...@ge...> - 2006-07-09 15:03:55
|
User: alesj Date: 06/07/09 11:03:52 Log: Directory /cvsroot/jboss/jboss-spring/src/resources/ear/business added to the repository |
From: Ales J. <ale...@ge...> - 2006-07-09 15:03:28
|
User: alesj Date: 06/07/09 11:03:26 Log: Directory /cvsroot/jboss/jboss-spring/src/resources/ear added to the repository |
From: Ales J. <ale...@ge...> - 2006-07-09 14:58:20
|
User: alesj Date: 06/07/09 10:58:17 Log: Directory /cvsroot/jboss/jboss-spring/src/test/org/jboss/spring/test/ear/unit added to the repository |
From: Ales J. <ale...@ge...> - 2006-07-09 14:58:08
|
User: alesj Date: 06/07/09 10:58:05 Log: Directory /cvsroot/jboss/jboss-spring/src/test/org/jboss/spring/test/ear added to the repository |
From: Ales J. <ale...@ge...> - 2006-07-09 14:33:04
|
User: alesj Date: 06/07/09 10:33:02 Log: Directory /cvsroot/jboss/jboss-spring/src/test/org/jboss/test/spring/unit added to the repository |
From: Ales J. <ale...@ge...> - 2006-07-09 14:32:53
|
User: alesj Date: 06/07/09 10:32:50 Log: Directory /cvsroot/jboss/jboss-spring/src/test/org/jboss/test/spring added to the repository |
From: Ales J. <ale...@ge...> - 2006-07-09 14:32:10
|
User: alesj Date: 06/07/09 10:32:03 Log: Directory /cvsroot/jboss/jboss-spring/src/test/org/jboss/test added to the repository |
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); |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:55
|
User: alesj Date: 06/07/09 09:18:48 Modified: src/main/org/jboss/spring/kernel ControllerLocator.java KernelLocator.java LazyLocator.java Locator.java MapLocator.java MicrocontainerConfigurer.java MicrocontainerLoaderImpl.java MicrocontainerLocatorSupport.java NullLocator.java SpringMicrocontainerDeployer.java Log: Reformat code + Spring-MC fix. Revision Changes Path 1.4 +10 -33 jboss-spring/src/main/org/jboss/spring/kernel/ControllerLocator.java (In the diff below, changes in quantity of whitespace are not shown.) Index: ControllerLocator.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/kernel/ControllerLocator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- ControllerLocator.java 18 Apr 2006 16:51:23 -0000 1.3 +++ ControllerLocator.java 9 Jul 2006 13:18:48 -0000 1.4 @@ -1,23 +1,9 @@ -/* - * 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. +/** + * User: alesj + * Date: 18.4.2006 + * Time: 12:42:33 * - * 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. + * (C) Genera Lynx d.o.o. */ package org.jboss.spring.kernel; @@ -26,8 +12,6 @@ import org.jboss.kernel.spi.dependency.KernelController; /** - * Locate object through KernelController. - * * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ public class ControllerLocator implements Locator @@ -49,18 +33,11 @@ return controller; } - protected void setController(KernelController controller) - { - this.controller = controller; - } - - /** - * @return target object from installed context if exists else null - */ - public Object locateBean(String beanName, Class targetType) + public Object locateBean(String beanName) { ControllerContext context = getController().getInstalledContext(beanName); - if (context == null) { + if (context == null) + { return null; } return context.getTarget(); 1.3 +7 -24 jboss-spring/src/main/org/jboss/spring/kernel/KernelLocator.java (In the diff below, changes in quantity of whitespace are not shown.) Index: KernelLocator.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/kernel/KernelLocator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- KernelLocator.java 18 Apr 2006 16:51:23 -0000 1.2 +++ KernelLocator.java 9 Jul 2006 13:18:48 -0000 1.3 @@ -1,23 +1,9 @@ -/* - * 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. +/** + * User: alesj + * Date: 18.4.2006 + * Time: 12:42:33 * - * 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. + * (C) Genera Lynx d.o.o. */ package org.jboss.spring.kernel; @@ -26,9 +12,6 @@ import org.jboss.kernel.spi.dependency.KernelController; /** - * Locate object from Kernel - through its KernelController. - * @see ControllerLocator - * * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ public class KernelLocator extends ControllerLocator 1.5 +1 -1 jboss-spring/src/main/org/jboss/spring/kernel/LazyLocator.java (In the diff below, changes in quantity of whitespace are not shown.) Index: LazyLocator.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/kernel/LazyLocator.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- LazyLocator.java 19 Apr 2006 09:01:14 -0000 1.4 +++ LazyLocator.java 9 Jul 2006 13:18:48 -0000 1.5 @@ -76,7 +76,7 @@ { if (this.cachedObject == null) { - this.cachedObject = lookupBean(beanName, targetClass); + this.cachedObject = locateBean(beanName, targetClass); } return this.cachedObject; } 1.4 +8 -30 jboss-spring/src/main/org/jboss/spring/kernel/Locator.java (In the diff below, changes in quantity of whitespace are not shown.) Index: Locator.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/kernel/Locator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- Locator.java 18 Apr 2006 16:51:23 -0000 1.3 +++ Locator.java 9 Jul 2006 13:18:48 -0000 1.4 @@ -1,41 +1,19 @@ -/* - * 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. +/** + * User: alesj + * Date: 18.4.2006 + * Time: 12:42:33 * - * 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. + * (C) Genera Lynx d.o.o. */ package org.jboss.spring.kernel; /** - * Locate object by beanName and targetType. - * * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ public interface Locator { - /** - * @param beanName String to do lookup with - * @param targetType interface for proxy or null - * @return bean instance or proxy for lazy invocation - * @see LazyLocator - */ - Object locateBean(String beanName, Class targetType); + Object locateBean(String beanName); } 1.4 +8 -27 jboss-spring/src/main/org/jboss/spring/kernel/MapLocator.java (In the diff below, changes in quantity of whitespace are not shown.) Index: MapLocator.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/kernel/MapLocator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- MapLocator.java 18 Apr 2006 16:51:23 -0000 1.3 +++ MapLocator.java 9 Jul 2006 13:18:48 -0000 1.4 @@ -1,23 +1,9 @@ -/* - * 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. +/** + * User: alesj + * Date: 18.4.2006 + * Time: 12:42:33 * - * 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. + * (C) Genera Lynx d.o.o. */ package org.jboss.spring.kernel; @@ -25,8 +11,6 @@ import java.util.Map; /** - * Simple map locator - beanName as a key. - * * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ public class MapLocator implements Locator @@ -44,10 +28,7 @@ return map; } - /** - * @return object from a map by beanName key - */ - public Object locateBean(String beanName, Class targetType) + public Object locateBean(String beanName) { return getMap().get(beanName); } 1.5 +51 -46 jboss-spring/src/main/org/jboss/spring/kernel/MicrocontainerConfigurer.java (In the diff below, changes in quantity of whitespace are not shown.) Index: MicrocontainerConfigurer.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/kernel/MicrocontainerConfigurer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- MicrocontainerConfigurer.java 18 Apr 2006 16:51:23 -0000 1.4 +++ MicrocontainerConfigurer.java 9 Jul 2006 13:18:48 -0000 1.5 @@ -1,58 +1,44 @@ -/* - * 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. +/** + * User: alesj + * Date: 18.4.2006 + * Time: 12:42:33 * - * 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. + * (C) Genera Lynx d.o.o. */ package org.jboss.spring.kernel; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanDefinitionStoreException; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.BeanFactoryAware; +import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.config.*; import org.springframework.core.Ordered; /** - * Looks for microcontainer defined dependencies. - * It searches for 'mc${beanName}' in bean injection definition. - * Then locates bean with 'beanName' through locator field. - * * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ public class MicrocontainerConfigurer extends MicrocontainerLocatorSupport - implements BeanFactoryPostProcessor, Ordered + implements BeanFactoryPostProcessor, BeanNameAware, BeanFactoryAware, Ordered { + private String beanName; + private BeanFactory beanFactory; private int order = Integer.MAX_VALUE; private String prefix = "mc${"; - protected boolean checkBean(ConfigurableBeanFactory beanFactoryToProcess, String beanName) { - return true; - } - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactoryToProcess) throws BeansException { BeanDefinitionVisitor visitor = new MicrocontainerBeanDefinitionVisitor(); String[] beanNames = beanFactoryToProcess.getBeanDefinitionNames(); + //noinspection ForLoopReplaceableByForEach for (int i = 0; i < beanNames.length; i++) { - if (checkBean(beanFactoryToProcess, beanNames[i])) + // Check that we're not parsing our own bean definition, + // to avoid failing on unresolvable placeholders in properties file locations. + if (!(beanNames[i].equals(this.beanName) && beanFactoryToProcess.equals(this.beanFactory))) { BeanDefinition bd = beanFactoryToProcess.getBeanDefinition(beanNames[i]); try @@ -74,7 +60,7 @@ protected String parseBeansReference(String value) { - int endIndex = value.lastIndexOf("}"); + int endIndex = value.lastIndexOf("$"); endIndex = endIndex >= 0 ? endIndex : value.length(); return value.substring(prefix.length(), endIndex); } @@ -90,30 +76,21 @@ protected Object resolveValue(Object value) { value = super.resolveValue(value); - if (value instanceof RuntimeBeanReference) - { - RuntimeBeanReference ref = (RuntimeBeanReference) value; - String beansRef = ref.getBeanName(); - if (isMicrocontainerRef(beansRef)) - { - return lookupBean(parseBeansReference(beansRef), null); - } - } - else if (value instanceof TypedStringValue) + if (value instanceof TypedStringValue) { TypedStringValue typedStringValue = (TypedStringValue) value; String beansRef = typedStringValue.getValue(); if (isMicrocontainerRef(beansRef)) { - return lookupBean(parseBeansReference(beansRef), typedStringValue.getTargetType()); + return locateBean(parseBeansReference(beansRef)); } } - else if (value instanceof String) + if (value instanceof String) { - String beansRef = (String)value; + String beansRef = (String) value; if (isMicrocontainerRef(beansRef)) { - return lookupBean(parseBeansReference(beansRef), null); + return locateBean(parseBeansReference(beansRef)); } } return value; @@ -121,6 +98,34 @@ } + /** + * Only necessary to check that we're not parsing our own bean definition, + * to avoid failing on unresolvable placeholders in properties file locations. + * The latter case can happen with placeholders for system properties in + * resource locations. + * + * @see #setLocations + * @see org.springframework.core.io.ResourceEditor + */ + public void setBeanName(String beanName) + { + this.beanName = beanName; + } + + /** + * Only necessary to check that we're not parsing our own bean definition, + * to avoid failing on unresolvable placeholders in properties file locations. + * The latter case can happen with placeholders for system properties in + * resource locations. + * + * @see #setLocations + * @see org.springframework.core.io.ResourceEditor + */ + public void setBeanFactory(BeanFactory beanFactory) + { + this.beanFactory = beanFactory; + } + public int getOrder() { return order; 1.5 +15 -10 jboss-spring/src/main/org/jboss/spring/kernel/MicrocontainerLoaderImpl.java (In the diff below, changes in quantity of whitespace are not shown.) Index: MicrocontainerLoaderImpl.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/kernel/MicrocontainerLoaderImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- MicrocontainerLoaderImpl.java 19 Apr 2006 08:37:02 -0000 1.4 +++ MicrocontainerLoaderImpl.java 9 Jul 2006 13:18:48 -0000 1.5 @@ -24,20 +24,17 @@ import org.jboss.kernel.Kernel; import org.jboss.kernel.spi.dependency.KernelController; -import org.jboss.spring.factory.ApplicationContextLoaderImpl; +import org.jboss.spring.factory.AbstractBeanFactoryLoader; import org.jboss.spring.factory.NamedXmlApplicationContext; import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.io.Resource; /** - * Loads Spring application context. - * Before loading bean factory it adds BeanFactoryPostProcessor which - * looks up microcontainer dependent definitions. - * * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public class MicrocontainerLoaderImpl extends ApplicationContextLoaderImpl +public class MicrocontainerLoaderImpl extends AbstractBeanFactoryLoader { protected BeanFactory createBeanFactory(String defaultName, Resource resource) @@ -60,16 +57,24 @@ return applicationContext; } - // todo - bind to jbossas5 kernel - protected KernelController getKernelController() + protected void doClose(BeanFactory beanFactory) { - return null; + ((ConfigurableApplicationContext) beanFactory).close(); + } + + protected Class getExactBeanFactoryClass() + { + return ApplicationContext.class; } - // todo - bind to jbossas5 kernel protected Kernel getKernel() { return null; } + protected KernelController getKernelController() + { + return null; + } + } 1.4 +10 -28 jboss-spring/src/main/org/jboss/spring/kernel/MicrocontainerLocatorSupport.java (In the diff below, changes in quantity of whitespace are not shown.) Index: MicrocontainerLocatorSupport.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/kernel/MicrocontainerLocatorSupport.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- MicrocontainerLocatorSupport.java 18 Apr 2006 16:51:23 -0000 1.3 +++ MicrocontainerLocatorSupport.java 9 Jul 2006 13:18:48 -0000 1.4 @@ -1,37 +1,19 @@ -/* - * 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. +/** + * User: alesj + * Date: 18.4.2006 + * Time: 12:42:33 * - * 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. + * (C) Genera Lynx d.o.o. */ package org.jboss.spring.kernel; /** - * Simple locator delagator. - * Removes locator logic from context logic. - * - * @see LazyLocator - * * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ public class MicrocontainerLocatorSupport { + private Locator locator = new NullLocator(); public MicrocontainerLocatorSupport() @@ -53,9 +35,9 @@ this.locator = locator; } - protected Object lookupBean(String beanName, Class targetType) + public Object locateBean(String beanName) { - return getLocator().locateBean(beanName, targetType); + return getLocator().locateBean(beanName); } } 1.4 +8 -25 jboss-spring/src/main/org/jboss/spring/kernel/NullLocator.java (In the diff below, changes in quantity of whitespace are not shown.) Index: NullLocator.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/kernel/NullLocator.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- NullLocator.java 18 Apr 2006 16:51:23 -0000 1.3 +++ NullLocator.java 9 Jul 2006 13:18:48 -0000 1.4 @@ -1,37 +1,20 @@ -/* - * 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. +/** + * User: alesj + * Date: 18.4.2006 + * Time: 12:42:33 * - * 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. + * (C) Genera Lynx d.o.o. */ package org.jboss.spring.kernel; /** - * Always returns null as a located bean. - * Useful for no-impl usage. - * * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ public class NullLocator implements Locator { - public Object locateBean(String beanName, Class targetType) + public Object locateBean(String beanName) { return null; } 1.3 +10 -24 jboss-spring/src/main/org/jboss/spring/kernel/SpringMicrocontainerDeployer.java (In the diff below, changes in quantity of whitespace are not shown.) Index: SpringMicrocontainerDeployer.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/kernel/SpringMicrocontainerDeployer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- SpringMicrocontainerDeployer.java 18 Apr 2006 16:51:23 -0000 1.2 +++ SpringMicrocontainerDeployer.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.kernel; @@ -29,11 +16,10 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> - * @jmx:mbean name="jboss.spring:service=SpringMicrocontainerDeployer" - * extends="org.jboss.spring.deployment.SpringDeployer" + * @jmx:mbean name="jboss.spring:service=SpringApplicationContextDeployer" + * extends="org.jboss.deployment.SubDeployerMBean" */ public class SpringMicrocontainerDeployer extends SpringDeployer - implements SpringMicrocontainerDeployerMBean { //default object name |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:55
|
User: alesj Date: 06/07/09 09:18:48 Modified: src/main/org/jboss/annotation/spring Spring.java Log: Reformat code + Spring-MC fix. Revision Changes Path 1.6 +4 -2 jboss-spring/src/main/org/jboss/annotation/spring/Spring.java (In the diff below, changes in quantity of whitespace are not shown.) Index: Spring.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/annotation/spring/Spring.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- Spring.java 27 Jan 2006 14:03:40 -0000 1.5 +++ Spring.java 9 Jul 2006 13:18:48 -0000 1.6 @@ -31,8 +31,10 @@ * @author <a href="mailto:bi...@jb...">Bill Burke</a> * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -@Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) -public @interface Spring { +@Target({ElementType.METHOD, ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface Spring +{ String jndiName(); |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:55
|
User: alesj Date: 06/07/09 09:18:49 Modified: src/resources/test/docs JBoss-Spring-Example.html Log: Reformat code + Spring-MC fix. Revision Changes Path 1.2 +645 -219 jboss-spring/src/resources/test/docs/JBoss-Spring-Example.html (In the diff below, changes in quantity of whitespace are not shown.) Index: JBoss-Spring-Example.html =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/resources/test/docs/JBoss-Spring-Example.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- JBoss-Spring-Example.html 23 Aug 2005 18:22:27 -0000 1.1 +++ JBoss-Spring-Example.html 9 Jul 2006 13:18:49 -0000 1.2 @@ -1,6 +1,6 @@ <html xmlns:o="urn:schemas-microsoft-com:office:office" -xmlns:w="urn:schemas-microsoft-com:office:word" -xmlns="http://www.w3.org/TR/REC-html40"> + xmlns:w="urn:schemas-microsoft-com:office:word" + xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> @@ -11,8 +11,8 @@ <title>JBoss + Spring example:</title> <!--[if gte mso 9]><xml> <o:DocumentProperties> - <o:Author>Ale Justin</o:Author> - <o:LastAuthor>Ale Justin</o:LastAuthor> + <o:Author>Ale� Justin</o:Author> + <o:LastAuthor>Ale� Justin</o:LastAuthor> <o:Revision>2</o:Revision> <o:TotalTime>263</o:TotalTime> <o:Created>2005-08-10T12:16:00Z</o:Created> @@ -40,164 +40,580 @@ </xml><![endif]--> <style> <!-- - /* Style Definitions */ - p.MsoNormal, li.MsoNormal, div.MsoNormal - {mso-style-parent:""; - margin:0cm; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -h2 - {mso-style-next:Normal; - margin-top:12.0pt; - margin-right:0cm; - margin-bottom:3.0pt; - margin-left:0cm; - mso-pagination:widow-orphan; - page-break-after:avoid; - mso-outline-level:2; - font-size:14.0pt; - font-family:Arial; - font-style:italic;} -a:link, span.MsoHyperlink - {color:blue; - text-decoration:underline; - text-underline:single;} -a:visited, span.MsoHyperlinkFollowed - {color:purple; - text-decoration:underline; - text-underline:single;} -pre - {margin:0cm; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - tab-stops:36.0pt; - font-size:10.0pt; - font-family:"Courier New"; - mso-fareast-font-family:"Times New Roman";} -span.GramE - {mso-style-name:""; - mso-gram-e:yes;} -@page Section1 - {size:612.0pt 792.0pt; - margin:72.0pt 90.0pt 72.0pt 90.0pt; - mso-header-margin:35.4pt; - mso-footer-margin:35.4pt; - mso-paper-source:0;} -div.Section1 - {page:Section1;} - /* List Definitions */ - @list l0 - {mso-list-id:-132; - mso-list-type:simple; - mso-list-template-ids:1016904304;} -@list l0:level1 - {mso-level-tab-stop:74.6pt; - mso-level-number-position:left; - margin-left:74.6pt; - text-indent:-18.0pt;} -@list l1 - {mso-list-id:-131; - mso-list-type:simple; - mso-list-template-ids:1933872080;} -@list l1:level1 - {mso-level-tab-stop:60.45pt; - mso-level-number-position:left; - margin-left:60.45pt; - text-indent:-18.0pt;} -@list l2 - {mso-list-id:-130; - mso-list-type:simple; - mso-list-template-ids:1828635132;} -@list l2:level1 - {mso-level-tab-stop:46.3pt; - mso-level-number-position:left; - margin-left:46.3pt; - text-indent:-18.0pt;} -@list l3 - {mso-list-id:-129; - mso-list-type:simple; - mso-list-template-ids:-1641540048;} -@list l3:level1 - {mso-level-tab-stop:32.15pt; - mso-level-number-position:left; - margin-left:32.15pt; - text-indent:-18.0pt;} -@list l4 - {mso-list-id:-128; - mso-list-type:simple; - mso-list-template-ids:2112010756;} -@list l4:level1 - {mso-level-number-format:bullet; - mso-level-text:\F0B7; - mso-level-tab-stop:74.6pt; - mso-level-number-position:left; - margin-left:74.6pt; - text-indent:-18.0pt; - font-family:Symbol;} -@list l5 - {mso-list-id:-127; - mso-list-type:simple; - mso-list-template-ids:-1777165296;} -@list l5:level1 - {mso-level-number-format:bullet; - mso-level-text:\F0B7; - mso-level-tab-stop:60.45pt; - mso-level-number-position:left; - margin-left:60.45pt; - text-indent:-18.0pt; - font-family:Symbol;} -@list l6 - {mso-list-id:-126; - mso-list-type:simple; - mso-list-template-ids:1029624058;} -@list l6:level1 - {mso-level-number-format:bullet; - mso-level-text:\F0B7; - mso-level-tab-stop:46.3pt; - mso-level-number-position:left; - margin-left:46.3pt; - text-indent:-18.0pt; - font-family:Symbol;} -@list l7 - {mso-list-id:-125; - mso-list-type:simple; - mso-list-template-ids:-563021474;} -@list l7:level1 - {mso-level-number-format:bullet; - mso-level-text:\F0B7; - mso-level-tab-stop:32.15pt; - mso-level-number-position:left; - margin-left:32.15pt; - text-indent:-18.0pt; - font-family:Symbol;} -@list l8 - {mso-list-id:-120; - mso-list-type:simple; - mso-list-template-ids:-799663524;} -@list l8:level1 - {mso-level-tab-stop:18.0pt; - mso-level-number-position:left; - margin-left:18.0pt; - text-indent:-18.0pt;} -@list l9 - {mso-list-id:-119; - mso-list-type:simple; - mso-list-template-ids:-1707604292;} -@list l9:level1 - {mso-level-number-format:bullet; - mso-level-text:\F0B7; - mso-level-tab-stop:18.0pt; - mso-level-number-position:left; - margin-left:18.0pt; - text-indent:-18.0pt; - font-family:Symbol;} -ol - {margin-bottom:0cm;} -ul - {margin-bottom:0cm;} +/* Style Definitions */ +p.MsoNormal, li.MsoNormal, div.MsoNormal { + mso-style-parent: ""; + margin: 0cm; + margin-bottom: .0001pt; + mso-pagination: widow-orphan; + font-size: 12.0pt; + font-family: "Times New Roman"; + mso-fareast-font-family: "Times New Roman"; +} + +h2 { + mso-style-next: Normal; + margin-top: 12.0pt; + margin-right: 0cm; + margin-bottom: 3.0pt; + margin-left: 0cm; + mso-pagination: widow-orphan; + page-break-after: avoid; + mso-outline-level: 2; + font-size: 14.0pt; + font-family: Arial; + font-style: italic; +} + +a:link, span.MsoHyperlink { + color: blue; + text-decoration: underline; + text-underline: single; +} + +a:visited, span.MsoHyperlinkFollowed { + color: purple; + text-decoration: underline; + text-underline: single; +} + +pre { + margin: 0cm; + margin-bottom: .0001pt; + mso-pagination: widow-orphan; + tab-stops: 36.0pt; + font-size: 10.0pt; + font-family: "Courier New"; + mso-fareast-font-family: "Times New Roman"; +} + +span.GramE { + mso-style-name: ""; + mso-gram-e: yes; +} + +@page +Section1 +{ + size: 612.0pt 792.0pt +; + margin: 72.0pt 90.0pt 72.0pt 90.0pt +; + mso-header-margin: 35.4pt +; + mso-footer-margin: 35.4pt +; + mso-paper-source: 0 +; +} +div.Section1 { + page: Section1; +} + +/* List Definitions */ +@list +l0 +{ +mso-list-id +: +- +132 +; +mso-list-type +: +simple +; +mso-list-template-ids +: +1016904304 +; +} +@list +l0 +: +level1 +{ +mso-level-tab-stop +: +74.6 +pt +; +mso-level-number-position +: +left +; +margin-left +: +74.6 +pt +; +text-indent +: +- +18.0 +pt +; +} +@list +l1 +{ +mso-list-id +: +- +131 +; +mso-list-type +: +simple +; +mso-list-template-ids +: +1933872080 +; +} +@list +l1 +: +level1 +{ +mso-level-tab-stop +: +60.45 +pt +; +mso-level-number-position +: +left +; +margin-left +: +60.45 +pt +; +text-indent +: +- +18.0 +pt +; +} +@list +l2 +{ +mso-list-id +: +- +130 +; +mso-list-type +: +simple +; +mso-list-template-ids +: +1828635132 +; +} +@list +l2 +: +level1 +{ +mso-level-tab-stop +: +46.3 +pt +; +mso-level-number-position +: +left +; +margin-left +: +46.3 +pt +; +text-indent +: +- +18.0 +pt +; +} +@list +l3 +{ +mso-list-id +: +- +129 +; +mso-list-type +: +simple +; +mso-list-template-ids +: +- +1641540048 +; +} +@list +l3 +: +level1 +{ +mso-level-tab-stop +: +32.15 +pt +; +mso-level-number-position +: +left +; +margin-left +: +32.15 +pt +; +text-indent +: +- +18.0 +pt +; +} +@list +l4 +{ +mso-list-id +: +- +128 +; +mso-list-type +: +simple +; +mso-list-template-ids +: +2112010756 +; +} +@list +l4 +: +level1 +{ +mso-level-number-format +: +bullet +; +mso-level-text +: +\F0B7 +; +mso-level-tab-stop +: +74.6 +pt +; +mso-level-number-position +: +left +; +margin-left +: +74.6 +pt +; +text-indent +: +- +18.0 +pt +; +font-family +: +Symbol +; +} +@list +l5 +{ +mso-list-id +: +- +127 +; +mso-list-type +: +simple +; +mso-list-template-ids +: +- +1777165296 +; +} +@list +l5 +: +level1 +{ +mso-level-number-format +: +bullet +; +mso-level-text +: +\F0B7 +; +mso-level-tab-stop +: +60.45 +pt +; +mso-level-number-position +: +left +; +margin-left +: +60.45 +pt +; +text-indent +: +- +18.0 +pt +; +font-family +: +Symbol +; +} +@list +l6 +{ +mso-list-id +: +- +126 +; +mso-list-type +: +simple +; +mso-list-template-ids +: +1029624058 +; +} +@list +l6 +: +level1 +{ +mso-level-number-format +: +bullet +; +mso-level-text +: +\F0B7 +; +mso-level-tab-stop +: +46.3 +pt +; +mso-level-number-position +: +left +; +margin-left +: +46.3 +pt +; +text-indent +: +- +18.0 +pt +; +font-family +: +Symbol +; +} +@list +l7 +{ +mso-list-id +: +- +125 +; +mso-list-type +: +simple +; +mso-list-template-ids +: +- +563021474 +; +} +@list +l7 +: +level1 +{ +mso-level-number-format +: +bullet +; +mso-level-text +: +\F0B7 +; +mso-level-tab-stop +: +32.15 +pt +; +mso-level-number-position +: +left +; +margin-left +: +32.15 +pt +; +text-indent +: +- +18.0 +pt +; +font-family +: +Symbol +; +} +@list +l8 +{ +mso-list-id +: +- +120 +; +mso-list-type +: +simple +; +mso-list-template-ids +: +- +799663524 +; +} +@list +l8 +: +level1 +{ +mso-level-tab-stop +: +18.0 +pt +; +mso-level-number-position +: +left +; +margin-left +: +18.0 +pt +; +text-indent +: +- +18.0 +pt +; +} +@list +l9 +{ +mso-list-id +: +- +119 +; +mso-list-type +: +simple +; +mso-list-template-ids +: +- +1707604292 +; +} +@list +l9 +: +level1 +{ +mso-level-number-format +: +bullet +; +mso-level-text +: +\F0B7 +; +mso-level-tab-stop +: +18.0 +pt +; +mso-level-number-position +: +left +; +margin-left +: +18.0 +pt +; +text-indent +: +- +18.0 +pt +; +font-family +: +Symbol +; +} +ol { + margin-bottom: 0cm; +} + +ul { + margin-bottom: 0cm; +} + --> </style> <!--[if gte mso 10]> @@ -228,38 +644,45 @@ <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>The source shows how simple it is to inject <span -class=GramE>Spring</span> managed fine grained POJO beans into EJB components.</p> + class=GramE>Spring</span> managed fine grained POJO beans into EJB components.</p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>First make sure that you have <span class=GramE>Spring</span> -deployer in your JBOSS_HOME/server/default/deploy directory. That should be -jboss-spring-jdk5.deployer directory with three jars and META-INF directory -inside (jboss-spring-jdk5.jar, spring-beans.jar, spring-core.jar and -META-INF/jboss-service.xml).</p> + deployer in your JBOSS_HOME/server/default/deploy directory. That should be + jboss-spring-jdk5.deployer directory with three jars and META-INF directory + inside (jboss-spring-jdk5.jar, spring-beans.jar, spring-core.jar and + META-INF/jboss-service.xml).</p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>Since our code is dependant on <span class=GramE>Spring</span> -library, we must make sure that all of the needed classes are in our classpath. -Copy spring-aop.jar, spring-context.jar, spring-web.jar and spring-webmvc.jar -into JBOSS_HOME/server/default/lib directory.</p> + library, we must make sure that all of the needed classes are in our classpath. + Copy spring-aop.jar, spring-context.jar, spring-web.jar and spring-webmvc.jar + into JBOSS_HOME/server/default/lib directory.</p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>Fix ejb3-interceptors-aop.xml in your JBOSS_HOME/server/default/deploy -directory:</p> + directory:</p> <p class=MsoNormal><o:p> </o:p></p> -<pre><span style='mso-spacerun:yes'> </span><interceptor class="org.jboss.ejb3.AllowedOperationsInterceptor" scope="PER_VM"/></pre><pre><o:p> </o:p></pre><pre><b -style='mso-bidi-font-weight:normal'><span style='mso-spacerun:yes'> </span><interceptor class="org.jboss.spring.interceptor.SpringInjectionInterceptor" scope="PER_VM"/><o:p></o:p></b></pre><pre><o:p> </o:p></pre><pre><span style='mso-spacerun:yes'> </span><typedef name="ejb3intercepted" expr="<span -class=GramE>class(</span>@javax.ejb.Interceptors) OR class(@javax.ejb.Interceptor) OR has(* *->@javax.ejb.AroundInvoke(..))"/></pre><pre><o:p> </o:p></pre><pre><span style='mso-spacerun:yes'> </span><domain name="Stateless Bean"></pre><pre><b -style='mso-bidi-font-weight:normal'><span style='mso-spacerun:yes'> </span><bind pointcut="<span -class=GramE>execution(</span>*->new(..))"><o:p></o:p></b></pre><pre><b -style='mso-bidi-font-weight:normal'><span style='mso-spacerun:yes'> </span><<span -class=GramE>interceptor-ref</span> name="org.jboss.spring.interceptor.SpringInjectionInterceptor"/><o:p></o:p></b></pre><pre><b -style='mso-bidi-font-weight:normal'><span style='mso-spacerun:yes'> </span></bind><o:p></o:p></b></pre> +<pre><span style='mso-spacerun:yes'>�� </span><interceptor class="org.jboss.ejb3.AllowedOperationsInterceptor" + scope="PER_VM"/></pre><pre><o:p> </o:p></pre><pre><b + style='mso-bidi-font-weight:normal'><span style='mso-spacerun:yes'>�� </span><interceptor class="org.jboss.spring.interceptor.SpringInjectionInterceptor" + scope="PER_VM"/><o:p></o:p></b></pre><pre><o:p> </o:p></pre><pre><span + style='mso-spacerun:yes'>�� </span><typedef name="ejb3intercepted" expr="<span + class=GramE>class(</span>@javax.ejb.Interceptors) OR class(@javax.ejb.Interceptor) OR has(* *->@javax.ejb.AroundInvoke(..))"/> +</pre><pre><o:p> </o:p></pre><pre><span style='mso-spacerun:yes'>�� </span><domain name="Stateless Bean"> +</pre><pre><b + style='mso-bidi-font-weight:normal'><span style='mso-spacerun:yes'>����� </span><bind pointcut="<span + class=GramE>execution(</span>*->new(..))"><o:p></o:p></b></pre><pre><b + style='mso-bidi-font-weight:normal'><span style='mso-spacerun:yes'>�������� </span><<span + class=GramE>interceptor-ref</span> name="org.jboss.spring.interceptor.SpringInjectionInterceptor"/> + <o:p></o:p></b></pre><pre><b + style='mso-bidi-font-weight:normal'><span style='mso-spacerun:yes'>����� </span></bind><o:p></o:p></b> +</pre> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><o:p> </o:p></b></p> @@ -268,78 +691,81 @@ <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>Looking at the source code you will see that our -RandomizerBean class is declared as @Stateless session bean. The pointcut above -will pick up our stateless session bean at instantiation time and perform <span -class=GramE>Spring</span> injection interception.</p> + RandomizerBean class is declared as @Stateless session bean. The pointcut above + will pick up our stateless session bean at instantiation time and perform <span + class=GramE>Spring</span> injection interception.</p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>The second example from source code shows how we can do <span -class=GramE>Spring</span> bean injection in a <b style='mso-bidi-font-weight: + class=GramE>Spring</span> bean injection in a <b style='mso-bidi-font-weight: normal'>non</b> AOP way. Look at the HoroscopeBean class which has a @CallbackListener -annotation with the value SpringCallbackListener.class. Read the EJB3Trail -applications documentation (<a -href="http://trailblazer.demo.jboss.com/EJB3Trail/serviceobjects/lifecycle/index.html">http://trailblazer.demo.jboss.com/EJB3Trail/serviceobjects/lifecycle/index.html</a>) -on how callback listeners are used.</p> + annotation with the value SpringCallbackListener.class. Read the EJB3Trail + application�s documentation (<a + href="http://trailblazer.demo.jboss.com/EJB3Trail/serviceobjects/lifecycle/index.html">http://trailblazer.demo.jboss.com/EJB3Trail/serviceobjects/lifecycle/index.html</a>) + on how callback listeners are used.</p> <p class=MsoNormal><o:p> </o:p></p> -<p class=MsoNormal>Now you are all set to go. Unzip examples archive into -APP_HOME. Run Ants build script (APP_HOME/build.bat in Windows or -APP_HOME/build.sh in Linux/Unix). Run default JBoss server (JBOSS_HOME/bin run). -Drop JBoss-Spring.ear from APP_HOME/build/jar into JBOSS_HOME/server/default/deploy. -The <span class=GramE>Spring</span> injection should take place the moment you -will click on the applications web page (<a -href="http://localhost:8080/jboss-spring">http://localhost:8080/jboss-spring</a>).</p> +<p class=MsoNormal>Now you are all set to go. Unzip example�s archive into + APP_HOME. Run Ant�s build script (APP_HOME/build.bat in Windows or + APP_HOME/build.sh in Linux/Unix). Run default JBoss server (JBOSS_HOME/bin run). + Drop JBoss-Spring.ear from APP_HOME/build/jar into JBOSS_HOME/server/default/deploy. + The <span class=GramE>Spring</span> injection should take place the moment you + will click on the application�s web page (<a + href="http://localhost:8080/jboss-spring">http://localhost:8080/jboss-spring</a>).</p> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>Our <span class=GramE>Spring</span> deployer watches for the -Spring components which should have the following suffixes: .spring for archive -or spring.xml for the beans descriptor. Spring beans descriptor inside archive -is expected to be in META-INF directory by the name jboss-spring.xml.</p> + Spring components which should have the following suffixes: .spring for archive + or �spring.xml for the beans descriptor. Spring beans descriptor inside archive + is expected to be in META-INF directory by the name jboss-spring.xml.</p> <p class=MsoNormal><o:p> </o:p></p> -<p class=MsoNormal>By default our bean factorys JNDI name equals <span -class=GramE>Spring</span> components name: <name>.spring or -<name>-spring.xml. It can be overridden inside beans descriptor -description tag. You can also set parent bean factory JNDI name:</p> +<p class=MsoNormal>By default our bean factory�s JNDI name equals <span + class=GramE>Spring</span> components name: <name>.spring or + <name>-spring.xml. It can be overridden inside beans descriptor + description tag. You can also set parent bean factory JNDI name:</p> <p class=MsoNormal><o:p> </o:p></p> -<pre><<span class=GramE>beans</span>></pre><pre><o:p> </o:p></pre><pre><span style='mso-spacerun:yes'> </span><<span -class=GramE>description></span>BeanFactory=(<name>) ParentBeanFactory=(<parent name>)</description></pre><pre><o:p> </o:p></pre> +<pre><<span class=GramE>beans</span>></pre><pre><o:p> </o:p></pre><pre><span + style='mso-spacerun:yes'>��� </span><<span + class=GramE>description></span>BeanFactory=(<name>) ParentBeanFactory=(<parent name>)</description> +</pre><pre><o:p> </o:p></pre> <p class=MsoNormal>There are different ways to deploy your <span class=GramE>Spring</span> -beans. One with .ear file we just saw. But you can also deploy only your <span -class=GramE>Spring</span> beans and let them be used by different applications. -Instead of droping the whole .ear, you can just deploy .spring archive file or -only beans descriptor. In descriptors case, its name must end with spring.xml -and, as expected, all the classes must already be made available on the -classpath to the descriptor.</p> + beans. One with .ear file we just saw. But you can also deploy only your <span + class=GramE>Spring</span> beans and let them be used by different applications. + Instead of droping the whole .ear, you can just deploy .spring archive file or + only beans descriptor. In descriptor�s case, its name must end with �spring.xml + and, as expected, all the classes must already be made available on the + classpath to the descriptor.</p> <p class=MsoNormal><o:p> </o:p></p> -<p class=MsoNormal>Lets look this on the example. Just drop spring-pojo.spring -file from APP_HOME/build/jar into JBOSS_HOME/server/default/<span class=GramE>deploy -.</span> As before, bean factory with JNDI name spring-pojo gets deployed. -You can now include this bean factory by setting its name as the parent bean -factory name in your new beans factory xml descriptor:</p> +<p class=MsoNormal>Let�s look this on the example. Just drop spring-pojo.spring + file from APP_HOME/build/jar into JBOSS_HOME/server/default/<span class=GramE>deploy +.</span> As before, bean factory with JNDI name �spring-pojo� gets deployed. + You can now include this bean factory by setting its name as the parent bean + factory name in your new beans factory xml descriptor:</p> <p class=MsoNormal><o:p> </o:p></p> -<pre><<span class=GramE>beans</span>></pre><pre><o:p> </o:p></pre><pre> <span style='mso-spacerun:yes'> </span><<span -class=GramE>description></span>ParentBeanFactory=(spring-pojo)</description></pre> +<pre><<span class=GramE>beans</span>></pre><pre><o:p> </o:p></pre><pre><span + style='mso-spacerun:yes'>���</span><<span + class=GramE>description></span>ParentBeanFactory=(spring-pojo)</description></pre> <p class=MsoNormal><o:p> </o:p></p> <p class=MsoNormal>When undeploying single files, be careful of the order of -undeploying take notice of bean factory hierarchy.</p> + undeploying � take notice of bean factory hierarchy.</p> <p class=MsoNormal>When shutting down application server, the <span -class=GramE>Spring</span> deployer will take care of correct undeployment -order.</p> + class=GramE>Spring</span> deployer will take care of correct undeployment + order.</p> </div> |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:55
|
User: alesj Date: 06/07/09 09:18:48 Modified: src/main/org/jboss/spring/factory AbstractBeanFactoryLoader.java ApplicationContextLoaderImpl.java BeanFactoryLoader.java BeanFactoryLoaderImpl.java Instantiable.java Nameable.java NamedXmlApplicationContext.java NamedXmlBeanDefinitionParser.java NamedXmlBeanDefinitionReader.java NamedXmlBeanFactory.java Log: Reformat code + Spring-MC fix. Revision Changes Path 1.3 +61 -31 jboss-spring/src/main/org/jboss/spring/factory/AbstractBeanFactoryLoader.java (In the diff below, changes in quantity of whitespace are not shown.) Index: AbstractBeanFactoryLoader.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/factory/AbstractBeanFactoryLoader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- AbstractBeanFactoryLoader.java 4 Nov 2005 19:47:34 -0000 1.2 +++ AbstractBeanFactoryLoader.java 9 Jul 2006 13:18:48 -0000 1.3 @@ -43,50 +43,60 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public abstract class AbstractBeanFactoryLoader implements BeanFactoryLoader { +public abstract class AbstractBeanFactoryLoader implements BeanFactoryLoader +{ private final Logger log = Logger.getLogger(getClass()); protected Map beanFactoryNamesMap = new TreeMap(); - private URL getDocUrl(DeploymentInfo di) throws DeploymentException { + private URL getDocUrl(DeploymentInfo di) throws DeploymentException + { URL docURL = di.localUrl; - if (!di.isXML) { + if (!di.isXML) + { URLClassLoader localCL = di.localCl; docURL = localCL.findResource("META-INF/jboss-spring.xml"); } // Validate that the descriptor was found - if (docURL == null) { + if (docURL == null) + { throw new DeploymentException("Failed to find META-INF/jboss-spring.xml"); } return docURL; } - private String getDefaultName(DeploymentInfo di) { + private String getDefaultName(DeploymentInfo di) + { String shortName = di.shortName; int p = shortName.indexOf(".spring"); - if (p > 0) { + if (p > 0) + { return shortName.substring(0, p); } p = shortName.indexOf("-spring.xml"); - if (p > 0) { + if (p > 0) + { return shortName.substring(0, p); } return null; } - public void create(DeploymentInfo di) throws DeploymentException { + public void create(DeploymentInfo di) throws DeploymentException + { URL docURL = getDocUrl(di); String defaultName = getDefaultName(di); BeanFactory beanFactory = null; ClassLoader cl = Thread.currentThread().getContextClassLoader(); - try { + try + { Thread.currentThread().setContextClassLoader(di.ucl); beanFactory = createBeanFactory(defaultName, new UrlResource(docURL)); - } finally { + } finally + { Thread.currentThread().setContextClassLoader(cl); } - String name = ((Nameable)beanFactory).getName(); + String name = ((Nameable) beanFactory).getName(); bind(beanFactory, name); log.info("Bean factory [" + name + "] binded to local JNDI."); beanFactoryNamesMap.put(docURL.toString(), name); @@ -94,65 +104,85 @@ protected abstract BeanFactory createBeanFactory(String defaultName, Resource resource); - public void start(DeploymentInfo di) throws DeploymentException { + public void start(DeploymentInfo di) throws DeploymentException + { } - public void stop(DeploymentInfo di) throws DeploymentException { - try { + public void stop(DeploymentInfo di) throws DeploymentException + { + try + { URL docURL = getDocUrl(di); String name = (String) beanFactoryNamesMap.remove(docURL.toString()); BeanFactory beanFactory = lookup(name); doClose(beanFactory); unbind(name); log.info("Bean factory [" + name + "] unbinded from local JNDI."); - } catch (Exception e) { + } catch (Exception e) + { throw new DeploymentException(e); } } protected abstract void doClose(BeanFactory beanFactory); - public void destroy(DeploymentInfo di) throws DeploymentException { + public void destroy(DeploymentInfo di) throws DeploymentException + { } // JNDI stuff - public static void bind(BeanFactory beanFactory, String name) throws BeansException { + public static void bind(BeanFactory beanFactory, String name) throws BeansException + { InitialContext ctx = null; - try { + try + { ctx = new InitialContext(); NonSerializableFactory.rebind(ctx, name, beanFactory); - } catch (NamingException e) { + } catch (NamingException e) + { throw new FatalBeanException("Unable to bind BeanFactory into JNDI", e); - } finally { - if (ctx != null) { - try { + } finally + { + if (ctx != null) + { + try + { ctx.close(); - } catch (Throwable ignored) { + } catch (Throwable ignored) + { } } } } - public static void unbind(String name) throws BeansException { + public static void unbind(String name) throws BeansException + { InitialContext ctx = null; - try { + try + { ctx = new InitialContext(); ctx.unbind(name); NonSerializableFactory.unbind(name); - } catch (NamingException e) { + } catch (NamingException e) + { throw new FatalBeanException("Unable to unbind BeanFactory from JNDI", e); - } finally { - if (ctx != null) { - try { + } finally + { + if (ctx != null) + { + try + { ctx.close(); - } catch (Throwable ignored) { + } catch (Throwable ignored) + { } } } } - public BeanFactory lookup(String name) throws Exception { + public BeanFactory lookup(String name) throws Exception + { BeanFactory beanFactory = (BeanFactory) Util.lookup(name, getExactBeanFactoryClass()); log.debug("Found Spring bean factory [" + name + "]: " + beanFactory); return beanFactory; 1.3 +9 -5 jboss-spring/src/main/org/jboss/spring/factory/ApplicationContextLoaderImpl.java (In the diff below, changes in quantity of whitespace are not shown.) Index: ApplicationContextLoaderImpl.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/factory/ApplicationContextLoaderImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- ApplicationContextLoaderImpl.java 4 Nov 2005 19:47:34 -0000 1.2 +++ ApplicationContextLoaderImpl.java 9 Jul 2006 13:18:48 -0000 1.3 @@ -30,17 +30,21 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public class ApplicationContextLoaderImpl extends AbstractBeanFactoryLoader { +public class ApplicationContextLoaderImpl extends AbstractBeanFactoryLoader +{ - protected BeanFactory createBeanFactory(String defaultName, Resource resource) { + protected BeanFactory createBeanFactory(String defaultName, Resource resource) + { return new NamedXmlApplicationContext(defaultName, resource); } - protected void doClose(BeanFactory beanFactory) { - ((ConfigurableApplicationContext)beanFactory).close(); + protected void doClose(BeanFactory beanFactory) + { + ((ConfigurableApplicationContext) beanFactory).close(); } - protected Class getExactBeanFactoryClass() { + protected Class getExactBeanFactoryClass() + { return ApplicationContext.class; } 1.3 +3 -2 jboss-spring/src/main/org/jboss/spring/factory/BeanFactoryLoader.java (In the diff below, changes in quantity of whitespace are not shown.) Index: BeanFactoryLoader.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/factory/BeanFactoryLoader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- BeanFactoryLoader.java 29 Oct 2005 23:58:11 -0000 1.2 +++ BeanFactoryLoader.java 9 Jul 2006 13:18:48 -0000 1.3 @@ -22,13 +22,14 @@ package org.jboss.spring.factory; -import org.jboss.deployment.DeploymentInfo; import org.jboss.deployment.DeploymentException; +import org.jboss.deployment.DeploymentInfo; /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public interface BeanFactoryLoader { +public interface BeanFactoryLoader +{ void create(DeploymentInfo di) throws DeploymentException; 1.5 +9 -5 jboss-spring/src/main/org/jboss/spring/factory/BeanFactoryLoaderImpl.java (In the diff below, changes in quantity of whitespace are not shown.) Index: BeanFactoryLoaderImpl.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/factory/BeanFactoryLoaderImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- BeanFactoryLoaderImpl.java 4 Nov 2005 15:41:45 -0000 1.4 +++ BeanFactoryLoaderImpl.java 9 Jul 2006 13:18:48 -0000 1.5 @@ -29,17 +29,21 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public class BeanFactoryLoaderImpl extends AbstractBeanFactoryLoader { +public class BeanFactoryLoaderImpl extends AbstractBeanFactoryLoader +{ - protected BeanFactory createBeanFactory(String defaultName, Resource resource) { + protected BeanFactory createBeanFactory(String defaultName, Resource resource) + { return new NamedXmlBeanFactory(defaultName, resource); } - protected void doClose(BeanFactory beanFactory) { - ((ConfigurableBeanFactory)beanFactory).destroySingletons(); + protected void doClose(BeanFactory beanFactory) + { + ((ConfigurableBeanFactory) beanFactory).destroySingletons(); } - protected Class getExactBeanFactoryClass() { + protected Class getExactBeanFactoryClass() + { return BeanFactory.class; } 1.3 +2 -1 jboss-spring/src/main/org/jboss/spring/factory/Instantiable.java (In the diff below, changes in quantity of whitespace are not shown.) Index: Instantiable.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/factory/Instantiable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- Instantiable.java 29 Oct 2005 23:58:11 -0000 1.2 +++ Instantiable.java 9 Jul 2006 13:18:48 -0000 1.3 @@ -25,7 +25,8 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public interface Instantiable { +public interface Instantiable +{ boolean doInstantiate(); 1.3 +2 -1 jboss-spring/src/main/org/jboss/spring/factory/Nameable.java (In the diff below, changes in quantity of whitespace are not shown.) Index: Nameable.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/factory/Nameable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- Nameable.java 29 Oct 2005 23:58:11 -0000 1.2 +++ Nameable.java 9 Jul 2006 13:18:48 -0000 1.3 @@ -25,7 +25,8 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public interface Nameable { +public interface Nameable +{ String getName(); 1.4 +16 -8 jboss-spring/src/main/org/jboss/spring/factory/NamedXmlApplicationContext.java (In the diff below, changes in quantity of whitespace are not shown.) Index: NamedXmlApplicationContext.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/factory/NamedXmlApplicationContext.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- NamedXmlApplicationContext.java 18 Apr 2006 12:14:37 -0000 1.3 +++ NamedXmlApplicationContext.java 9 Jul 2006 13:18:48 -0000 1.4 @@ -35,7 +35,8 @@ * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ public class NamedXmlApplicationContext extends ClassPathXmlApplicationContext - implements Nameable { + implements Nameable +{ private String defaultName; private Resource resource; @@ -44,11 +45,13 @@ /** * @see org.springframework.beans.factory.xml.XmlBeanFactory */ - public NamedXmlApplicationContext(String defaultName, Resource resource) throws BeansException { + public NamedXmlApplicationContext(String defaultName, Resource resource) throws BeansException + { this(defaultName, resource, true); } - public NamedXmlApplicationContext(String defaultName, Resource resource, boolean refresh) throws BeansException { + public NamedXmlApplicationContext(String defaultName, Resource resource, boolean refresh) throws BeansException + { //loading config from Resource super(new String[]{}, false); this.defaultName = defaultName; @@ -59,14 +62,16 @@ } } - protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException { + protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException + { // Create a new XmlBeanDefinitionReader for the given BeanFactory. beanDefinitionReader = new NamedXmlBeanDefinitionReader(beanFactory); // Configure the bean definition reader with this context's // resource loading environment. beanDefinitionReader.setResourceLoader(this); - if (getClassLoader() != null) { + if (getClassLoader() != null) + { beanDefinitionReader.setBeanClassLoader(getClassLoader()); } beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this)); @@ -77,13 +82,16 @@ loadBeanDefinitions(beanDefinitionReader); } - protected void loadBeanDefinitions(XmlBeanDefinitionReader reader) throws BeansException, IOException { + protected void loadBeanDefinitions(XmlBeanDefinitionReader reader) throws BeansException, IOException + { reader.loadBeanDefinitions(resource); } - public String getName() { + public String getName() + { String name = beanDefinitionReader.getName() != null ? beanDefinitionReader.getName() : defaultName; - if (name == null) { + if (name == null) + { throw new IllegalArgumentException("Bean factory JNDI name must be set!"); } return name; 1.8 +29 -15 jboss-spring/src/main/org/jboss/spring/factory/NamedXmlBeanDefinitionParser.java (In the diff below, changes in quantity of whitespace are not shown.) Index: NamedXmlBeanDefinitionParser.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/factory/NamedXmlBeanDefinitionParser.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -b -r1.7 -r1.8 --- NamedXmlBeanDefinitionParser.java 19 Apr 2006 09:08:31 -0000 1.7 +++ NamedXmlBeanDefinitionParser.java 9 Jul 2006 13:18:48 -0000 1.8 @@ -39,7 +39,8 @@ * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ public class NamedXmlBeanDefinitionParser extends DefaultXmlBeanDefinitionParser - implements Nameable, Instantiable { + implements Nameable, Instantiable +{ private static final Logger log = Logger.getLogger(NamedXmlBeanDefinitionParser.class); private static final String DESCRIPTION_ELEMENT = "description"; @@ -51,34 +52,44 @@ private String beanFactoryName; private boolean instantiate; - public NamedXmlBeanDefinitionParser(ConfigurableBeanFactory beanFactory) { + public NamedXmlBeanDefinitionParser(ConfigurableBeanFactory beanFactory) + { this.beanFactory = beanFactory; } - protected void preProcessXml(Element root) throws BeanDefinitionStoreException { + protected void preProcessXml(Element root) throws BeanDefinitionStoreException + { NodeList nl = root.getChildNodes(); - for (int i = 0; i < nl.getLength(); i++) { + for (int i = 0; i < nl.getLength(); i++) + { Node node = nl.item(i); - if (node instanceof Element) { + if (node instanceof Element) + { Element ele = (Element) node; - if (DESCRIPTION_ELEMENT.equals(node.getNodeName())) { + if (DESCRIPTION_ELEMENT.equals(node.getNodeName())) + { String nodeValue = ele.getFirstChild().getNodeValue(); log.info("Bean names [description tag]: " + nodeValue); Matcher bfm = parse(nodeValue, BEAN_FACTORY_ELEMENT); - if (bfm.find()) { + if (bfm.find()) + { beanFactoryName = bfm.group(1); } Matcher pbfm = parse(nodeValue, PARENT_BEAN_FACTORY_ELEMENT); - if (pbfm.find()) { + if (pbfm.find()) + { String parentBeanFactoryName = pbfm.group(1); - try { - beanFactory.setParentBeanFactory((BeanFactory)Util.lookup(parentBeanFactoryName, BeanFactory.class)); - } catch (Exception e) { + try + { + beanFactory.setParentBeanFactory((BeanFactory) Util.lookup(parentBeanFactoryName, BeanFactory.class)); + } catch (Exception e) + { throw new BeanDefinitionStoreException("Failure during parent bean factory JNDI lookup: " + parentBeanFactoryName, e); } } Matcher inst = parse(nodeValue, INSTANTIATION_ELEMENT); - if (inst.find()) { + if (inst.find()) + { instantiate = Boolean.parseBoolean(inst.group(1)); } } @@ -86,15 +97,18 @@ } } - public String getName() { + public String getName() + { return beanFactoryName; } - public boolean doInstantiate() { + public boolean doInstantiate() + { return instantiate; } - private static Matcher parse(String value, String regexp) { + private static Matcher parse(String value, String regexp) + { Pattern pattern = Pattern.compile(regexp); return pattern.matcher(value); } 1.6 +15 -9 jboss-spring/src/main/org/jboss/spring/factory/NamedXmlBeanDefinitionReader.java (In the diff below, changes in quantity of whitespace are not shown.) Index: NamedXmlBeanDefinitionReader.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/factory/NamedXmlBeanDefinitionReader.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- NamedXmlBeanDefinitionReader.java 19 Apr 2006 09:09:14 -0000 1.5 +++ NamedXmlBeanDefinitionReader.java 9 Jul 2006 13:18:48 -0000 1.6 @@ -22,10 +22,10 @@ package org.jboss.spring.factory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.beans.factory.support.BeanDefinitionRegistry; -import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.Resource; import org.w3c.dom.Document; @@ -33,29 +33,35 @@ * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ public class NamedXmlBeanDefinitionReader extends XmlBeanDefinitionReader - implements Nameable, Instantiable { + implements Nameable, Instantiable +{ private NamedXmlBeanDefinitionParser parser; - public NamedXmlBeanDefinitionReader(BeanDefinitionRegistry beanFactory) { + public NamedXmlBeanDefinitionReader(BeanDefinitionRegistry beanFactory) + { super(beanFactory); - if (!(beanFactory instanceof ConfigurableBeanFactory)) { + if (!(beanFactory instanceof ConfigurableBeanFactory)) + { throw new IllegalArgumentException("BeanFactory must implement ConfigurableBeanFactory!"); } parser = new NamedXmlBeanDefinitionParser((ConfigurableBeanFactory) beanFactory); } - public int registerBeanDefinitions(Document doc, Resource resource) throws BeansException { + public int registerBeanDefinitions(Document doc, Resource resource) throws BeansException + { int countBefore = this.getBeanFactory().getBeanDefinitionCount(); parser.registerBeanDefinitions(doc, createReaderContext(resource)); return this.getBeanFactory().getBeanDefinitionCount() - countBefore; } - public String getName() { + public String getName() + { return parser.getName(); } - public boolean doInstantiate() { + public boolean doInstantiate() + { return parser.doInstantiate(); } 1.5 +10 -5 jboss-spring/src/main/org/jboss/spring/factory/NamedXmlBeanFactory.java (In the diff below, changes in quantity of whitespace are not shown.) Index: NamedXmlBeanFactory.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/factory/NamedXmlBeanFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- NamedXmlBeanFactory.java 29 Oct 2005 23:58:11 -0000 1.4 +++ NamedXmlBeanFactory.java 9 Jul 2006 13:18:48 -0000 1.5 @@ -30,7 +30,8 @@ * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ public class NamedXmlBeanFactory extends DefaultListableBeanFactory - implements Nameable, Instantiable { + implements Nameable, Instantiable +{ private String defaultName; private final NamedXmlBeanDefinitionReader reader = new NamedXmlBeanDefinitionReader(this); @@ -38,20 +39,24 @@ /** * @see org.springframework.beans.factory.xml.XmlBeanFactory */ - public NamedXmlBeanFactory(String defaultName, Resource resource) throws BeansException { + public NamedXmlBeanFactory(String defaultName, Resource resource) throws BeansException + { this.reader.loadBeanDefinitions(resource); this.defaultName = defaultName; } - public String getName() { + public String getName() + { String name = reader.getName() != null ? reader.getName() : defaultName; - if (name == null) { + if (name == null) + { throw new IllegalArgumentException("Bean factory JNDI name must be set!"); } return name; } - public boolean doInstantiate() { + public boolean doInstantiate() + { return reader.doInstantiate(); } |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:55
|
User: alesj Date: 06/07/09 09:18:49 Modified: src/main/org/jboss/spring/support SpringInjectionSupport.java Log: Reformat code + Spring-MC fix. Revision Changes Path 1.6 +68 -37 jboss-spring/src/main/org/jboss/spring/support/SpringInjectionSupport.java (In the diff below, changes in quantity of whitespace are not shown.) Index: SpringInjectionSupport.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/support/SpringInjectionSupport.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- SpringInjectionSupport.java 4 Nov 2005 15:41:45 -0000 1.5 +++ SpringInjectionSupport.java 9 Jul 2006 13:18:49 -0000 1.6 @@ -37,36 +37,44 @@ * Injects objects from bean factory located in JNDI at jndiName gained * from @Spring annotation's field jndiName. * It is applied to setter methods and fields annotated with @Spring annotation. - * @see MethodComparator Excludes overridden @Spring annotated methods - * Class type check is performed before actual setting. * * @author <a href="mailto:ale...@ge...">Ales Justin</a> + * @see MethodComparator Excludes overridden @Spring annotated methods + * Class type check is performed before actual setting. */ -public abstract class SpringInjectionSupport { +public abstract class SpringInjectionSupport +{ protected Logger log = Logger.getLogger(getClass()); private final Comparator<Method> METHOD_COMPARATOR = new MethodComparator(); - protected Object inject(Object target) throws Exception { + protected Object inject(Object target) throws Exception + { log.debug("Invoking Spring injection: " + target.getClass().getName()); Method[] methods = getAllMethods(target); - for (Method m : methods) { + for (Method m : methods) + { Spring spring = m.getAnnotation(Spring.class); - if (spring != null) { - if (isSetterMethod(m)) { + if (spring != null) + { + if (isSetterMethod(m)) + { injectToMethod(target, m, spring); - } else { + } else + { log.warn("Spring annotation only allowed on setter methods."); } } } Field[] fields = getAllFields(target); - for (Field f : fields) { + for (Field f : fields) + { Spring spring = f.getAnnotation(Spring.class); - if (spring != null) { + if (spring != null) + { injectToField(target, f, spring); } } @@ -74,36 +82,43 @@ return target; } - protected Method[] getAllMethods(Object bean) { + protected Method[] getAllMethods(Object bean) + { Class beanClass = bean.getClass(); Set<Method> methods = new TreeSet<Method>(METHOD_COMPARATOR); - while(beanClass != Object.class) { + while (beanClass != Object.class) + { methods.addAll(Arrays.asList(beanClass.getDeclaredMethods())); beanClass = beanClass.getSuperclass(); } return methods.toArray(new Method[methods.size()]); } - protected Field[] getAllFields(Object bean) { + protected Field[] getAllFields(Object bean) + { Class beanClass = bean.getClass(); List<Field> fields = new ArrayList<Field>(); - while(beanClass != Object.class) { + while (beanClass != Object.class) + { fields.addAll(Arrays.asList(beanClass.getDeclaredFields())); beanClass = beanClass.getSuperclass(); } return fields.toArray(new Field[fields.size()]); } - private boolean isSetterMethod(Method m) { + private boolean isSetterMethod(Method m) + { return m.getName().startsWith("set") && m.getParameterTypes().length == 1; } - private Object getObjectFromBeanFactory(Spring spring) throws Exception { - BeanFactory beanFactory = (BeanFactory)Util.lookup(spring.jndiName(), BeanFactory.class); + private Object getObjectFromBeanFactory(Spring spring) throws Exception + { + BeanFactory beanFactory = (BeanFactory) Util.lookup(spring.jndiName(), BeanFactory.class); return beanFactory.getBean(spring.bean()); } - private void injectToMethod(Object target, Method method, Spring spring) throws Exception { + private void injectToMethod(Object target, Method method, Spring spring) throws Exception + { Object bean = getObjectFromBeanFactory(spring); doAssert(bean, method.getParameterTypes()[0]); logInjection(spring, bean, target, method); @@ -111,7 +126,8 @@ method.invoke(target, bean); } - private void injectToField(Object target, Field field, Spring spring) throws Exception { + private void injectToField(Object target, Field field, Spring spring) throws Exception + { Object bean = getObjectFromBeanFactory(spring); doAssert(bean, field.getType()); logInjection(spring, bean, target, field); @@ -119,13 +135,15 @@ field.set(target, bean); } - private void doAssert(Object bean, Class expectedBeanClass) { + private void doAssert(Object bean, Class expectedBeanClass) + { Assert.isTrue(expectedBeanClass.isAssignableFrom(bean.getClass()), "Illegal bean class type - " + bean.getClass().getName() + " - cannot be assigned to: " + expectedBeanClass.getName()); } - private void logInjection(Spring spring, Object bean, Object target, Member m) { + private void logInjection(Spring spring, Object bean, Object target, Member m) + { log.debug("Injecting bean '" + spring.bean() + "' of class type " + bean.getClass().getName() + " into " + target + " via " + m); } @@ -134,43 +152,56 @@ * Equals on overridden methods. * Any other solution? */ - private class MethodComparator implements Comparator<Method> { + private class MethodComparator implements Comparator<Method> + { - public int compare(Method m1, Method m2) { + public int compare(Method m1, Method m2) + { String name1 = m1.getName(); String name2 = m2.getName(); - if (name1.equals(name2)) { + if (name1.equals(name2)) + { Class returnType1 = m1.getReturnType(); Class returnType2 = m2.getReturnType(); Class[] params1 = m1.getParameterTypes(); Class[] params2 = m1.getParameterTypes(); - if (params1.length == params2.length) { - if (returnType1.equals(returnType2)) { + if (params1.length == params2.length) + { + if (returnType1.equals(returnType2)) + { int i; int length = params1.length; - for (i = 0; i < length; i++) { - if (!params1[i].equals(params2[i])) { + for (i = 0; i < length; i++) + { + if (!params1[i].equals(params2[i])) + { break; } } //not equal - if (i < length) { + if (i < length) + { return params1[i].getName().compareTo(params2[i].getName()); - } else { + } else + { //overridden method - if (m1.getAnnotation(Spring.class) != null) { + if (m1.getAnnotation(Spring.class) != null) + { log.warn("Found overridden @Spring annotated method: " + m1); } return 0; } - } else { + } else + { return returnType1.getName().compareTo(returnType2.getName()); } - } else { + } else + { return params1.length - params2.length; } - } else { + } else + { return name1.compareTo(name2); } } |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:54
|
User: alesj Date: 06/07/09 09:18:49 Modified: src/resources/test/web index.jsp Log: Reformat code + Spring-MC fix. Revision Changes Path 1.2 +41 -37 jboss-spring/src/resources/test/web/index.jsp (In the diff below, changes in quantity of whitespace are not shown.) Index: index.jsp =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/resources/test/web/index.jsp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- index.jsp 23 Aug 2005 18:22:28 -0000 1.1 +++ index.jsp 9 Jul 2006 13:18:49 -0000 1.2 @@ -1,45 +1,49 @@ <html> <title>JBoss and Spring integration</title> + <body> <p/> - Number: - <form action="number.htm" method="POST"> - Radius: <input type="text" name="radius" value="" /> +Number: +<form action="number.htm" method="POST"> + Radius: <input type="text" name="radius" value=""/> <% - if (request.getAttribute("number") != null) { + if (request.getAttribute("number") != null) + { %> Random number: <%=request.getAttribute("number")%><p/> <% } %> - <input type="submit" value="Submit" /> - </form> + <input type="submit" value="Submit"/> +</form> <p/> - Word: - <form action="word.htm" method="POST"> +Word: +<form action="word.htm" method="POST"> <% - if (request.getAttribute("word") != null) { + if (request.getAttribute("word") != null) + { %> Random word: <%=request.getAttribute("word")%><p/> <% } %> - <input type="submit" value="Submit" /> - </form> + <input type="submit" value="Submit"/> +</form> <p/> - Horoscope: - <form action="horoscope.htm" method="POST"> - Month: <input type="text" name="month" value="" /> +Horoscope: +<form action="horoscope.htm" method="POST"> + Month: <input type="text" name="month" value=""/> <% - if (request.getAttribute("horoscope") != null) { + if (request.getAttribute("horoscope") != null) + { %> Random horoscope: <%=request.getAttribute("horoscope")%><p/> <% } %> - <input type="submit" value="Submit" /> - </form> - <p/> - <a href="horoscope.htm?clear=true">Clear horoscope</a> + <input type="submit" value="Submit"/> +</form> +<p/> +<a href="horoscope.htm?clear=true">Clear horoscope</a> </body> </html> \ No newline at end of file |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:54
|
User: alesj Date: 06/07/09 09:18:48 Modified: src/main/org/jboss/spring/interceptor SpringInjectionInterceptor.java Log: Reformat code + Spring-MC fix. Revision Changes Path 1.5 +12 -8 jboss-spring/src/main/org/jboss/spring/interceptor/SpringInjectionInterceptor.java (In the diff below, changes in quantity of whitespace are not shown.) Index: SpringInjectionInterceptor.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/interceptor/SpringInjectionInterceptor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- SpringInjectionInterceptor.java 29 Oct 2005 23:58:12 -0000 1.4 +++ SpringInjectionInterceptor.java 9 Jul 2006 13:18:48 -0000 1.5 @@ -32,24 +32,28 @@ * Should be the last interceptor in chain since it actually constructs EJB object * (in order to inject beans). * - * @see SpringInjectionSupport - * * @author <a href="mailto:ale...@ge...">Ales Justin</a> + * @see SpringInjectionSupport */ -public class SpringInjectionInterceptor extends SpringInjectionSupport implements Interceptor { +public class SpringInjectionInterceptor extends SpringInjectionSupport implements Interceptor +{ - public SpringInjectionInterceptor() { + public SpringInjectionInterceptor() + { log.info("Instantiating " + getName()); } - public String getName() { + public String getName() + { return "SpringInjectionInterceptor"; } - public Object invoke(Invocation invocation) throws Throwable { - if (!(invocation instanceof ConstructorInvocation)) { + public Object invoke(Invocation invocation) throws Throwable + { + if (!(invocation instanceof ConstructorInvocation)) + { throw new IllegalArgumentException("This interceptor is meant to be applied" + - " only on new instantiation of EJB objects"); + " only on new instantiation of @Spring annotated objects"); } Object target = invocation.invokeNext(); inject(target); |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:54
|
User: alesj Date: 06/07/09 09:18:49 Modified: src/resources/test/dd/spring jboss-spring.xml Log: Reformat code + Spring-MC fix. Revision Changes Path 1.2 +14 -6 jboss-spring/src/resources/test/dd/spring/jboss-spring.xml (In the diff below, changes in quantity of whitespace are not shown.) Index: jboss-spring.xml =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/resources/test/dd/spring/jboss-spring.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- jboss-spring.xml 23 Aug 2005 18:22:27 -0000 1.1 +++ jboss-spring.xml 9 Jul 2006 13:18:49 -0000 1.2 @@ -5,25 +5,31 @@ <!-- File line readers --> - <bean id="fileLineReader" class="org.jboss.tutorial.spring.FileLineReader" abstract="true" /> + <bean id="fileLineReader" class="org.jboss.tutorial.spring.FileLineReader" abstract="true"/> <bean id="randomFileLineReader" class="org.jboss.tutorial.spring.RandomFileWordsCreator" parent="fileLineReader" abstract="true"> - <property name="intCreator"><ref local="javaRandomIntCreator"/></property> + <property name="intCreator"> + <ref local="javaRandomIntCreator"/> + </property> </bean> <!-- Randomizer beans --> - <bean id="staticWordsCreator" class="org.jboss.tutorial.spring.StaticWordsCreator" /> + <bean id="staticWordsCreator" class="org.jboss.tutorial.spring.StaticWordsCreator"/> <bean id="fileWordsCreator" parent="fileLineReader"> - <property name="resource"><value>classpath:words.properties</value></property> + <property name="resource"> + <value>classpath:words.properties</value> + </property> </bean> <bean id="randomWordsCreator" parent="randomFileLineReader"> - <property name="resource"><value>classpath:words.properties</value></property> + <property name="resource"> + <value>classpath:words.properties</value> + </property> </bean> <bean id="stateIntCreator" class="org.jboss.tutorial.spring.DummyStateIntCreator"/> @@ -33,7 +39,9 @@ <!-- Horoscope --> <bean id="horoscopeSentenceCreator" parent="fileLineReader"> - <property name="resource"><value>classpath:horoscope.properties</value></property> + <property name="resource"> + <value>classpath:horoscope.properties</value> + </property> </bean> </beans> |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:54
|
User: alesj Date: 06/07/09 09:18:48 Modified: src/main/org/jboss/spring/callback SpringLifecycleInterceptor.java SpringPassivationInterceptor.java Log: Reformat code + Spring-MC fix. Revision Changes Path 1.7 +4 -2 jboss-spring/src/main/org/jboss/spring/callback/SpringLifecycleInterceptor.java (In the diff below, changes in quantity of whitespace are not shown.) Index: SpringLifecycleInterceptor.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/callback/SpringLifecycleInterceptor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -b -r1.6 -r1.7 --- SpringLifecycleInterceptor.java 5 Jun 2006 11:08:04 -0000 1.6 +++ SpringLifecycleInterceptor.java 9 Jul 2006 13:18:48 -0000 1.7 @@ -22,9 +22,10 @@ package org.jboss.spring.callback; +import org.jboss.spring.support.SpringInjectionSupport; + import javax.annotation.PostConstruct; import javax.interceptor.InvocationContext; -import org.jboss.spring.support.SpringInjectionSupport; /** * Injects Spring beans on postConstruction and postActivation. @@ -34,7 +35,8 @@ * @see SpringPassivationInterceptor * @see SpringInjectionSupport */ -public class SpringLifecycleInterceptor extends SpringPassivationInterceptor { +public class SpringLifecycleInterceptor extends SpringPassivationInterceptor +{ private static final long serialVersionUID = 365239483909594775L; 1.7 +11 -7 jboss-spring/src/main/org/jboss/spring/callback/SpringPassivationInterceptor.java (In the diff below, changes in quantity of whitespace are not shown.) Index: SpringPassivationInterceptor.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/main/org/jboss/spring/callback/SpringPassivationInterceptor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -b -r1.6 -r1.7 --- SpringPassivationInterceptor.java 5 Jun 2006 11:07:46 -0000 1.6 +++ SpringPassivationInterceptor.java 9 Jul 2006 13:18:48 -0000 1.7 @@ -22,14 +22,15 @@ package org.jboss.spring.callback; -import java.io.Serializable; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; +import org.jboss.spring.support.SpringInjectionSupport; + import javax.annotation.PreDestroy; import javax.ejb.PostActivate; import javax.ejb.PrePassivate; import javax.interceptor.InvocationContext; -import org.jboss.spring.support.SpringInjectionSupport; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; /** * Injects Spring beans only on postActivation. @@ -39,7 +40,8 @@ * @author <a href="mailto:ale...@ge...">Ales Justin</a> * @see org.jboss.spring.support.SpringInjectionSupport */ -public class SpringPassivationInterceptor extends SpringInjectionSupport implements Serializable { +public class SpringPassivationInterceptor extends SpringInjectionSupport implements Serializable +{ private static final long serialVersionUID = -7259379236645796135L; @@ -54,10 +56,12 @@ public void prePassivate(InvocationContext ctx) throws Exception { Field[] fields = getAllFields(ctx.getTarget()); - for (Field f : fields) { + for (Field f : fields) + { boolean isSerializable = Serializable.class.isAssignableFrom(f.getType()); boolean isTransient = Modifier.isTransient(f.getModifiers()); - if (!isSerializable && !isTransient) { + if (!isSerializable && !isTransient) + { f.setAccessible(true); f.set(ctx.getTarget(), null); } |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:54
|
User: alesj Date: 06/07/09 09:18:50 Modified: ibm/wsdl4j component-info.xml Log: Reformat code + Spring-MC fix. Revision Changes Path 1.4 +2 -2 thirdparty/ibm/wsdl4j/component-info.xml (In the diff below, changes in quantity of whitespace are not shown.) Index: component-info.xml =================================================================== RCS file: /cvsroot/jboss/thirdparty/ibm/wsdl4j/component-info.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- component-info.xml 30 Oct 2005 00:04:56 -0000 1.3 +++ component-info.xml 9 Jul 2006 13:18:50 -0000 1.4 @@ -5,10 +5,10 @@ <!-- ============================================================ --> <component id="ibm-wsdl4j" - version="1.5.1" + version="1.5.2jboss" licenseType="cpl-1.0" projectHome="http://sourceforge.net/projects/wsdl4j" - description="Web Services Description Language for Java Toolkit" + description="Web Services Description Language for Java Toolkit. Includes a JBoss patch to support EntityResolver injection" > <artifact id="wsdl4j.jar"/> <export> |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:52
|
User: alesj Date: 06/07/09 09:18:49 Modified: src/resources/test/web/WEB-INF applicationContext.xml jboss-spring-servlet.xml Log: Reformat code + Spring-MC fix. Revision Changes Path 1.2 +6 -2 jboss-spring/src/resources/test/web/WEB-INF/applicationContext.xml (In the diff below, changes in quantity of whitespace are not shown.) Index: applicationContext.xml =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/resources/test/web/WEB-INF/applicationContext.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- applicationContext.xml 23 Aug 2005 18:22:27 -0000 1.1 +++ applicationContext.xml 9 Jul 2006 13:18:49 -0000 1.2 @@ -10,8 +10,12 @@ </bean> <bean id="horoscope" class="org.springframework.jndi.JndiObjectFactoryBean"> - <property name="cache"><value>false</value></property> - <property name="proxyInterface"><value>org.jboss.tutorial.ee.service.Horoscope</value></property> + <property name="cache"> + <value>false</value> + </property> + <property name="proxyInterface"> + <value>org.jboss.tutorial.ee.service.Horoscope</value> + </property> <property name="jndiName"> <value>org.jboss.tutorial.ee.service.Horoscope</value> </property> 1.2 +14 -5 jboss-spring/src/resources/test/web/WEB-INF/jboss-spring-servlet.xml (In the diff below, changes in quantity of whitespace are not shown.) Index: jboss-spring-servlet.xml =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/resources/test/web/WEB-INF/jboss-spring-servlet.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- jboss-spring-servlet.xml 23 Aug 2005 18:22:27 -0000 1.1 +++ jboss-spring-servlet.xml 9 Jul 2006 13:18:49 -0000 1.2 @@ -7,7 +7,9 @@ <beans> <bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver"> - <property name="basename"><value>views</value></property> + <property name="basename"> + <value>views</value> + </property> </bean> <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> @@ -22,7 +24,8 @@ <!-- ========================= CONTROLLER DEFINITIONS ========================= --> - <bean id="appControllerResolver" class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver"> + <bean id="appControllerResolver" + class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver"> <property name="mappings"> <props> <prop key="/number.htm">numberHandler</prop> @@ -33,9 +36,15 @@ </bean> <bean id="appController" class="org.jboss.tutorial.web.AppController"> - <property name="methodNameResolver"><ref local="appControllerResolver"/></property> - <property name="randomizer"><ref bean="randomizer"/></property> - <property name="horoscope"><ref bean="horoscope"/></property> + <property name="methodNameResolver"> + <ref local="appControllerResolver"/> + </property> + <property name="randomizer"> + <ref bean="randomizer"/> + </property> + <property name="horoscope"> + <ref bean="horoscope"/> + </property> </bean> </beans> |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:51
|
User: alesj Date: 06/07/09 09:18:50 Modified: src/test/org/jboss/tutorial/spring DummyStateIntCreator.java FileLineReader.java IntCreator.java JavaRandomIntCreator.java RandomFileWordsCreator.java StaticWordsCreator.java WordsCreator.java Log: Reformat code + Spring-MC fix. Revision Changes Path 1.3 +7 -5 jboss-spring/src/test/org/jboss/tutorial/spring/DummyStateIntCreator.java (In the diff below, changes in quantity of whitespace are not shown.) Index: DummyStateIntCreator.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/test/org/jboss/tutorial/spring/DummyStateIntCreator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- DummyStateIntCreator.java 29 Oct 2005 23:58:12 -0000 1.2 +++ DummyStateIntCreator.java 9 Jul 2006 13:18:50 -0000 1.3 @@ -25,11 +25,13 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public class DummyStateIntCreator implements IntCreator { +public class DummyStateIntCreator implements IntCreator +{ private int state = 1; - public int createInt(int radius) { + public int createInt(int radius) + { state = (state * 3 * 7 * 19 * 37) % radius; return state; } 1.3 +18 -9 jboss-spring/src/test/org/jboss/tutorial/spring/FileLineReader.java (In the diff below, changes in quantity of whitespace are not shown.) Index: FileLineReader.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/test/org/jboss/tutorial/spring/FileLineReader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- FileLineReader.java 29 Oct 2005 23:58:12 -0000 1.2 +++ FileLineReader.java 9 Jul 2006 13:18:50 -0000 1.3 @@ -33,36 +33,45 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public class FileLineReader extends StaticWordsCreator implements InitializingBean { +public class FileLineReader extends StaticWordsCreator implements InitializingBean +{ private Resource resource; protected List<String> words; - public Resource getResource() { + public Resource getResource() + { return resource; } - public void setResource(Resource resource) { + public void setResource(Resource resource) + { this.resource = resource; } - public void afterPropertiesSet() throws Exception { - if (getResource() == null) { + public void afterPropertiesSet() throws Exception + { + if (getResource() == null) + { throw new IllegalArgumentException("Resource must be set!"); } BufferedReader reader = new BufferedReader(new InputStreamReader(getResource().getInputStream())); - try { + try + { words = new ArrayList<String>(); String line; - while((line = reader.readLine()) != null) { + while ((line = reader.readLine()) != null) + { words.add(line); } - } finally { + } finally + { reader.close(); } } - protected String[] getArray() { + protected String[] getArray() + { return words.toArray(new String[words.size()]); } 1.3 +2 -1 jboss-spring/src/test/org/jboss/tutorial/spring/IntCreator.java (In the diff below, changes in quantity of whitespace are not shown.) Index: IntCreator.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/test/org/jboss/tutorial/spring/IntCreator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- IntCreator.java 29 Oct 2005 23:58:12 -0000 1.2 +++ IntCreator.java 9 Jul 2006 13:18:50 -0000 1.3 @@ -25,6 +25,7 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public interface IntCreator { +public interface IntCreator +{ int createInt(int radius); } 1.3 +4 -2 jboss-spring/src/test/org/jboss/tutorial/spring/JavaRandomIntCreator.java (In the diff below, changes in quantity of whitespace are not shown.) Index: JavaRandomIntCreator.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/test/org/jboss/tutorial/spring/JavaRandomIntCreator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- JavaRandomIntCreator.java 29 Oct 2005 23:58:12 -0000 1.2 +++ JavaRandomIntCreator.java 9 Jul 2006 13:18:50 -0000 1.3 @@ -27,11 +27,13 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public class JavaRandomIntCreator implements IntCreator { +public class JavaRandomIntCreator implements IntCreator +{ private Random random = new Random(); - public int createInt(int radius) { + public int createInt(int radius) + { return random.nextInt(radius); } 1.3 +12 -6 jboss-spring/src/test/org/jboss/tutorial/spring/RandomFileWordsCreator.java (In the diff below, changes in quantity of whitespace are not shown.) Index: RandomFileWordsCreator.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/test/org/jboss/tutorial/spring/RandomFileWordsCreator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- RandomFileWordsCreator.java 29 Oct 2005 23:58:12 -0000 1.2 +++ RandomFileWordsCreator.java 9 Jul 2006 13:18:50 -0000 1.3 @@ -25,26 +25,32 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public class RandomFileWordsCreator extends FileLineReader { +public class RandomFileWordsCreator extends FileLineReader +{ private IntCreator intCreator; - public IntCreator getIntCreator() { + public IntCreator getIntCreator() + { return intCreator; } - public void setIntCreator(IntCreator intCreator) { + public void setIntCreator(IntCreator intCreator) + { this.intCreator = intCreator; } - public void afterPropertiesSet() throws Exception { + public void afterPropertiesSet() throws Exception + { super.afterPropertiesSet(); - if (getIntCreator() == null) { + if (getIntCreator() == null) + { throw new IllegalArgumentException("IntCreatot must be set!"); } } - protected String getNext() { + protected String getNext() + { return words.get(getIntCreator().createInt(words.size())); } 1.3 +8 -4 jboss-spring/src/test/org/jboss/tutorial/spring/StaticWordsCreator.java (In the diff below, changes in quantity of whitespace are not shown.) Index: StaticWordsCreator.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/test/org/jboss/tutorial/spring/StaticWordsCreator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- StaticWordsCreator.java 29 Oct 2005 23:58:12 -0000 1.2 +++ StaticWordsCreator.java 9 Jul 2006 13:18:50 -0000 1.3 @@ -25,7 +25,8 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public class StaticWordsCreator implements WordsCreator { +public class StaticWordsCreator implements WordsCreator +{ private static final String[] words = { "Java", @@ -39,16 +40,19 @@ private int counter; - protected String[] getArray() { + protected String[] getArray() + { return words; } - protected String getNext() { + protected String getNext() + { String[] array = getArray(); return array[(counter++) % array.length]; } - public String createWord() { + public String createWord() + { return getNext(); } 1.3 +3 -2 jboss-spring/src/test/org/jboss/tutorial/spring/WordsCreator.java (In the diff below, changes in quantity of whitespace are not shown.) Index: WordsCreator.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/test/org/jboss/tutorial/spring/WordsCreator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- WordsCreator.java 29 Oct 2005 23:58:12 -0000 1.2 +++ WordsCreator.java 9 Jul 2006 13:18:50 -0000 1.3 @@ -25,7 +25,8 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public interface WordsCreator { +public interface WordsCreator +{ String createWord(); |
From: Ales J. <ale...@ge...> - 2006-07-09 13:18:51
|
User: alesj Date: 06/07/09 09:18:50 Modified: src/test/org/jboss/tutorial/web AppController.java Log: Reformat code + Spring-MC fix. Revision Changes Path 1.3 +20 -10 jboss-spring/src/test/org/jboss/tutorial/web/AppController.java (In the diff below, changes in quantity of whitespace are not shown.) Index: AppController.java =================================================================== RCS file: /cvsroot/jboss/jboss-spring/src/test/org/jboss/tutorial/web/AppController.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- AppController.java 29 Oct 2005 23:58:12 -0000 1.2 +++ AppController.java 9 Jul 2006 13:18:50 -0000 1.3 @@ -34,44 +34,54 @@ /** * @author <a href="mailto:ale...@ge...">Ales Justin</a> */ -public class AppController extends MultiActionController { +public class AppController extends MultiActionController +{ private Randomizer randomizer; private Horoscope horoscope; - public Randomizer getRandomizer() { + public Randomizer getRandomizer() + { return randomizer; } - public void setRandomizer(Randomizer randomizer) { + public void setRandomizer(Randomizer randomizer) + { this.randomizer = randomizer; } - public Horoscope getHoroscope() { + public Horoscope getHoroscope() + { return horoscope; } - public void setHoroscope(Horoscope horoscope) { + public void setHoroscope(Horoscope horoscope) + { this.horoscope = horoscope; } public ModelAndView numberHandler(HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws Exception + { int radius = RequestUtils.getRequiredIntParameter(request, "radius"); return new ModelAndView("main", "number", randomizer.getNumber(radius)); } public ModelAndView wordHandler(HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws Exception + { return new ModelAndView("main", "word", randomizer.getWord()); } public ModelAndView horoscopeHandler(HttpServletRequest request, HttpServletResponse response) - throws Exception { - if (RequestUtils.getStringParameter(request, "clear") != null) { + throws Exception + { + if (RequestUtils.getStringParameter(request, "clear") != null) + { horoscope.clear(); return new ModelAndView("main"); - } else { + } else + { int month = RequestUtils.getRequiredIntParameter(request, "month"); return new ModelAndView("main", "horoscope", horoscope.getHoroscope(month)); } |