[Design the new POJO MicroContainer] - Re: Nested property ref
by alesj
"alesj" wrote :
| Or I can refactor ConfigureAction to do this with bypassing KernelConfigurator usage.
I have a few question regarding this impl:
| protected void dispatchSetProperty(PropertyMetaData property, boolean nullyfy, BeanInfo info, Object target, ClassLoader cl)
| throws Throwable
| {
| String name = property.getName();
| if (nullyfy)
| {
| info.setProperty(target, name, null);
| }
| else
| {
| PropertyInfo propertyInfo = info.getProperty(name);
| ValueMetaData valueMetaData = property.getValue();
| Object value = valueMetaData.getValue(propertyInfo.getType(), cl);
| info.setProperty(target, name, value);
| }
| }
|
This bypasses the KernelControllerContextAction.dispatchJoinPoint, which is probably not a good thing.
But on the other hand, every BeanInfo.get/set or PropertyInfo.get/set also doesn't go through JoinpointFactory.
What's the main purpose of JoinpointFactory then?
To simplyfy AOP usage or to add some other metadata notion?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111725#4111725
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111725
18 years, 4 months
[Design of POJO Server] - VFS caching is broken
by adrian@jboss.org
The VFS is using getLastModified() to determine whether
the cache is valid. This is a broken check on Unix because deleting
and replacing a file doesn't cause it to see the new file.
Instead the file descriptor of the deleted file still exists in an unhooked state
(i.e. not visible in the directory), until all references are released.
Here's a test that shows the problem
(basically doing what UndeployBrokenPackageUnitTestCase is doing).
| import java.io.File;
| import java.io.InputStream;
| import java.io.InputStreamReader;
| import java.net.URL;
|
| import org.jboss.util.file.Files;
| import org.jboss.virtual.VFS;
| import org.jboss.virtual.VirtualFile;
|
| public class Test
| {
| public static void main(String[] args) throws Exception
| {
| String testPackage = "ejbredeploy.jar";
| String temp = System.getProperty("java.io.tmpdir");
| File tempFile = new File(temp);
| URL tempURL = tempFile.toURL();
| File thejar = new File(tempFile, "ejbredeploy.jar");
| File badjar = new File(tempFile, "ejbredeploy-bad.jar");
| File goodjar = new File(tempFile, "ejbredeploy-good.jar");
|
|
| thejar.delete();
| Files.copy(badjar, thejar);
| VirtualFile child1 = printEjbJarXml(tempURL);
| System.out.println("child1 " + child1.getLastModified());
|
| Thread.sleep(1000);
|
| thejar.delete();
| Files.copy(goodjar, thejar);
| printEjbJarXml(tempURL);
| VirtualFile child2 = printEjbJarXml(tempURL);
|
| System.out.println("child1 " + child1.getLastModified());
| System.out.println("child2 " + child2.getLastModified());
| }
|
| public static VirtualFile printEjbJarXml(URL tempURL) throws Exception
| {
| VirtualFile file = VFS.getRoot(tempURL);
| VirtualFile child = file.findChild("ejbredeploy.jar/META-INF/ejb-jar.xml");
| InputStream is = child.openStream();
| InputStreamReader reader = new InputStreamReader(is);
| char[] buffer = new char[1024];
| int read = reader.read(buffer, 0, 1024);
| while (read >= 0)
| {
| for (int i = 0; i < read; ++i)
| System.out.print(buffer);
| read = reader.read(buffer, 0, 1024);
| }
| System.out.println();
|
| return child;
| }
| }
|
To run it copy ejbredeploy-good.jar and ejbredeploiy-bad.jar into your temp directory.
The output of the tests shows it does not see the replaced file
and the last modified doesn't change
so it must be holding onto the old file and never looking at the new file:
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE ejb-jar
| PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
| "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
|
| <ejb-jar>
| <description>An invalid single entity bean DD</description>
| <enterprise-beans>
| <entity>
| <description>EntityA</description>
| <ejb-name>EntityA</ejb-name>
|
| <home>org.jboss.test.jmx.interfaces.EntityAHome</home>
| <remote>org.jboss.test.jmx.interfaces.EntityA</remote>
|
| <ejb-class>org.jboss.test.jmx.ejb.EntityABean</ejb-class>
| <persistence-type>Container</persistence-type>
| <prim-key-class>java.lang.Integer</prim-key-class>
| <!-- Commenting these fields will make the deployment fail
| <reentrant>False</reentrant>
| <cmp-version>2.x</cmp-version>
| <abstract-schema-name>EntityA</abstract-schema-name>
| <cmp-field >
| <field-name>id</field-name>
| </cmp-field>
| <cmp-field>
| <field-name>value</field-name>
| </cmp-field>
| <primkey-field>id</primkey-field>
| -->
|
| </entity>
| </enterprise-beans>
|
| </ejb-jar>
|
| child1 1194256772000
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE ejb-jar
| PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
| "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
|
| <ejb-jar>
| <description>A valid single entity bean DD</description>
| <enterprise-beans>
| <entity>
| <description>EntityA</description>
| <ejb-name>EntityA</ejb-name>
|
| <home>org.jboss.test.jmx.interfaces.EntityAHome</home>
| <remote>org.jboss.test.jmx.interfaces.EntityA</remote>
|
| <ejb-class>org.jboss.test.jmx.ejb.EntityABean</ejb-class>
| <persistence-type>Container</persistence-type>
| <prim-key-class>java.lang.Integer</prim-key-class>
| <reentrant>False</reentrant>
| <cmp-version>2.x</cmp-version>
| <abstract-schema-name>EntityA</abstract-schema-name>
| <cmp-field >
| <field-name>id</field-name>
| </cmp-field>
| <cmp-field>
| <field-name>value</field-name>
| </cmp-field>
| <primkey-field>id</primkey-field>
|
| </entity>
| </enterprise-beans>
|
| </ejb-jar>
|
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE ejb-jar
| PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
| "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
|
| <ejb-jar>
| <description>A valid single entity bean DD</description>
| <enterprise-beans>
| <entity>
| <description>EntityA</description>
| <ejb-name>EntityA</ejb-name>
|
| <home>org.jboss.test.jmx.interfaces.EntityAHome</home>
| <remote>org.jboss.test.jmx.interfaces.EntityA</remote>
|
| <ejb-class>org.jboss.test.jmx.ejb.EntityABean</ejb-class>
| <persistence-type>Container</persistence-type>
| <prim-key-class>java.lang.Integer</prim-key-class>
| <reentrant>False</reentrant>
| <cmp-version>2.x</cmp-version>
| <abstract-schema-name>EntityA</abstract-schema-name>
| <cmp-field >
| <field-name>id</field-name>
| </cmp-field>
| <cmp-field>
| <field-name>value</field-name>
| </cmp-field>
| <primkey-field>id</primkey-field>
|
| </entity>
| </enterprise-beans>
|
| </ejb-jar>
|
| child1 1194256772000
| child2 1194256772000
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111720#4111720
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111720
18 years, 4 months
[Design of POJO Server] - Re: Missing feature in EJB2 ContainerConfiguration merge
by adrian@jboss.org
You can reproduce the problem with this test:
| one-test:
| [junit] Running org.jboss.test.jmx.test.EarDeploymentUnitTestCase
| [junit] Found log4j.xml: file:/home/ejort/jboss-head/testsuite/output/resources/log4j.xml
| [junit] Tests run: 2, Failures: 0, Errors: 1, Time elapsed: 2.205 sec
| [junit] Test org.jboss.test.jmx.test.EarDeploymentUnitTestCase FAILED
|
| 01:16:04,636 ERROR [AbstractKernelController] Error installing to Create: name=jboss.j2ee:module="eardependsaejb.jar",service=EjbModule state=Configured mode=Manual re
| quiredState=Create
| org.jboss.deployment.DeploymentException: Missing or invalid Instance Pool (in jboss.xml or standardjboss.xml)
| at org.jboss.ejb.EjbModule.createInstancePool(EjbModule.java:1209)
| at org.jboss.ejb.EjbModule.createStatelessSessionContainer(EjbModule.java:689)
| at org.jboss.ejb.EjbModule.createContainer(EjbModule.java:638)
| at org.jboss.ejb.EjbModule.createService(EjbModule.java:382)
| at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:267)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111700#4111700
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111700
18 years, 4 months
[Design of POJO Server] - Missing feature in EJB2 ContainerConfiguration merge
by adrian@jboss.org
In the old EJB2 container configuration, you could do something like this
which is an extension of the container configuration without changing its name
| <container-configurations>
| <container-configuration>
| <container-name>Standard Stateless SessionBean</container-name>
| <depends>test:name=Test</depends>
| </container-configuration>
| </container-configurations>
|
This is the old code (note the comment).
| Element conf = (Element)iterator.next();
| String confName = getElementContent(getUniqueChild(conf,
| "container-name"));
| String parentConfName = conf.getAttribute("extends");
| if (parentConfName != null && parentConfName.trim().length() == 0)
| {
| parentConfName = null;
| }
|
| // Allow the configuration to inherit from a standard
| // configuration. This is determined by looking for a
| // configuration matching the name given by the extends
| // attribute, or if extends was not specified, an
| // existing configuration with the same.
| ConfigurationMetaData configurationMetaData = null;
| if (parentConfName != null)
| {
| configurationMetaData = getConfigurationMetaDataByName(parentConfName);
| if (configurationMetaData == null)
| {
| throw new DeploymentException("Failed to find " +
| "parent config=" + parentConfName);
| }
|
| // Make a copy of the existing configuration
| configurationMetaData =
| (ConfigurationMetaData)configurationMetaData.clone();
| configurations.put(confName, configurationMetaData);
| }
|
| if (configurationMetaData == null)
| {
| configurationMetaData =
| getConfigurationMetaDataByName(confName);
| }
|
| // Create a new configuration if none was found
| if (configurationMetaData == null)
| {
| configurationMetaData = new ConfigurationMetaData(confName);
| configurations.put(confName, configurationMetaData);
| }
|
This isn't working in the new metadata because the the wrapper
only looks at the extends attribute.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4111699#4111699
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4111699
18 years, 4 months