You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Murtaza Goga <Mu...@trisyngroup.com> on 2007/08/14 15:35:56 UTC
XSD2JavaGenerator
We are attempting to migrate to the current release (1.0 incubating) and
we are running into an issue with the static code generator. The init
operation in the factory implementation does not compile, the generated
code uses the fully qualified package name as a variable name.
The options going into the generator:
-schemaNamespace all -namespaceInfo.properties Concrete_Schema.xsd
The relevant files:
namespaceInfo.properties
urn:mycompany.com/base;com.mycompany.base.dto
urn:mycompany.com/concrete;com.mycompany.concrete.dto
Base_Schema.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
targetNamespace="urn:mycompany.com/base"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:base="urn:mycompany.com/base">
<xsd:element
name="letters"
type="base:FormLetter" />
<xsd:complexType
name="FormLetter"
mixed="true">
<xsd:sequence>
<xsd:element
name="date"
minOccurs="0"
type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Concrete_Schema.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
targetNamespace="urn:mycompany.com/concrete"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:base="urn:mycompany.com/base"
xmlns:concrete="urn:mycompany.com/concrete">
<xsd:import
namespace="urn:mycompany.com/base"
schemaLocation="Base_Schema.xsd" />
<xsd:complexType name="ExtendedFormLetter">
<xsd:complexContent>
<xsd:extension base="base:FormLetter">
<xsd:sequence>
<xsd:element
name="contents"
type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
The generatae
public static DtoFactoryImpl init()
{
...
// Initialize dependent packages
Compile error below:
com.mycompany.base.dto.DtoFactory
com.mycompany.base.dto.DtoFactoryInstance =
com.mycompany.base.dto.DtoFactory.INSTANCE;
...
}
Any workarounds would be greatly appreciated.
Thanks,
Murtaza.
RE: XSD2JavaGenerator
Posted by Murtaza Goga <Mu...@trisyngroup.com>.
This is a good workaround. Thanks.
-----Original Message-----
From: Frank Budinsky [mailto:frankb@ca.ibm.com]
Sent: Tuesday, August 14, 2007 10:18 AM
To: tuscany-user@ws.apache.org
Subject: Re: XSD2JavaGenerator
Hi Murtaza,
This is a known generator bug. See
https://issues.apache.org/jira/browse/TUSCANY-1505
The problem only occurs if you have two factories with the same name.
The
factory name, by default, is created using the last part of the package
name, so since in your case both your packages end with ".dto" you have
two factories named "DtoFactory", which then invokes the bug in the
generator.
One workaround would be to explicitly override one or both of the
factory
prefixes in your namespaceInfo.properties file:
urn:mycompany.com/base;com.mycompany.base.dto;Base
urn:mycompany.com/concrete;com.mycompany.concrete.dto;Concrete
This will name the factories BaseFactory and ConcreteFactory, instead of
both being named DtoFactory (which I think is preferable anyway), and
will
then avoid the above generator bug.
Frank
"Murtaza Goga" <Mu...@trisyngroup.com> wrote on 08/14/2007
09:35:56
AM:
> We are attempting to migrate to the current release (1.0 incubating)
and
> we are running into an issue with the static code generator. The init
> operation in the factory implementation does not compile, the
generated
> code uses the fully qualified package name as a variable name.
>
>
>
> The options going into the generator:
>
> -schemaNamespace all -namespaceInfo.properties Concrete_Schema.xsd
>
>
>
> The relevant files:
>
>
>
> namespaceInfo.properties
>
> urn:mycompany.com/base;com.mycompany.base.dto
>
> urn:mycompany.com/concrete;com.mycompany.concrete.dto
>
>
>
>
>
> Base_Schema.xsd
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xsd:schema
>
> targetNamespace="urn:mycompany.com/base"
>
> elementFormDefault="qualified"
>
> attributeFormDefault="unqualified"
>
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> xmlns:base="urn:mycompany.com/base">
>
>
>
> <xsd:element
>
> name="letters"
>
> type="base:FormLetter" />
>
>
>
> <xsd:complexType
>
> name="FormLetter"
>
> mixed="true">
>
> <xsd:sequence>
>
> <xsd:element
>
> name="date"
>
> minOccurs="0"
>
> type="xsd:string" />
>
> </xsd:sequence>
>
> </xsd:complexType>
>
>
>
> </xsd:schema>
>
>
>
> Concrete_Schema.xsd
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xsd:schema
>
> targetNamespace="urn:mycompany.com/concrete"
>
> elementFormDefault="qualified"
>
> attributeFormDefault="unqualified"
>
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> xmlns:base="urn:mycompany.com/base"
>
> xmlns:concrete="urn:mycompany.com/concrete">
>
>
>
> <xsd:import
>
> namespace="urn:mycompany.com/base"
>
> schemaLocation="Base_Schema.xsd" />
>
>
>
> <xsd:complexType name="ExtendedFormLetter">
>
> <xsd:complexContent>
>
> <xsd:extension base="base:FormLetter">
>
> <xsd:sequence>
>
> <xsd:element
>
> name="contents"
>
> type="xsd:string">
>
> </xsd:element>
>
> </xsd:sequence>
>
> </xsd:extension>
>
> </xsd:complexContent>
>
> </xsd:complexType>
>
>
>
> </xsd:schema>
>
>
>
> The generatae
>
> public static DtoFactoryImpl init()
>
> {
>
> ...
>
> // Initialize dependent packages
>
> Compile error below:
>
> com.mycompany.base.dto.DtoFactory
> com.mycompany.base.dto.DtoFactoryInstance =
> com.mycompany.base.dto.DtoFactory.INSTANCE;
>
> ...
>
> }
>
>
>
>
>
> Any workarounds would be greatly appreciated.
>
> Thanks,
>
> Murtaza.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
RE: XSD2JavaGenerator
Posted by Murtaza Goga <Mu...@trisyngroup.com>.
Thanks. It is the exact same issue.
-----Original Message-----
From: Fuhwei Lwo [mailto:fuhwei@bricemedia.com]
Sent: Tuesday, August 14, 2007 9:54 AM
To: tuscany-user@ws.apache.org
Subject: Re: XSD2JavaGenerator
Your problem seems like T-1505 at
https://issues.apache.org/jira/browse/TUSCANY-1505
Let me ask David, the JIRA reporter, about the possible solution.
Murtaza Goga <Mu...@trisyngroup.com> wrote: We are attempting to
migrate to the current release (1.0 incubating) and
we are running into an issue with the static code generator. The init
operation in the factory implementation does not compile, the generated
code uses the fully qualified package name as a variable name.
The options going into the generator:
-schemaNamespace all -namespaceInfo.properties Concrete_Schema.xsd
The relevant files:
namespaceInfo.properties
urn:mycompany.com/base;com.mycompany.base.dto
urn:mycompany.com/concrete;com.mycompany.concrete.dto
Base_Schema.xsd
targetNamespace="urn:mycompany.com/base"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:base="urn:mycompany.com/base">
name="letters"
type="base:FormLetter" />
name="FormLetter"
mixed="true">
name="date"
minOccurs="0"
type="xsd:string" />
Concrete_Schema.xsd
targetNamespace="urn:mycompany.com/concrete"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:base="urn:mycompany.com/base"
xmlns:concrete="urn:mycompany.com/concrete">
namespace="urn:mycompany.com/base"
schemaLocation="Base_Schema.xsd" />
name="contents"
type="xsd:string">
The generatae
public static DtoFactoryImpl init()
{
...
// Initialize dependent packages
Compile error below:
com.mycompany.base.dto.DtoFactory
com.mycompany.base.dto.DtoFactoryInstance =
com.mycompany.base.dto.DtoFactory.INSTANCE;
...
}
Any workarounds would be greatly appreciated.
Thanks,
Murtaza.
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org
Re: XSD2JavaGenerator
Posted by Fuhwei Lwo <fu...@bricemedia.com>.
Your problem seems like T-1505 at https://issues.apache.org/jira/browse/TUSCANY-1505
Let me ask David, the JIRA reporter, about the possible solution.
Murtaza Goga <Mu...@trisyngroup.com> wrote: We are attempting to migrate to the current release (1.0 incubating) and
we are running into an issue with the static code generator. The init
operation in the factory implementation does not compile, the generated
code uses the fully qualified package name as a variable name.
The options going into the generator:
-schemaNamespace all -namespaceInfo.properties Concrete_Schema.xsd
The relevant files:
namespaceInfo.properties
urn:mycompany.com/base;com.mycompany.base.dto
urn:mycompany.com/concrete;com.mycompany.concrete.dto
Base_Schema.xsd
targetNamespace="urn:mycompany.com/base"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:base="urn:mycompany.com/base">
name="letters"
type="base:FormLetter" />
name="FormLetter"
mixed="true">
name="date"
minOccurs="0"
type="xsd:string" />
Concrete_Schema.xsd
targetNamespace="urn:mycompany.com/concrete"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:base="urn:mycompany.com/base"
xmlns:concrete="urn:mycompany.com/concrete">
namespace="urn:mycompany.com/base"
schemaLocation="Base_Schema.xsd" />
name="contents"
type="xsd:string">
The generatae
public static DtoFactoryImpl init()
{
...
// Initialize dependent packages
Compile error below:
com.mycompany.base.dto.DtoFactory
com.mycompany.base.dto.DtoFactoryInstance =
com.mycompany.base.dto.DtoFactory.INSTANCE;
...
}
Any workarounds would be greatly appreciated.
Thanks,
Murtaza.
Re: XSD2JavaGenerator
Posted by Frank Budinsky <fr...@ca.ibm.com>.
Hi Murtaza,
This is a known generator bug. See
https://issues.apache.org/jira/browse/TUSCANY-1505
The problem only occurs if you have two factories with the same name. The
factory name, by default, is created using the last part of the package
name, so since in your case both your packages end with ".dto" you have
two factories named "DtoFactory", which then invokes the bug in the
generator.
One workaround would be to explicitly override one or both of the factory
prefixes in your namespaceInfo.properties file:
urn:mycompany.com/base;com.mycompany.base.dto;Base
urn:mycompany.com/concrete;com.mycompany.concrete.dto;Concrete
This will name the factories BaseFactory and ConcreteFactory, instead of
both being named DtoFactory (which I think is preferable anyway), and will
then avoid the above generator bug.
Frank
"Murtaza Goga" <Mu...@trisyngroup.com> wrote on 08/14/2007 09:35:56
AM:
> We are attempting to migrate to the current release (1.0 incubating) and
> we are running into an issue with the static code generator. The init
> operation in the factory implementation does not compile, the generated
> code uses the fully qualified package name as a variable name.
>
>
>
> The options going into the generator:
>
> -schemaNamespace all -namespaceInfo.properties Concrete_Schema.xsd
>
>
>
> The relevant files:
>
>
>
> namespaceInfo.properties
>
> urn:mycompany.com/base;com.mycompany.base.dto
>
> urn:mycompany.com/concrete;com.mycompany.concrete.dto
>
>
>
>
>
> Base_Schema.xsd
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xsd:schema
>
> targetNamespace="urn:mycompany.com/base"
>
> elementFormDefault="qualified"
>
> attributeFormDefault="unqualified"
>
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> xmlns:base="urn:mycompany.com/base">
>
>
>
> <xsd:element
>
> name="letters"
>
> type="base:FormLetter" />
>
>
>
> <xsd:complexType
>
> name="FormLetter"
>
> mixed="true">
>
> <xsd:sequence>
>
> <xsd:element
>
> name="date"
>
> minOccurs="0"
>
> type="xsd:string" />
>
> </xsd:sequence>
>
> </xsd:complexType>
>
>
>
> </xsd:schema>
>
>
>
> Concrete_Schema.xsd
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xsd:schema
>
> targetNamespace="urn:mycompany.com/concrete"
>
> elementFormDefault="qualified"
>
> attributeFormDefault="unqualified"
>
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> xmlns:base="urn:mycompany.com/base"
>
> xmlns:concrete="urn:mycompany.com/concrete">
>
>
>
> <xsd:import
>
> namespace="urn:mycompany.com/base"
>
> schemaLocation="Base_Schema.xsd" />
>
>
>
> <xsd:complexType name="ExtendedFormLetter">
>
> <xsd:complexContent>
>
> <xsd:extension base="base:FormLetter">
>
> <xsd:sequence>
>
> <xsd:element
>
> name="contents"
>
> type="xsd:string">
>
> </xsd:element>
>
> </xsd:sequence>
>
> </xsd:extension>
>
> </xsd:complexContent>
>
> </xsd:complexType>
>
>
>
> </xsd:schema>
>
>
>
> The generatae
>
> public static DtoFactoryImpl init()
>
> {
>
> ...
>
> // Initialize dependent packages
>
> Compile error below:
>
> com.mycompany.base.dto.DtoFactory
> com.mycompany.base.dto.DtoFactoryInstance =
> com.mycompany.base.dto.DtoFactory.INSTANCE;
>
> ...
>
> }
>
>
>
>
>
> Any workarounds would be greatly appreciated.
>
> Thanks,
>
> Murtaza.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org