Update of 
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/lookup/resources
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28645/xdoclet/modules/ejb/src/xdoclet/modules/ejb/lookup/resources

Modified Files:
        lookup.xdt 
Log Message:
Patch from XDT-1414 by Tyler Ward. 
Don't nail the destination-type to Queue, but take it from @ejb.bean tag.

Index: lookup.xdt
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/ejb/src/xdoclet/modules/ejb/lookup/resources/lookup.xdt,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** lookup.xdt  26 Mar 2005 10:31:30 -0000      1.14
--- lookup.xdt  28 May 2005 11:05:24 -0000      1.15
***************
*** 23,29 ****
    <XDtEjbMdb:ifMessageDriven>
     /** <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_cached_queue"/> */
!    private static javax.jms.Queue cachedQueue = null;
     /** <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_cached_connection_factory"/> */
!    private static javax.jms.QueueConnectionFactory cachedConnectionFactory = 
null;
     </XDtEjbMdb:ifMessageDriven>
   </XDtConfig:ifConfigParamEquals>
--- 23,29 ----
    <XDtEjbMdb:ifMessageDriven>
     /** <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_cached_queue"/> */
!    private static <XDtClass:classTagValue tagName="ejb:bean" 
paramName="destination-type"/> cachedQueue = null;
     /** <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_cached_connection_factory"/> */
!    private static <XDtClass:classTagValue tagName="ejb:bean" 
paramName="destination-type"/>ConnectionFactory cachedConnectionFactory = null;
     </XDtEjbMdb:ifMessageDriven>
   </XDtConfig:ifConfigParamEquals>
***************
*** 37,52 ****
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="queue_for" 
arguments="<XDtEjb:ejbName/>"/> <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static javax.jms.Queue getQueue() throws 
javax.naming.NamingException
     {
        <XDtConfig:ifConfigParamEquals paramName="cacheHomes" value="true">
        if (cachedQueue == null) {
!          // <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_obtain_ic"/>
!          javax.naming.InitialContext initialContext = new 
javax.naming.InitialContext();
!          try {
!             java.lang.Object objRef = 
initialContext.lookup(DESTINATION_JNDI_NAME);
!             cachedQueue = (javax.jms.Queue) objRef;
!          } finally {
!             initialContext.close();
!          }
        }
        return cachedQueue;
--- 37,45 ----
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="queue_for" 
arguments="<XDtEjb:ejbName/>"/> <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static <XDtConfig:ifConfigParamEquals paramName="cacheHomes" 
value="true">synchronized</XDtConfig:ifConfigParamEquals> 
<XDtClass:classTagValue tagName="ejb:bean" paramName="destination-type"/> 
getQueue() throws javax.naming.NamingException
     {
        <XDtConfig:ifConfigParamEquals paramName="cacheHomes" value="true">
        if (cachedQueue == null) {
!             cachedQueue = getQueue(null);
        }
        return cachedQueue;
***************
*** 54,64 ****
        <XDtConfig:ifConfigParamNotEquals paramName="cacheHomes" value="true">
        // <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_obtain_ic"/>
!       javax.naming.InitialContext initialContext = new 
javax.naming.InitialContext();
!       try {
!          java.lang.Object objRef = 
initialContext.lookup(DESTINATION_JNDI_NAME);
!          return (javax.jms.Queue) objRef;
!       } finally {
!          initialContext.close();
!       }
        </XDtConfig:ifConfigParamNotEquals>
     }
--- 47,51 ----
        <XDtConfig:ifConfigParamNotEquals paramName="cacheHomes" value="true">
        // <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_obtain_ic"/>
!         return getQueue(null);
        </XDtConfig:ifConfigParamNotEquals>
     }
