You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Sachin Patel <sp...@gmail.com> on 2006/10/04 17:43:22 UTC
How do I get the configID from deploymentPlan?
I must be overlooking something but I'm having trouble using XMLBeans
to get to the EnvironmentType for a given deployment plan.
If I have...
XmlObject xmlObject = XmlBeansUtil.parse(planFile.getLocation().toFile
());
from there if I cast to a particular DocumentType (WebAppDocument,
etc..) there are no methods to get me to the EnvioronmentType..
So I looked at the o.a.g.deployment.Deployer and in there... and what
got me even more confused was the following code... There are only
two implementations of ConfigurationBuilder, (ServiceConfigBuilder
and EARConfigBuilder), so how is the configID being retrieved? Where
is the getConfigurationID implementation for the other plan types?
Object plan = null;
ConfigurationBuilder builder = null;
for (Iterator i = builders.iterator(); i.hasNext();) {
ConfigurationBuilder candidate =
(ConfigurationBuilder) i.next();
System.out.println("***********" + candidate.getClass
().getName());
plan = candidate.getDeploymentPlan(planFile, module,
idBuilder);
if (plan != null) {
builder = candidate;
break;
}
}
if (builder == null) {
throw new DeploymentException("Cannot deploy the
requested application module because no deployer is able to handle
it. " +
" This can happen if you have omitted the
J2EE deployment descriptor, disabled a deployer module, or if, for
example, you are trying to deploy an" +
" EJB module on a minimal Geronimo server
that does not have EJB support installed. (" +
(planFile == null ? "" : "planFile=" +
planFile.getAbsolutePath()) +
(moduleFile == null ? "" : (planFile ==
null ? "" : ", ") + "moduleFile=" + moduleFile.getAbsolutePath()) +
")");
}
Artifact configID = builder.getConfigurationID(plan,
module, idBuilder);
Thanks
-sachin
Re: How do I get the configID from deploymentPlan?
Posted by David Jencks <da...@yahoo.com>.
On Oct 4, 2006, at 8:43 AM, Sachin Patel wrote:
> I must be overlooking something but I'm having trouble using
> XMLBeans to get to the EnvironmentType for a given deployment plan.
>
> If I have...
>
> XmlObject xmlObject = XmlBeansUtil.parse(planFile.getLocation
> ().toFile());
>
> from there if I cast to a particular DocumentType (WebAppDocument,
> etc..) there are no methods to get me to the EnvioronmentType..
>
> So I looked at the o.a.g.deployment.Deployer and in there... and
> what got me even more confused was the following code... There are
> only two implementations of ConfigurationBuilder,
> (ServiceConfigBuilder and EARConfigBuilder), so how is the configID
> being retrieved? Where is the getConfigurationID implementation for
> the other plan types?
>
>
> Object plan = null;
> ConfigurationBuilder builder = null;
> for (Iterator i = builders.iterator(); i.hasNext();) {
> ConfigurationBuilder candidate =
> (ConfigurationBuilder) i.next();
> System.out.println("***********" +
> candidate.getClass().getName());
> plan = candidate.getDeploymentPlan(planFile,
> module, idBuilder);
> if (plan != null) {
> builder = candidate;
> break;
> }
> }
> if (builder == null) {
> throw new DeploymentException("Cannot deploy the
> requested application module because no deployer is able to handle
> it. " +
> " This can happen if you have omitted the
> J2EE deployment descriptor, disabled a deployer module, or if, for
> example, you are trying to deploy an" +
> " EJB module on a minimal Geronimo server
> that does not have EJB support installed. (" +
> (planFile == null ? "" : "planFile=" +
> planFile.getAbsolutePath()) +
> (moduleFile == null ? "" : (planFile ==
> null ? "" : ", ") + "moduleFile=" + moduleFile.getAbsolutePath()) +
> ")");
> }
>
> Artifact configID = builder.getConfigurationID(plan,
> module, idBuilder);
>
> Thanks
That code's from Deployer which doesn't know anything about xml or
plans or anything like that. All the ConfigBuilders and
ModuleBuilders have code that extracts the Enviroment element,
typicaly like
EnvironmentType environmentType = gerConnector.getEnvironment
();
Environment environment = EnvironmentBuilder.buildEnvironment
(environmentType, defaultEnvironment);
However you may find it easier to do something more generic like
QNameSet ENV_QNAMESET =
EnvironementDocument.type.getDocumentElementQName();
....
XmlObject untypedEnv = plan.selectChildren(ENV_QNAMESET);
EnvironmentType env = (EnvironmentType)untypedEnv.changeType
(EnvironmentType.type);
Sometimes it's hard to convince xmlbeans to change the type
correctly, you get null out of changeType. In that case I use
env = (EnvironemntType)untypedEnv.copy().changeTYpe
(EnvironmentTYpe.type);
but then changes you make to env won't be reflected in the original
XmlObject or written back into the xml if you save. It's possible to
get around this.... but if changeType works without copying do that.
thanks
david jencks
>
> -sachin
>
>
Re: How do I get the configID from deploymentPlan?
Posted by Sachin Patel <sp...@gmail.com>.
So though some debug, the configID is retrieved for all of J2EE is
retreived from the EARConfigBuilder. But looks like there is alot of
overhead involved in getting this. Is there a simple way I can get
to the configID?
On Oct 4, 2006, at 11:43 AM, Sachin Patel wrote:
> I must be overlooking something but I'm having trouble using
> XMLBeans to get to the EnvironmentType for a given deployment plan.
>
> If I have...
>
> XmlObject xmlObject = XmlBeansUtil.parse(planFile.getLocation
> ().toFile());
>
> from there if I cast to a particular DocumentType (WebAppDocument,
> etc..) there are no methods to get me to the EnvioronmentType..
>
> So I looked at the o.a.g.deployment.Deployer and in there... and
> what got me even more confused was the following code... There are
> only two implementations of ConfigurationBuilder,
> (ServiceConfigBuilder and EARConfigBuilder), so how is the configID
> being retrieved? Where is the getConfigurationID implementation for
> the other plan types?
>
>
> Object plan = null;
> ConfigurationBuilder builder = null;
> for (Iterator i = builders.iterator(); i.hasNext();) {
> ConfigurationBuilder candidate =
> (ConfigurationBuilder) i.next();
> System.out.println("***********" +
> candidate.getClass().getName());
> plan = candidate.getDeploymentPlan(planFile,
> module, idBuilder);
> if (plan != null) {
> builder = candidate;
> break;
> }
> }
> if (builder == null) {
> throw new DeploymentException("Cannot deploy the
> requested application module because no deployer is able to handle
> it. " +
> " This can happen if you have omitted the
> J2EE deployment descriptor, disabled a deployer module, or if, for
> example, you are trying to deploy an" +
> " EJB module on a minimal Geronimo server
> that does not have EJB support installed. (" +
> (planFile == null ? "" : "planFile=" +
> planFile.getAbsolutePath()) +
> (moduleFile == null ? "" : (planFile ==
> null ? "" : ", ") + "moduleFile=" + moduleFile.getAbsolutePath()) +
> ")");
> }
>
> Artifact configID = builder.getConfigurationID(plan,
> module, idBuilder);
>
> Thanks
>
> -sachin
>
>
-sachin