-
15. Re: BSH script from client
alesj Nov 15, 2007 7:57 AM (in response to alesj)As I'm currently on the deployers (187), I'll add Adrian's FileMatcher idea + fix the FileStructure algorithm.
-
16. Re: BSH script from client
anil.saldhana Dec 13, 2007 9:19 PM (in response to alesj)org.jboss.test.jmx.test.DeployXMBeanUnitTestCase
was never fixed. Please read Dimitris's post earlier about bean script inside the sar. -
17. Re: BSH script from client
alesj Dec 13, 2007 10:48 PM (in response to alesj)"anil.saldhana@jboss.com" wrote:
org.jboss.test.jmx.test.DeployXMBeanUnitTestCase
was never fixed. Please read Dimitris's post earlier about bean script inside the sar.
I remember testing it inside jar and it went OK.
But I'll have a look at this test asap. -
18. Re: BSH script from client
alesj Dec 13, 2007 11:12 PM (in response to alesj)Aha, I see what the problem is.
The script file is outside META-INF, which the JARStructure - who recognizes .sar file - treats like a metadata location.
Either describe interceptors-beans.sar/jmx/interceptors/scripts as a metadata location or move .bsh file into sar's META-INF directory. -
19. Re: BSH script from client
anil.saldhana Dec 14, 2007 12:58 AM (in response to alesj)Since this test is a favorite of Dimitris, I will delegate it to his excellency to make the final choice on your recommendations.
-
-
21. Re: BSH script from client
dimitris Dec 14, 2007 3:21 AM (in response to alesj)I think the point here is that we didn't impose restrictions before as to where a .bsh deployment may reside...
-
22. Re: BSH script from client
alesj Dec 14, 2007 1:15 PM (in response to alesj)Scott, you said -service.xml can be where ever?
Or which file?
Since SARDeployer extends JAXPDeployer
JAXPDeployer extends AbstractVFSParsingDeployer.
Where AbstractVFSParsingDeployer uses this to find files with suffix:protected T parse(DeploymentUnit unit, String name, String suffix, T root) throws Exception { // Should we include the deployment // The infrastructure will only check leafs anyway so no need to check here if (name == null && isIncludeDeploymentFile()) name = unit.getName(); // Try to find the metadata VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit) unit; List<VirtualFile> files = vfsDeploymentUnit.getMetaDataFiles(name, suffix); if (files.size() == 0) return null; // TODO JBMICROCONT-184 remove this limitation if (files.size() > 1) throw new DeploymentException("Only one file is allowed, found=" + files); VirtualFile file = files.get(0); T result = parse(vfsDeploymentUnit, file, root); if (result != null) init(vfsDeploymentUnit, result, file); return result; }
'vfsDeploymentUnit.getMetaDataFiles(name, suffix)'
Meaning only metadata files are checked.
What would be needed to handle .bsh file anywhere?
A new BshStructure? -
23. Re: BSH script from client
starksm64 Dec 14, 2007 1:58 PM (in response to alesj)The following jaas-service.xml is deployed fine:
[starksm@succubus lib]$ jar -tf client-login-tests.jar META-INF/MANIFEST.MF org/jboss/test/security/clientlogin/BeanA.class org/jboss/test/security/clientlogin/BeanB.class org/jboss/test/security/clientlogin/BeanC.class org/jboss/test/security/clientlogin/IClientLogin.class org/jboss/test/security/clientlogin/IClientLoginHome.class jaas-service.xml META-INF/ejb-jar.xml META-INF/jboss.xml
because jaas-service.xml is a context with a null metadata location, hence itself matches the metadata file. Its the identification of the structure that determines which contexts are deployment candidates. The .bsh suffix needs to be added to the FileStructure in order for these scripts to be recognized as deployable:<!-- File Structure --> <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure"> <!-- Unless specified the default list of suffixes is -service.xml, -beans.xml, -ds.xml, -aop.xml --> <constructor> <parameter> <set elementClass="java.lang.String"> <value>-service.xml</value> <value>-beans.xml</value> <value>-ds.xml</value> <value>-aop.xml</value> </set> </parameter> </constructor> </bean>
-
24. Re: BSH script from client
alesj Dec 14, 2007 2:18 PM (in response to alesj)"scott.stark@jboss.org" wrote:
The .bsh suffix needs to be added to the FileStructure in order for these scripts to be recognized as deployable
This is added via FileMatcher.public class LegacyBeanShellDeployer extends AbstractVFSParsingDeployer<BeanShellScript> implements FileMatcher
Where FileStructure has this:@Install public boolean addFileMatcher(FileMatcher fm) { return fileMatchers.add(fm); } @Uninstall public boolean removeFileMatcher(FileMatcher fm) { return fileMatchers.remove(fm); }
andprotected boolean checkFileMatchers(VirtualFile file) { for(FileMatcher fm : fileMatchers) { if (fm.isDeployable(file)) return true; } return false; }
So, by what you're saying, this is should already work. :-) -
25. Re: BSH script from client
starksm64 Dec 14, 2007 2:51 PM (in response to alesj)I guess so. Add a testcase to the mc project.
-
26. Re: BSH script from client
alesj Dec 14, 2007 8:40 PM (in response to alesj)"scott.stark@jboss.org" wrote:
I guess so. Add a testcase to the mc project.
Done (but not yet commited).
But only root.bsh gets picked up, as your example did.
If it's like as it is in interceptors-beans.sar/jmx/interceptors/scripts/myscript.bsh, then it's not picked up, since jmx directory is not recognized.
Structure:- nmd.jar - jmx - interceptors - scripts - myscript.bsh - META-INF - root.bsh
Log:org.jboss.test.deployers.vfs.deployer.nonmetadata.test.MockBshDeployerTestCase 0 DEBUG [MockBshDeployerTestCase] ==== Starting testBshNonMetadataDeploy ==== 31 DEBUG [VFSStructuralDeployersImpl] Added structure deployer org.jboss.deployers.vfs.plugins.structure.jar.JARStructure@911f71 47 DEBUG [VFSStructuralDeployersImpl] Added structure deployer org.jboss.deployers.vfs.plugins.structure.file.FileStructure@1eec612 78 DEBUG [DeployersImpl] Added stage Not Installed before null 78 DEBUG [DeployersImpl] Added stage Parse before ControllerState@84abc9{PreInstall} 78 DEBUG [DeployersImpl] Added stage Describe before ControllerState@84abc9{PreInstall} 78 DEBUG [DeployersImpl] Added stage ClassLoader before ControllerState@84abc9{PreInstall} 78 DEBUG [DeployersImpl] Added stage PostClassLoader before ControllerState@84abc9{PreInstall} 78 DEBUG [DeployersImpl] Added stage Real before ControllerState@84abc9{PreInstall} 78 DEBUG [DeployersImpl] Added stage Installed before ControllerState@84abc9{PreInstall} 109 DEBUG [DeployersImpl] Added deployer org.jboss.test.deployers.vfs.deployer.nonmetadata.support.MockBshDeployer@bfbdb0 for stage Parse org.jboss.test.deployers.vfs.deployer.nonmetadata.support.MockBshDeployer@bfbdb0{inputs=[] outputs=[org.jboss.test.deployers.vfs.deployer.nonmetadata.support.BshScript]} 188 DEBUG [MainDeployerImpl] Add deployment: vfsfile:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/ 188 TRACE [VFSStructuralDeployersImpl] Determining structure for nmd.jar deployers=[org.jboss.deployers.vfs.plugins.structure.jar.JARStructure@911f71, org.jboss.deployers.vfs.plugins.structure.file.FileStructure@1eec612] 234 TRACE [JARStructure] Not using metadata path META-INF for nmd.jar reason: File does not exist: C:\projects\microcontainer\deployers-vfs\target\tests-classes\nonmetadata\nmd.jar\META-INF 234 TRACE [JARStructure] Added context ContextInfoImpl{path= metaData=[] classPath=null} from nmd.jar 234 DEBUG [VFSUtils] Can't find manifest for nmd.jar 234 TRACE [JARStructure] Added classpath entry for nmd.jar from FileHandler@3541984[path=nmd.jar context=file:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata real=file:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/] 250 TRACE [VFSStructuralDeployersImpl] Determining structure for jmx deployers=[org.jboss.deployers.vfs.plugins.structure.jar.JARStructure@911f71, org.jboss.deployers.vfs.plugins.structure.file.FileStructure@1eec612] 266 TRACE [JARStructure] ... no - doesn't look like a jar and no META-INF subdirectory. 266 TRACE [JARStructure] Not recognised: jmx 266 TRACE [FileStructure] ... no - not a file. 266 TRACE [FileStructure] Not recognised: jmx 266 TRACE [VFSStructuralDeployersImpl] jmx not recognised 266 TRACE [VFSStructuralDeployersImpl] Determining structure for root.bsh deployers=[org.jboss.deployers.vfs.plugins.structure.jar.JARStructure@911f71, org.jboss.deployers.vfs.plugins.structure.file.FileStructure@1eec612] 266 TRACE [JARStructure] ... no - not a directory or an archive. 266 TRACE [JARStructure] Not recognised: root.bsh 266 TRACE [FileStructure] FileHandler@7051261[path=nmd.jar/root.bsh context=file:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata real=file:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/root.bsh] is a leaf 266 TRACE [FileStructure] ... ok - not a top level file but it is a known name 266 TRACE [FileStructure] Added context ContextInfoImpl{path= metaData=[] classPath=null} from root.bsh 266 TRACE [FileStructure] FileHandler@7051261[path=nmd.jar/root.bsh context=file:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata real=file:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/root.bsh] isFile: true 281 TRACE [FileStructure] Recognised: root.bsh 281 TRACE [VFSStructuralDeployersImpl] root.bsh recognised by org.jboss.deployers.vfs.plugins.structure.file.FileStructure@1eec612 281 TRACE [JARStructure] Recognised: nmd.jar 281 TRACE [VFSStructuralDeployersImpl] nmd.jar recognised by org.jboss.deployers.vfs.plugins.structure.jar.JARStructure@911f71 281 TRACE [VFSStructureBuilder] Populating deployment vfsfile:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/ metaData=StructureMetaDataImpl{contexts=[ContextInfoImpl{path= metaData=[] classPath=[ClassPathEntryImpl{path=}]}, ContextInfoImpl{path=root.bsh metaData=[] classPath=null}]} 297 TRACE [VFSStructureBuilder] Apply context: vfsfile:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/ ContextInfoImpl{path= metaData=[] classPath=[ClassPathEntryImpl{path=}]} 297 TRACE [VFSStructureBuilder] Resolving classpath entry ClassPathEntryImpl{path=} for vfsfile:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/ 313 TRACE [AbstractVFSDeploymentContext] ClassPath for nmd.jar is nmd.jar 313 TRACE [VFSStructureBuilder] Populating Context vfsfile:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/ metaData=StructureMetaDataImpl{contexts=[ContextInfoImpl{path= metaData=[] classPath=[ClassPathEntryImpl{path=}]}, ContextInfoImpl{path=root.bsh metaData=[] classPath=null}]} 313 TRACE [VFSStructureBuilder] Apply context: vfsfile:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/root.bsh ContextInfoImpl{path=root.bsh metaData=[] classPath=null} 313 TRACE [VFSStructureBuilder] Populating Context vfsfile:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/root.bsh metaData=StructureMetaDataImpl{contexts=[ContextInfoImpl{path= metaData=[] classPath=null}]} 313 DEBUG [MainDeployerImpl] Scheduling deployment: vfsfile:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/ parent=null 328 DEBUG [MainDeployerImpl] Scheduling deployment: vfsfile:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/root.bsh parent=AbstractVFSDeploymentContext@7254922{vfsfile:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/} 344 TRACE [DeployersImpl] Deployers for Not Installed [] 344 TRACE [DeployersImpl] Deployers for Not Installed [] 344 DEBUG [DeployersImpl] Deploying vfsfile:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/ 344 TRACE [DeployersImpl] Deployers for Parse [org.jboss.test.deployers.vfs.deployer.nonmetadata.support.MockBshDeployer@bfbdb0] 359 TRACE [DeployersImpl] Deployers for Describe [] 359 TRACE [DeployersImpl] Deployers for ClassLoader [] 359 TRACE [DeployersImpl] Deployers for PostClassLoader [] 359 TRACE [DeployersImpl] Deployers for Real [] 359 TRACE [DeployersImpl] Deployers for PreInstall [] 359 TRACE [DeployersImpl] Deployers for Described [] 359 TRACE [DeployersImpl] Deployers for Instantiated [] 359 TRACE [DeployersImpl] Deployers for Configured [] 359 TRACE [DeployersImpl] Deployers for Create [] 359 TRACE [DeployersImpl] Deployers for Start [] 359 TRACE [DeployersImpl] Deployers for Installed [] 359 DEBUG [DeployersImpl] Fully Deployed vfsfile:/C:/projects/microcontainer/deployers-vfs/target/tests-classes/nonmetadata/nmd.jar/ 375 DEBUG [MockBshDeployerTestCase] testBshNonMetadataDeploy took 375ms 375 DEBUG [MockBshDeployerTestCase] ==== Stopping testBshNonMetadataDeploy ==== Process finished with exit code 0
-
27. Re: BSH script from client
alesj Dec 17, 2007 8:41 PM (in response to alesj)Commited MockBshDeployerTestCase.
Workaround is present in MultipleMetadataStructureUnitTestCase. -
28. Re: BSH script from client
alesj Dec 18, 2007 12:52 PM (in response to alesj)Added jboss-structure.xml
<structure> <context> <path name=""/> <metaDataPath> <path name="META-INF"/> <path name="jmx/interceptors"/> <path name="jmx/interceptors/scripts"/> </metaDataPath> <classpath> <path name=""/> </classpath> </context> </structure>
to interceptors-mbeans.sar, which fixed the Bsh problem:C:\projects\jboss5\trunk\testsuite>build -Dtest=org.jboss.test.jmx.test.DeployXMBeanUnitTestCase one-test Calling ..\tools\bin\ant.bat -Dtest org.jboss.test.jmx.test.DeployXMBeanUnitTestCase one-test Buildfile: build.xml Overriding previous definition of reference to apache.commons.classpath Overriding previous definition of reference to sax.classpath Overriding previous definition of reference to xdoclet.task.classpath Overriding previous definition of reference to gjt.jpl-util.classpath Overriding previous definition of reference to opennms.joesnmp.classpath Overriding previous definition of reference to jacorb.idl.classpath Overriding previous definition of reference to sleepycat.classpath Overriding previous definition of reference to apache.tomcat55.classpath Overriding previous definition of reference to trove.classpath Overriding previous definition of reference to qdox.classpath Overriding previous definition of reference to javassist.classpath Overriding previous definition of reference to hibernate3.classpath Overriding previous definition of reference to odmg.classpath Overriding previous definition of reference to cglib.classpath Overriding previous definition of reference to ejb3-persistence.classpath Overriding previous definition of reference to spring.classpath Overriding previous definition of reference to apache.ant.classpath Overriding previous definition of reference to jboss.test.classpath one-test: [junit] Running org.jboss.test.jmx.test.DeployXMBeanUnitTestCase [junit] Found log4j.xml: file:/C:/projects/jboss5/trunk/testsuite/output/resources/log4j.xml [junit] Tests run: 11, Failures: 0, Errors: 0, Time elapsed: 6,11 sec BUILD SUCCESSFUL Total time: 17 seconds
-
29. Re: BSH script from client
dimitris Dec 18, 2007 1:05 PM (in response to alesj)This is a workaround, right? ;-)