1 /*******************************************************************************
2 * Copyright (c) 2005, 2006, 2007 Imola Informatica.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the LGPL License v2.1
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/lgpl.html
7 *******************************************************************************/
8 package it.imolinfo.jbi4ejb.webservice.generator;
9
10 import it.imolinfo.jbi4ejb.Logger;
11 import it.imolinfo.jbi4ejb.LoggerFactory;
12 import it.imolinfo.jbi4ejb.exception.ClassGenerationException;
13 import it.imolinfo.jbi4ejb.jbi.Messages;
14
15 import java.util.Properties;
16
17 /**
18 * Descriptor to incapsulate all fields required to extend a WSDL file
19 * starting from a ejb RemoteInterface.
20 *
21 * @author <a href="mailto:mpiraccini@imolinfo.it">Marco Piraccini</a>
22 */
23 public class WSDLDescriptor {
24
25 /** Logger. */
26 static final Logger LOG = LoggerFactory.getLogger(WSDLDescriptor.class);
27 private static final Messages MESSAGES
28 = Messages.getMessages(WSDLDescriptor.class);
29
30 /** The Constant CORBANAME_LOCALIZATION_TYPE. */
31 public final static String CORBANAME_LOCALIZATION_TYPE = "corbaname";
32
33 /** The Constant JNDI_LOCALIZATION_TYPE. */
34 public final static String JNDI_LOCALIZATION_TYPE = "jndi";
35
36 /** The corba service name. */
37 private final String name;
38
39 /** The corba service name. */
40 private final String localizationType;
41
42 /** The orb properties. */
43 private Properties orbProperties;
44
45 /** The jndi properties. */
46 private Properties jndiProperties;
47
48 /**
49 * Instantiates a new WSDL descriptor.
50 *
51 * @param name
52 * The name
53 * @param localizationType
54 * The localization type
55 */
56 public WSDLDescriptor(String name, String localizationType) {
57 if (name == null) {
58 String msg=MESSAGES.getString("EJB001016_Ejb_Service_Name_null");
59 LOG.error(msg);
60 throw new NullPointerException(msg);
61 }
62 if (localizationType == null) {
63 String msg=MESSAGES.getString("EJB001017_Localization_type_name_null");
64 LOG.error(msg);
65 throw new NullPointerException(msg);
66 }
67
68 this.name = name;
69 this.localizationType = localizationType;
70 }
71
72 /**
73 * Gets the corba service name.
74 *
75 * @return the corba service name
76 */
77 public String getCorbaServiceName() {
78 return name;
79 }
80
81 /**
82 * Gets the orb properties.typesSerialVersionUIDs.
83 *
84 * @return the orb properties
85 */
86 public Properties getOrbProperties() {
87 if (orbProperties == null) {
88 orbProperties = new Properties();
89 }
90 return orbProperties;
91 }
92
93 /**
94 * Sets the orb properties.
95 *
96 * @param orbProperties
97 * the new orb properties
98 */
99 public void setOrbProperties(Properties orbProperties) {
100 this.orbProperties = orbProperties;
101 }
102
103 /**
104 * Gets the jndi properties.
105 *
106 * @return the jndi properties
107 */
108 public Properties getJndiProperties() {
109 return jndiProperties;
110 }
111
112 /**
113 * Sets the jndi properties.
114 *
115 * @param jndiProperties
116 * the new jndi properties
117 */
118 public void setJndiProperties(Properties jndiProperties) {
119 this.jndiProperties = jndiProperties;
120 }
121
122 /**
123 * Gets the name.
124 *
125 * @return the name
126 */
127 public String getName() {
128 return name;
129 }
130
131 /**
132 * Gets the localization type.
133 *
134 * @return the localization type
135 */
136 public String getLocalizationType() {
137 return localizationType;
138 }
139
140 /**
141 * True if the localilzation type is woth corba name.
142 *
143 * @return true, if the localilzation type is woth corba name
144 */
145 public boolean isCorbaName() {
146 if (CORBANAME_LOCALIZATION_TYPE.equalsIgnoreCase(this.getLocalizationType())) {
147 return true;
148 }
149 return false;
150 }
151
152 }