***************
*** 69,79 ****
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="queue_for" 
arguments="<XDtEjb:ejbName/>"/> <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static javax.jms.Queue getQueue( java.util.Hashtable environment ) 
throws javax.naming.NamingException
     {
        // <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_obtain_ic"/>
        javax.naming.InitialContext initialContext = new 
javax.naming.InitialContext(environment);
        try {
!          java.lang.Object objRef = 
initialContext.lookup(DESTINATION_JNDI_NAME);
!          return (javax.jms.Queue) objRef;
        } finally {
           initialContext.close();
--- 56,66 ----
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="queue_for" 
arguments="<XDtEjb:ejbName/>"/> <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static <XDtClass:classTagValue tagName="ejb:bean" 
paramName="destination-type"/> getQueue( final java.util.Hashtable environment 
) throws javax.naming.NamingException
     {
        // <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_obtain_ic"/>
        javax.naming.InitialContext initialContext = new 
javax.naming.InitialContext(environment);
        try {
!          final java.lang.Object objRef = 
initialContext.lookup(DESTINATION_JNDI_NAME);
!          return (<XDtClass:classTagValue tagName="ejb:bean" 
paramName="destination-type"/>) objRef;
        } finally {
           initialContext.close();
***************
*** 85,112 ****
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="connection_factory_for" arguments="<XDtEjb:ejbName/>"/> 
<XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static javax.jms.QueueConnection getQueueConnection() throws 
javax.naming.NamingException, javax.jms.JMSException
     {
        <XDtConfig:ifConfigParamEquals paramName="cacheHomes" value="true">
        if (cachedConnectionFactory == null) {
           // <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_obtain_ic"/>
!          javax.naming.InitialContext initialContext = new 
javax.naming.InitialContext();
           try {
!             java.lang.Object objRef = 
initialContext.lookup(CONNECTION_FACTORY_JNDI_NAME);
!             cachedConnectionFactory = (javax.jms.QueueConnectionFactory) 
objRef;
           } finally {
              initialContext.close();
           }
        }
!       return cachedConnectionFactory.createQueueConnection();
        </XDtConfig:ifConfigParamEquals>
        <XDtConfig:ifConfigParamNotEquals paramName="cacheHomes" value="true">
!       // <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_obtain_ic"/>
!       javax.naming.InitialContext initialContext = new 
javax.naming.InitialContext();
!       try {
!          java.lang.Object objRef = 
initialContext.lookup(CONNECTION_FACTORY_JNDI_NAME);
!          return ((javax.jms.QueueConnectionFactory) 
objRef).createQueueConnection();
!       } finally {
!          initialContext.close();
!       }
        </XDtConfig:ifConfigParamNotEquals>
     }
--- 72,94 ----
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="connection_factory_for" arguments="<XDtEjb:ejbName/>"/> 
<XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static <XDtConfig:ifConfigParamEquals paramName="cacheHomes" 
value="true">synchronized</XDtConfig:ifConfigParamEquals> 
<XDtClass:classTagValue tagName="ejb:bean" 
paramName="destination-type"/>Connection getQueueConnection() throws 
javax.naming.NamingException, javax.jms.JMSException
     {
        <XDtConfig:ifConfigParamEquals paramName="cacheHomes" value="true">
        if (cachedConnectionFactory == null) {
           // <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_obtain_ic"/>
!          final javax.naming.InitialContext initialContext = new 
javax.naming.InitialContext();
           try {
!             final java.lang.Object objRef = 
initialContext.lookup(CONNECTION_FACTORY_JNDI_NAME);
!             cachedConnectionFactory = (<XDtClass:classTagValue 
tagName="ejb:bean" paramName="destination-type"/>ConnectionFactory) objRef;
           } finally {
              initialContext.close();
           }
        }
! 
!       final <XDtClass:classTagValue tagName="ejb:bean" 
paramName="destination-type"/>Connection connection = (<XDtClass:classTagValue 
tagName="ejb:bean" paramName="destination-type"/>Connection) 
cachedConnectionFactory.createConnection();
!       return connection;
        </XDtConfig:ifConfigParamEquals>
        <XDtConfig:ifConfigParamNotEquals paramName="cacheHomes" value="true">
!       return getQueueConnection(null);
        </XDtConfig:ifConfigParamNotEquals>
     }
***************
*** 117,127 ****
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="connection_factory_for" arguments="<XDtEjb:ejbName/>"/> 
<XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static javax.jms.QueueConnection getQueueConnection( 
java.util.Hashtable environment ) throws javax.naming.NamingException, 
javax.jms.JMSException
     {
        // <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_obtain_ic"/>
!       javax.naming.InitialContext initialContext = new 
javax.naming.InitialContext(environment);
        try {
!          java.lang.Object objRef = 
initialContext.lookup(CONNECTION_FACTORY_JNDI_NAME);
!          return ((javax.jms.QueueConnectionFactory) 
objRef).createQueueConnection();
        } finally {
           initialContext.close();
--- 99,111 ----
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="connection_factory_for" arguments="<XDtEjb:ejbName/>"/> 
<XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static <XDtClass:classTagValue tagName="ejb:bean" 
paramName="destination-type"/>Connection getQueueConnection( final 
java.util.Hashtable environment ) throws javax.naming.NamingException, 
javax.jms.JMSException
     {
        // <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_obtain_ic"/>
!       final javax.naming.InitialContext initialContext = new 
javax.naming.InitialContext(environment);
        try {
!          final java.lang.Object objRef = 
initialContext.lookup(CONNECTION_FACTORY_JNDI_NAME);
!          final <XDtClass:classTagValue tagName="ejb:bean" 
paramName="destination-type"/>ConnectionFactory factory = 
(<XDtClass:classTagValue tagName="ejb:bean" 
paramName="destination-type"/>ConnectionFactory) objRef;
!          final <XDtClass:classTagValue tagName="ejb:bean" 
paramName="destination-type"/>Connection connection = (<XDtClass:classTagValue 
tagName="ejb:bean" paramName="destination-type"/>Connection) 
factory.createConnection();
!         return connection;
        } finally {
           initialContext.close();
***************
*** 131,139 ****
  
     <XDtEjbMdb:ifNotMessageDriven>
!    private static Object lookupHome(java.util.Hashtable environment, String 
jndiName, Class narrowTo) throws javax.naming.NamingException {
        // Obtain initial context
!       javax.naming.InitialContext initialContext = new 
javax.naming.InitialContext(environment);
        try {
!          Object objRef = initialContext.lookup(jndiName);
           // only narrow if necessary
           if (java.rmi.Remote.class.isAssignableFrom(narrowTo))
--- 115,123 ----
  
     <XDtEjbMdb:ifNotMessageDriven>
!    private static Object lookupHome( final java.util.Hashtable environment, 
final String jndiName, final Class narrowTo) throws 
javax.naming.NamingException {
        // Obtain initial context
!       final javax.naming.InitialContext initialContext = new 
javax.naming.InitialContext(environment);
        try {
!          final Object objRef = initialContext.lookup(jndiName);
           // only narrow if necessary
           if (java.rmi.Remote.class.isAssignableFrom(narrowTo))
***************
*** 153,157 ****
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="home_interface_for" arguments="<XDtEjb:ejbName/>"/> 
<XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static <XDtEjbHome:homeInterface type="remote"/> getHome() throws 
javax.naming.NamingException
     {
        <XDtConfig:ifConfigParamEquals paramName="cacheHomes" value="true">
--- 137,141 ----
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="home_interface_for" arguments="<XDtEjb:ejbName/>"/> 
<XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static <XDtConfig:ifConfigParamEquals paramName="cacheHomes" 
value="true">synchronized</XDtConfig:ifConfigParamEquals> 
<XDtEjbHome:homeInterface type="remote"/> getHome() throws 
javax.naming.NamingException
     {
        <XDtConfig:ifConfigParamEquals paramName="cacheHomes" value="true">
***************
*** 171,175 ****
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="home_interface_for" arguments="<XDtEjb:ejbName/>"/> 
<XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static <XDtEjbHome:homeInterface type="remote"/> getHome( 
java.util.Hashtable environment ) throws javax.naming.NamingException
     {
         return (<XDtEjbHome:homeInterface type="remote"/>) 
lookupHome(environment, <XDtEjbHome:homeInterface 
type="remote"/>.<XDtEjbUtilObj:lookupKind/>, <XDtEjbHome:homeInterface 
type="remote"/>.class);
--- 155,159 ----
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="home_interface_for" arguments="<XDtEjb:ejbName/>"/> 
<XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static <XDtEjbHome:homeInterface type="remote"/> getHome( final 
java.util.Hashtable environment ) throws javax.naming.NamingException
     {
         return (<XDtEjbHome:homeInterface type="remote"/>) 
lookupHome(environment, <XDtEjbHome:homeInterface 
type="remote"/>.<XDtEjbUtilObj:lookupKind/>, <XDtEjbHome:homeInterface 
type="remote"/>.class);
***************
*** 182,186 ****
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="local_home_interface_for" arguments="<XDtEjb:ejbName/>"/> 
<XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static <XDtEjbHome:homeInterface type="local"/> getLocalHome() 
throws javax.naming.NamingException
     {
        <XDtConfig:ifConfigParamEquals paramName="cacheHomes" value="true">
--- 166,170 ----
      * @return <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="local_home_interface_for" arguments="<XDtEjb:ejbName/>"/> 
<XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_lookup_using" arguments="<XDtEjbUtilObj:lookupKind/>"/>
      */
!    public static <XDtConfig:ifConfigParamEquals paramName="cacheHomes" 
value="true">synchronized</XDtConfig:ifConfigParamEquals> 
<XDtEjbHome:homeInterface type="local"/> getLocalHome() throws 
javax.naming.NamingException
     {
        <XDtConfig:ifConfigParamEquals paramName="cacheHomes" value="true">
***************
*** 214,222 ****
      * <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_guid_usage"/>
      */
!    public static final String generateGUID(Object o) {
!        StringBuffer tmpBuffer = new StringBuffer(16);
     
         if (hexServerIP == null) {
!            java.net.InetAddress localInetAddress = null;
             try {
                 // <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_guid_localinetaddress"/>
--- 198,206 ----
      * <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_guid_usage"/>
      */
!    public static synchronized final String generateGUID(final Object o) {
!        final StringBuffer tmpBuffer = new StringBuffer(16);
     
         if (hexServerIP == null) {
!            final java.net.InetAddress localInetAddress;
             try {
                 // <XDtI18n:getString 
bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" 
resource="util_guid_localinetaddress"/>
***************
*** 230,246 ****
                 return null;
             }
!            byte serverIP[] = localInetAddress.getAddress();
             hexServerIP = hexFormat(getInt(serverIP), 8);
         }
  
!        String hashcode = hexFormat(System.identityHashCode(o), 8);
         tmpBuffer.append(hexServerIP);
         tmpBuffer.append(hashcode);
  
!        long timeNow      = System.currentTimeMillis();
!        int timeLow       = (int)timeNow & 0xFFFFFFFF;
!        int node          = seeder.nextInt();
  
!        StringBuffer guid = new StringBuffer(32);
         guid.append(hexFormat(timeLow, 8));
         guid.append(tmpBuffer.toString());
--- 214,230 ----
                 return null;
             }
!            final byte serverIP[] = localInetAddress.getAddress();
             hexServerIP = hexFormat(getInt(serverIP), 8);
         }
  
!        final String hashcode = hexFormat(System.identityHashCode(o), 8);
         tmpBuffer.append(hexServerIP);
         tmpBuffer.append(hashcode);
  
!        final long timeNow      = System.currentTimeMillis();
!        final int timeLow       = (int)timeNow & 0xFFFFFFFF;
!        final int node          = seeder.nextInt();
  
!        final StringBuffer guid = new StringBuffer(32);
         guid.append(hexFormat(timeLow, 8));
         guid.append(tmpBuffer.toString());
***************
*** 253,257 ****
         int j = 24;
         for (int k = 0; j >= 0; k++) {
!            int l = bytes[k] & 0xff;
             i += l << j;
             j -= 8;
--- 237,241 ----
         int j = 24;
         for (int k = 0; j >= 0; k++) {
!            final int l = bytes[k] & 0xff;
             i += l << j;
             j -= 8;
***************
*** 260,270 ****
     }
  
!    private static String hexFormat(int i, int j) {
!        String s = Integer.toHexString(i);
         return padHex(s, j) + s;
     }
  
!    private static String padHex(String s, int i) {
!        StringBuffer tmpBuffer = new StringBuffer();
         if (s.length() < i) {
             for (int j = 0; j < i - s.length(); j++) {
--- 244,254 ----
     }
  
!    private static String hexFormat(final int i, final int j) {
!        final String s = Integer.toHexString(i);
         return padHex(s, j) + s;
     }
  
!    private static String padHex(final String s, final int i) {
!        final StringBuffer tmpBuffer = new StringBuffer();
         if (s.length() < i) {
             for (int j = 0; j < i - s.length(); j++) {



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
xdoclet-devel mailing list
xdoclet-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to