Subversion Repositories DevTools

Rev

Rev 4148 | Rev 4359 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4148 Rev 4341
Line 1... Line 1...
1
/*
1
/*
2
 * <XDtI18n:getString resource="do_not_edit"/>
2
 * <XDtI18n:getString resource="do_not_edit"/>
3
 */
3
 */
4
package <XDtPackage:packageOf><XDtEjbUtilObj:utilClass/></XDtPackage:packageOf>;
4
package <XDtPackage:packageOf><XDtEjbUtilObj:utilClass/></XDtPackage:packageOf>;
5
 
5
 
6
<XDtEjbIntf:ifRemoteEjb>
-
 
7
import javax.rmi.PortableRemoteObject;
-
 
8
</XDtEjbIntf:ifRemoteEjb>
-
 
9
import javax.naming.NamingException;
6
import javax.naming.Context;
10
import javax.naming.InitialContext;
7
import javax.naming.InitialContext;
-
 
8
import javax.naming.NamingException;
11
import java.util.Hashtable;
9
import java.util.Hashtable;
12
import javax.naming.Context;
10
import java.util.Properties;
13
<XDtEjbIntf:ifRemoteEjb>
11
<XDtEjbIntf:ifRemoteEjb>
14
import java.util.Date;
12
import java.util.Date;
15
import java.util.Properties;
13
import javax.rmi.PortableRemoteObject;
-
 
14
import org.jboss.security.SecurityContextAssociation;
16
</XDtEjbIntf:ifRemoteEjb>
15
</XDtEjbIntf:ifRemoteEjb>
17
 
16
 
