struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: Camel Case Package Names
Date Sat, 08 Sep 2012 13:36:19 GMT

in the interest of keeping both implementations (Windows and Nix) happy I refactor all namespace
and package names to lowercase

I encountered the same problem last year with using the xsd->java xjc driver to create
Java (package) class Names with CamelCase XSD elements...ugh!

i was able to get this to work..notice the classname can be camelcase but the namespace is
always lowercase:

<?xml version='1.0' encoding='UTF-8' ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/"
targetNamespace="http://schemas.xmlsoap.org/soap/envelope/" > 
  <!-- Envelope, header and body -->
  <!-- xs:element name="Envelope" type="tns:Envelope" / -->
  <xs:complexType name="ComplexHeader">
    <xs:sequence>
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"
/>
    </xs:sequence>
    <!-- xs:anyAttribute namespace="##other" processContents="lax" / -->
  </xs:complexType>
 <xs:element name="Header" type="tns:ComplexHeader" />  
  
  <xs:complexType name="ComplexBody" >
    <xs:sequence>
      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"
/>
    </xs:sequence>
    <!-- xs:anyAttribute namespace="##any" processContents="lax"  -->
      <!-- xs:annotation -->
            <!-- xs:documentation -->
          <!-- Prose in the spec does not specify that attributes are allowed on the Body
element -->
        <!-- /xs:documentation -->
      <!-- /xs:annotation -->
    <!-- /xs:anyAttribute -->
  </xs:complexType>
  <xs:element name="Body" type="tns:ComplexBody" />
  
  <xs:complexType name="Envelope" >
    <xs:sequence>
      <xs:element ref="tns:Header" minOccurs="0" />
      <!-- xs:element ref="Header" minOccurs="0" / -->
      <xs:element ref="tns:Body" minOccurs="1" />
      <!-- xs:element ref="Body" minOccurs="1" / -->
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"
/>
    </xs:sequence>
    <!-- xs:anyAttribute namespace="##other" processContents="lax" / -->
  </xs:complexType>
       
  <!-- Global Attributes.  The following attributes are intended to be usable via qualified
attribute names on any complex type referencing them.  -->
  <xs:attribute name="mustUnderstand" >    
     <xs:simpleType>
     <xs:restriction base='xs:boolean'>
       <xs:pattern value='0|1' />
     </xs:restriction>
   </xs:simpleType>
  </xs:attribute>
  <xs:attribute name="actor" type="xs:anyURI" />

  <xs:simpleType name="encodingStyle" >
    <xs:annotation>
      <xs:documentation>
        'encodingStyle' indicates any canonicalization conventions followed in the contents
of the containing element.  For example, the value 'http://schemas.xmlsoap.org/soap/encoding/'
indicates the pattern described in SOAP specification
      </xs:documentation>
    </xs:annotation>
    <xs:list itemType="xs:anyURI" />
  </xs:simpleType>

  <xs:attribute name="encodingStyle" type="tns:encodingStyle" />
  <xs:attributeGroup name="encodingStyle" >
    <xs:attribute ref="tns:encodingStyle" />
  </xs:attributeGroup>

  <!-- xs:complexType name="Fault" final="extension"  -->
  <xs:complexType name="ComplexFault">
    <xs:annotation><xs:documentation>Fault reporting structure</xs:documentation></xs:annotation>
    <xs:sequence><xs:element name="faultcode" type="xs:QName" /><xs:element
name="faultstring" type="xs:string" /><xs:element name="faultactor" type="xs:anyURI"
minOccurs="0" /><xs:element name="detail" type="tns:detail" minOccurs="0" /></xs:sequence>
  </xs:complexType>
  <xs:element name="Fault" type="tns:ComplexFault" />

  <xs:complexType name="detail">
    <xs:sequence>
      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"
/>
    </xs:sequence>
    <!-- xs:anyAttribute namespace="##any" processContents="lax" / -->
  </xs:complexType>
</xs:schema>

#test harness
#!/usr/bin/sh
set $AXIS2_HOME=
export AXIS2_HOME=/Axis/axis2-1.6.2
cd /Axis/axis2-1.6.2/modules/jaxws-integration
#remove everything in the server work folder
rm /Axis/axis2-1.6.2/modules/jaxws-integration/target/generated-sources/axis2/wsdl2code/src/server/*
mkdir /Axis/axis2-1.6.2/modules/jaxws-integration/test-resources/src
set $CLASSPATH=
java com.sun.tools.xjc.Driver -d /Axis/axis2-1.6.2/modules/JAXWS-~1/test-resources/src /Axis/axis2-1.6.2/modules/JAXWS-~1/test-resources/wsdl/soap11.xsd

interestingly enough if you run CXF WSDL->java class generation tool this camelcase in
packagename anomaly produces NPE 

Merci Bruno,
Martin 
______________________________________________ 
Note de déni et de confidentialité
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.


> Date: Sat, 8 Sep 2012 10:07:48 -0300
> Subject: Re: Camel Case Package Names
> From: bruno.borges@gmail.com
> To: user@struts.apache.org
> 
> From what I recall, they are allowed. It's just that under Windows, the
> mess occurs... unless you are not running Windows, then I have no idea why
> is that happening
> On Sep 8, 2012 9:03 AM, "Martin Gainty" <mgainty@hotmail.com> wrote:
> 
> >
> > Landing in NY with 6 hours before my next flight out i decided to finish
> > off compiling and packaging the latest and greatest SAAS re-factoring
> > I encounter this bit of package-name nastiness?
> >
> > Number of foreign imports: 1
> > import: Entry[import  from realm
> > ClassRealm[project>org.apache.axis2:axis2.eclipse.codegen.plugin:1.6.2,
> > parent: ClassRealm[maven.api, parent: null]]]
> > -----------------------------------------------------
> >         at
> > org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:470)
> >         at
> > org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:98)
> >         ... 20 more
> > Caused by: java.lang.NoClassDefFoundError: aQute/libg/reporter/Reporter
> > i pull down the aqute library and start to compile here are the package
> > names
> > package aQute.libg.reporter;
> >
> > I found this post from struts-user
> >
> > http://grokbase.com/p/struts/user/117b44gfqr/how-to-display-data-from-database-to-jsp-page-in-struts2
> >
> > The query from Dale Newfield says the package name I am compiling is
> > camelcase and he is experiencing difficulty
> > respondent Dave Newton said Ive seen it once in a while but majority of
> > package names are always lowercase
> >
> > I cannot get my Java 1_6.0.16 compiler to compile camelcase package names
> > Are camelcase packagenames allowed in Java?
> > If so what version of  Java do i use and which parameters do I use in that
> > javac invocation to allow camelcase packagenames in a Java Compile?
> >
> > Thanks!
> > Martin
> >
> > ----------------------------------------------------------------------------------------------------------------------
> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> >
> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> > dient lediglich dem Austausch von Informationen und entfaltet keine
> > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> > destinataire prévu, nous te demandons avec bonté que pour satisfaire
> > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> > de ceci est interdite. Ce message sert à l'information seulement et n'aura
> > pas n'importe quel effet légalement obligatoire. Étant donné que les email
> > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> > aucune responsabilité pour le contenu fourni.
> >
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message