Access to deployment descriptor: ejb-jar.xml

I need to have access to the ejb-jar.xml of an ejb module and modify it. If it is not currently configured I'd like to add it (both the file and the deployment descriptor in the module settings).

Any suggestions where I can start looking?

I remember there was a long thread a while ago about "feedback on new ejb (or j2ee?) model" (or something along those lines). I can't find in the web forum. Can be I read it only in the newsgroup and it was one of those threads that never made it to the web forum... I don't currently have newsgroup access.

The javadoc for com.intellij.j2ee packages and classes is very scarce (to put it in friendly terms).

2 comments

Access:

((EjbModuleProperties)JavaeeModuleProperties.getInstance(module)).getXmlRoot()
or
((EjbModuleProperties)JavaeeModuleProperties.getInstance(module)).getMergedRoot()
or
JavaeeModuleProperties.getInstance(module).getMainDeploymentDescriptor()

Here's how you create descriptor (in write action):

final DeploymentDescriptorMetaData metaData =
EjbRootDescriptor.EJB_JAR_DEPLOYMENT_DESCRIPTOR;
final JavaeeModuleProperties moduleProperties =
JavaeeModuleProperties.getInstance(module);
final String path = FileUtil.toSystemIndependentName(new
File(module.getModuleFilePath()).getParent())
+ "/" + metaData.getDefaultDirectoryName() + "/" +
metaData.getDefaultFileName();

final ModifiableRootModel rootModel =
ModuleRootManager.getInstance(module).getModifiableModel();
moduleProperties.startEdit(rootModel);
final JavaeeModulePropertiesEx modifiableModuleProperties =
(JavaeeModulePropertiesEx)moduleProperties.getModifiableModel();
final JavaeeDeploymentItem item =
modifiableModuleProperties.addDeploymentDescriptor(metaData, path);
item.createIfNotExists();
moduleProperties.commit(rootModel);
modifiableModuleProperties.disposeModifiableModel();

"Stephen Friedrich" <no_mail@jetbrains.com> wrote in message
news:11799667.1157553314757.JavaMail.itn@is.intellij.net...
>I need to have access to the ejb-jar.xml of an ejb module and modify it. If
>it is not currently configured I'd like to add it (both the file and the
>deployment descriptor in the module settings).
>

Any suggestions where I can start looking?

>

I remember there was a long thread a while ago about "feedback on new ejb
(or j2ee?) model" (or something along those lines). I can't find in the
web forum. Can be I read it only in the newsgroup and it was one of those
threads that never made it to the web forum... I don't currently have
newsgroup access.

>

The javadoc for com.intellij.j2ee packages and classes is very scarce (to
put it in friendly terms).



0

Thanks a lot.
It's working fine and I start to get the hang of Idea's ejb model.
Will release a first version of my Seam plugin very soon.

0

Please sign in to leave a comment.