18
<XDtConfig:ifConfigParamEquals paramName="includeGUID" value="true">
17
<XDtConfig:ifConfigParamEquals paramName="includeGUID" value="true">
19
import java.net.InetAddress;
18
import java.net.InetAddress;
20
import java.security.SecureRandom;
19
import java.security.SecureRandom;
Line 103... Line 102...
103
      {
102
      {
104
      </XDtClass:ifHasClassTag>
103
      </XDtClass:ifHasClassTag>
105
   
104
   
106
      <XDtConfig:ifConfigParamEquals paramName="cacheHomes" value="true">
105
      <XDtConfig:ifConfigParamEquals paramName="cacheHomes" value="true">
107
         // <XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="util_obtain_ic"/>
106
         // <XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="util_obtain_ic"/>
108
		 Hashtable properties = new Hashtable();
107
		 Properties properties = new Properties();
109
		 properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
108
		 properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
-
 
109
         if (SecurityContextAssociation.getPrincipal() != null)
-
 
110
         {
-
 
111
			properties.put("remote.connection.default.username", SecurityContextAssociation.getPrincipal().toString());
-
 
112
			properties.put("remote.connection.default.password", SecurityContextAssociation.getCredential().toString());
-
 
113
         }
-
 
114
         else
-
 
115
         {
-
 
116
			properties.put("remote.connection.default.username", "anonymous");
-
 
117
			properties.put("remote.connection.default.password", "");
-
 
118
         }
-
 
119
		 		 
110
         InitialContext initialContext = new InitialContext(properties);
120
         InitialContext initialContext = new InitialContext(properties);
111
         try {
121
         try {
112
            java.lang.Object objRef = initialContext.lookup(<XDtEjbHome:homeInterface type="remote"/>.JNDI_NAME);
122
            java.lang.Object objRef = initialContext.lookup(<XDtEjbHome:homeInterface type="remote"/>.JNDI_NAME);
113
            cachedRemoteHome = (<XDtEjbHome:homeInterface type="remote"/>) PortableRemoteObject.narrow(objRef, <XDtEjbHome:homeInterface type="remote"/>.class);
123
            cachedRemoteHome = (<XDtEjbHome:homeInterface type="remote"/>) PortableRemoteObject.narrow(objRef, <XDtEjbHome:homeInterface type="remote"/>.class);
114
         } finally {
124
         } finally {
Line 121... Line 131...
121
 
131
 
122
      return cachedRemoteHome;
132
      return cachedRemoteHome;
123
      </XDtConfig:ifConfigParamEquals>
133
      </XDtConfig:ifConfigParamEquals>
124
      <XDtConfig:ifConfigParamNotEquals paramName="cacheHomes" value="true">
134
      <XDtConfig:ifConfigParamNotEquals paramName="cacheHomes" value="true">
125
      // <XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="util_obtain_ic"/>
135
      // <XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="util_obtain_ic"/>
126
	  Hashtable properties = new Hashtable();
136
	  Properties properties = new Properties();
127
	  properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
137
	  properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
128
	  InitialContext initialContext = new InitialContext(properties);
138
	  InitialContext initialContext = new InitialContext(properties);
129
      try {
139
      try {
130
         java.lang.Object objRef = initialContext.lookup(<XDtEjbHome:homeInterface type="remote"/>.JNDI_NAME);
140
         java.lang.Object objRef = initialContext.lookup(<XDtEjbHome:homeInterface type="remote"/>.JNDI_NAME);
131
         return (<XDtEjbHome:homeInterface type="remote"/>) PortableRemoteObject.narrow(objRef, <XDtEjbHome:homeInterface type="remote"/>.class);
141
         return (<XDtEjbHome:homeInterface type="remote"/>) PortableRemoteObject.narrow(objRef, <XDtEjbHome:homeInterface type="remote"/>.class);
Line 198... Line 208...
198
   {
208
   {
199
      // <XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="util_localhome_not_narrowed"/>
209
      // <XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="util_localhome_not_narrowed"/>
200
      <XDtConfig:ifConfigParamEquals paramName="cacheHomes" value="true">
210
      <XDtConfig:ifConfigParamEquals paramName="cacheHomes" value="true">
201
      if (cachedLocalHome == null) {
211
      if (cachedLocalHome == null) {
202
         // <XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="util_obtain_ic"/>
212
         // <XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="util_obtain_ic"/>
203
         Hashtable properties = new Hashtable();
213
         Properties properties = new Properties();
204
		 properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
214
		 properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
205
         InitialContext initialContext = new InitialContext(properties);
215
         InitialContext initialContext = new InitialContext(properties);
206
         try {
216
         try {
207
            cachedLocalHome = (<XDtEjbHome:homeInterface type="local"/>) initialContext.lookup(<XDtEjbHome:homeInterface type="local"/>.COMP_NAME);
217
            cachedLocalHome = (<XDtEjbHome:homeInterface type="local"/>) initialContext.lookup(<XDtEjbHome:homeInterface type="local"/>.COMP_NAME);
208
         } finally {
218
         } finally {
Line 211... Line 221...
211
      }
221
      }
212
      return cachedLocalHome;
222
      return cachedLocalHome;
213
      </XDtConfig:ifConfigParamEquals>
223
      </XDtConfig:ifConfigParamEquals>
214
      <XDtConfig:ifConfigParamNotEquals paramName="cacheHomes" value="true">
224
      <XDtConfig:ifConfigParamNotEquals paramName="cacheHomes" value="true">
215
      // <XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="util_obtain_ic"/>
225
      // <XDtI18n:getString bundle="xdoclet.modules.ejb.XDocletModulesEjbMessages" resource="util_obtain_ic"/>
216
      Hashtable properties = new Hashtable();
226
      Properties properties = new Properties();
217
	  properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
227
	  properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
218
	  InitialContext initialContext = new InitialContext(properties);
228
	  InitialContext initialContext = new InitialContext(properties);
219
      try {
229
      try {
220
         return (<XDtEjbHome:homeInterface type="local"/>) initialContext.lookup(<XDtEjbHome:homeInterface type="local"/>.COMP_NAME);
230
         return (<XDtEjbHome:homeInterface type="local"/>) initialContext.lookup(<XDtEjbHome:homeInterface type="local"/>.COMP_NAME);
221
      } finally {
231
      } finally {