Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 3266 invoked from network); 4 Oct 2006 20:47:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Oct 2006 20:47:13 -0000 Received: (qmail 60973 invoked by uid 500); 4 Oct 2006 20:47:12 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 60914 invoked by uid 500); 4 Oct 2006 20:47:11 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 60901 invoked by uid 99); 4 Oct 2006 20:47:11 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Oct 2006 13:47:11 -0700 Authentication-Results: idunn.apache.osuosl.org header.from=david_jencks@yahoo.com; domainkeys=good X-ASF-Spam-Status: No, hits=4.8 required=5.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,DNS_FROM_RFC_WHOIS,HTML_MESSAGE DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 Received: from [68.142.206.239] ([68.142.206.239:25345] helo=smtp106.plus.mail.mud.yahoo.com) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id 00/D3-20288-BCD14254 for ; Wed, 04 Oct 2006 13:47:07 -0700 Received: (qmail 95101 invoked from network); 4 Oct 2006 16:53:12 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:Mime-Version:In-Reply-To:References:Content-Type:Message-Id:From:Subject:Date:To:X-Mailer; b=yavDONmM8qd28w9GUxnfrLjSkgymc2boscaT714kGDjhTcSNVEyEFErCv+0A3UPP8YKX/xA2J0h2M4TEe5M1tC8KQ8T8aONfQz3NAyen7UHzol0yCR2SrmBqu2zBuE6/b9QsMe6dP7uUPY+LZNBd5hPy29C/Ius6iQKKqjofhQQ= ; Received: from unknown (HELO ?10.11.55.38?) (david?jencks@63.105.20.225 with plain) by smtp106.plus.mail.mud.yahoo.com with SMTP; 4 Oct 2006 16:53:12 -0000 Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <578ADDE9-D608-4023-B259-3342CA7A5882@gmail.com> References: <578ADDE9-D608-4023-B259-3342CA7A5882@gmail.com> Content-Type: multipart/alternative; boundary=Apple-Mail-10--862529953 Message-Id: <2D1FED1B-F73C-462B-837E-208266AAA004@yahoo.com> From: David Jencks Subject: Re: How do I get the configID from deploymentPlan? Date: Wed, 4 Oct 2006 09:53:00 -0700 To: dev@geronimo.apache.org X-Mailer: Apple Mail (2.752.2) X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --Apple-Mail-10--862529953 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed 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 > > --Apple-Mail-10--862529953 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1
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 =3D = 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...=A0 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 =3D = null;
=A0 =A0 =A0=A0 =A0=A0 =A0ConfigurationBuilder builder =3D = null;
=A0 =A0 =A0 =A0 =A0 =A0 for (Iterator i =3D = builders.iterator(); i.hasNext();) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 ConfigurationBuilder candidate =3D (ConfigurationBuilder) = i.next();
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = System.out.println("***********" + = candidate.getClass().getName());
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= plan =3D candidate.getDeploymentPlan(planFile, module, = idBuilder);
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (plan !=3D = null) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 builder =3D = candidate;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = break;
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
=A0 =A0 =A0 = =A0 =A0 =A0 }
=A0 =A0 =A0 =A0 =A0 =A0 if (builder =3D=3D null) = {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 throw new = DeploymentException("Cannot deploy the requested application module = because no deployer is able to handle it. " +
=A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 " 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" +
=A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 " EJB module on a minimal Geronimo server that = does not have EJB support installed.=A0 (" +
=A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 (planFile =3D=3D null ? "" : "planFile=3D" = + planFile.getAbsolutePath()) +
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 (moduleFile =3D=3D null ? "" : (planFile =3D=3D null ? = "" : ", ") + "moduleFile=3D" + moduleFile.getAbsolutePath()) + = ")");
=A0 =A0 =A0 =A0 =A0 =A0 }

=A0 =A0 =A0 =A0 =A0 =A0 = Artifact configID =3D builder.getConfigurationID(plan, module, = idBuilder);

Thanks

That code's from = Deployer which doesn't know anything about xml or plans or anything like = that.=A0 All the ConfigBuilders and ModuleBuilders have code that = extracts the Enviroment element, typicaly like

=A0 =A0 =A0=A0 = =A0EnvironmentType environmentType =3D = gerConnector.getEnvironment();
=A0 =A0 =A0 =A0 Environment = environment =3D EnvironmentBuilder.buildEnvironment(environmentType, = defaultEnvironment);


However you may find it = easier to do something more generic like
QNameSet ENV_QNAMESET = =3D EnvironementDocument.type.getDocumentElementQName();

....

XmlObject untypedEnv =3D = plan.selectChildren(ENV_QNAMESET);
EnvironmentType env =3D = (EnvironmentType)untypedEnv.changeType(EnvironmentType.type);
Sometimes it's hard to = convince xmlbeans to change the type correctly, you get null out of = changeType.=A0 In that case I use

env =3D = (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.=A0 It's possible to get around this.... = but if changeType works without copying do that.

thanks
david = jencks


=


= --Apple-Mail-10--862529953--