use of org.jvnet.hk2.config.Element in project Payara by payara.
the class IiopSslConfigHandler method delete.
@Override
public void delete(DeleteSsl command, ActionReport report) {
IiopService iiopService = command.config.getExtensionByType(IiopService.class);
IiopListener iiopListener = null;
for (IiopListener listener : iiopService.getIiopListener()) {
if (listener.getId().equals(command.listenerId)) {
iiopListener = listener;
}
}
if (iiopListener == null) {
report.setMessage(localStrings.getLocalString("delete.ssl.iiop.listener.notfound", "Iiop Listener named {0} not found", command.listenerId));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
if (iiopListener.getSsl() == null) {
report.setMessage(localStrings.getLocalString("delete.ssl.element.doesnotexist", "Ssl element does " + "not exist for Listener named {0}", command.listenerId));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
try {
ConfigSupport.apply(new SingleConfigCode<IiopListener>() {
public Object run(IiopListener param) throws PropertyVetoException {
param.setSsl(null);
return null;
}
}, iiopListener);
} catch (TransactionFailure e) {
command.reportError(report, e);
}
}
use of org.jvnet.hk2.config.Element in project Payara by payara.
the class CreateHTTPLoadBalancerCommand method addLoadBalancer.
private void addLoadBalancer(final String lbConfigName) {
LoadBalancers loadBalancers = domain.getExtensionByType(LoadBalancers.class);
// create load-balancers parent element if it does not exist
if (loadBalancers == null) {
Transaction transaction = new Transaction();
try {
ConfigBeanProxy domainProxy = transaction.enroll(domain);
loadBalancers = domainProxy.createChild(LoadBalancers.class);
((Domain) domainProxy).getExtensions().add(loadBalancers);
transaction.commit();
} catch (TransactionFailure ex) {
transaction.rollback();
String msg = localStrings.getLocalString("FailedToUpdateLB", "Failed to update load-balancers");
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
} catch (RetryableException ex) {
transaction.rollback();
String msg = localStrings.getLocalString("FailedToUpdateLB", "Failed to update load-balancers");
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
}
try {
ConfigSupport.apply(new SingleConfigCode<LoadBalancers>() {
@Override
public Object run(LoadBalancers param) throws PropertyVetoException, TransactionFailure {
LoadBalancer lb = param.createChild(LoadBalancer.class);
lb.setDeviceHost(devicehost);
lb.setDevicePort(deviceport);
lb.setLbConfigName(lbConfigName);
lb.setName(load_balancer_name);
// add properties
if (properties != null) {
for (Object propname : properties.keySet()) {
Property newprop = lb.createChild(Property.class);
newprop.setName((String) propname);
newprop.setValue(properties.getProperty((String) propname));
lb.getProperty().add(newprop);
}
}
if (sslproxyhost != null) {
Property newprop = lb.createChild(Property.class);
newprop.setName("ssl-proxy-host");
newprop.setValue(sslproxyhost);
lb.getProperty().add(newprop);
}
if (sslproxyport != null) {
Property newprop = lb.createChild(Property.class);
newprop.setName("ssl-proxy-port");
newprop.setValue(sslproxyport);
lb.getProperty().add(newprop);
}
param.getLoadBalancer().add(lb);
return Boolean.TRUE;
}
}, loadBalancers);
} catch (TransactionFailure ex) {
String msg = localStrings.getLocalString("FailedToUpdateLB", "Failed to update load-balancers");
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setMessage(msg);
return;
}
}
use of org.jvnet.hk2.config.Element in project Payara by payara.
the class ConfigureJMSCluster method execute.
/**
* Executes the command with the command parameters passed as Properties
* where the keys are the paramter names and the values the parameter values
*
* @param context information
*/
public void execute(AdminCommandContext context) {
final ActionReport report = context.getActionReport();
// Server targetServer = domain.getServerNamed(target);
// String configRef = targetServer.getConfigRef();
Cluster cluster = domain.getClusterNamed(clusterName);
if (cluster == null) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.invalidClusterName", "No Cluster by this name has been configured"));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
List instances = cluster.getInstances();
String warning = null;
if (instances.size() > 0) {
ActionReport listReport = habitat.getService(ActionReport.class);
ParameterMap parameters = new ParameterMap();
parameters.set("DEFAULT", clusterName);
commandRunner.getCommandInvocation("list-instances", listReport, context.getSubject()).parameters(parameters).execute();
if (ActionReport.ExitCode.FAILURE.equals(listReport.getActionExitCode())) {
warning = localStrings.getLocalString("configure.jms.cluster.clusterWithInstances", "Warning: Please make sure running this command with all cluster instances stopped, otherwise it may lead to inconsistent JMS behavior and corruption of configuration and message stores.");
} else {
String result = listReport.getMessage();
String fixedResult = result.replaceAll("not running", "stopped");
if (fixedResult.indexOf("running") > -1) {
warning = localStrings.getLocalString("configure.jms.cluster.clusterWithInstances", "Warning: Please make sure running this command with all cluster instances stopped, otherwise it may lead to inconsistent JMS behavior and corruption of configuration and message stores.");
warning = warning + "\r\n" + result + "\r\n";
}
}
}
Config config = domain.getConfigNamed(cluster.getConfigRef());
JmsService jmsService = config.getExtensionByType(JmsService.class);
if (jmsService == null) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.nojmsservice", "No JMS Service element in config"));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
if (!CONVENTIONAL.equalsIgnoreCase(clusterType) && !ENHANCED.equalsIgnoreCase(clusterType)) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.wrongClusterType", "Invalid option sepecified for clustertype. Valid options are conventional and enhanced"));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
if (CONVENTIONAL.equalsIgnoreCase(clusterType) && !MASTER_BROKER.equalsIgnoreCase(configStoreType) && !SHARED_DB.equalsIgnoreCase(configStoreType)) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.wrongConfigStoreType", "Invalid option sepecified for configstoretype. Valid options are masterbroker and shareddb"));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
if (ENHANCED.equalsIgnoreCase(clusterType) && configStoreType != null) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.wrongStoreType", "configstoretype option is not configurable for Enhanced clusters."));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
if (CONVENTIONAL.equalsIgnoreCase(clusterType) && !MASTER_BROKER.equalsIgnoreCase(configStoreType) && !FILE.equalsIgnoreCase(messageStoreType) && !JDBC.equalsIgnoreCase(messageStoreType)) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.wrongMessageStoreType", "Invalid option sepecified for messagestoretype. Valid options are file and jdbc"));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
if (ENHANCED.equalsIgnoreCase(clusterType) && messageStoreType != null) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.wrongmsgStoreType", "messagestoretype option is not configurable for Enhanced clusters."));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
String integrationMode = jmsService.getType();
if (REMOTE.equalsIgnoreCase(integrationMode)) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.remoteMode", "JMS integration mode should be either EMBEDDED or LOCAL to run this command. Please use the asadmin.set command to change the integration mode"));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
String changeIntegrationMode = null;
if (EMBEDDED.equalsIgnoreCase(integrationMode) && ENHANCED.equalsIgnoreCase(clusterType)) {
try {
ConfigSupport.apply(new SingleConfigCode<JmsService>() {
public Object run(JmsService param) throws PropertyVetoException, TransactionFailure {
param.setType(LOCAL);
return param;
}
}, jmsService);
changeIntegrationMode = localStrings.getLocalString("configure.jms.cluster.integrationModeChanged", "WARNING: JMS integration mode has been changed from EMBEDDED to LOCAL automatically.");
} catch (TransactionFailure tfe) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.cannotChangeIntegrationMode", "Unable to change the JMS integration mode to LOCAL for Enhanced cluster {0}.", clusterName) + " " + tfe.getLocalizedMessage());
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(tfe);
return;
}
}
if (MASTER_BROKER.equalsIgnoreCase(configStoreType) && FILE.equals(messageStoreType)) {
if (dbvendor != null || dburl != null || dbuser != null) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.invalidDboptions", "Database options should not be specified for this configuration"));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
}
if (!MASTER_BROKER.equalsIgnoreCase(configStoreType) || ENHANCED.equalsIgnoreCase(clusterType) || JDBC.equalsIgnoreCase(messageStoreType)) {
if (dbvendor == null) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.nodbvendor", "No DataBase vendor specified"));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
} else if (dburl == null) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.nojdbcurl", "No JDBC URL specified"));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
} else if (!isSupportedDbVendor()) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.invaliddbvendor", "Invalid DB Vednor specified"));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
}
if (CONVENTIONAL.equalsIgnoreCase(clusterType) && configStoreType == null) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.noConfigStoreType", "No configstoretype specified. Using the default value - masterbroker"));
configStoreType = "masterbroker";
}
if (CONVENTIONAL.equalsIgnoreCase(clusterType) && messageStoreType == null) {
report.setMessage(localStrings.getLocalString("configure.jms.cluster.noMessagetoreType", "No messagestoretype specified. Using the default value - file"));
messageStoreType = "file";
}
config = domain.getConfigNamed(cluster.getConfigRef());
JmsAvailability jmsAvailability = config.getAvailabilityService().getExtensionByType(JmsAvailability.class);
final Boolean availabilityEnabled = Boolean.valueOf(ENHANCED.equalsIgnoreCase(clusterType));
try {
ConfigSupport.apply(new SingleConfigCode<JmsAvailability>() {
public Object run(JmsAvailability param) throws PropertyVetoException, TransactionFailure {
param.setAvailabilityEnabled(availabilityEnabled.toString());
if (availabilityEnabled.booleanValue()) {
param.setMessageStoreType(JDBC);
} else {
param.setConfigStoreType(configStoreType.toLowerCase(Locale.ENGLISH));
param.setMessageStoreType(messageStoreType.toLowerCase(Locale.ENGLISH));
}
param.setDbVendor(dbvendor);
param.setDbUsername(dbuser);
param.setDbPassword(jmsDbPassword);
param.setDbUrl(dburl);
if (props != null) {
for (Map.Entry e : props.entrySet()) {
Property prop = param.createChild(Property.class);
prop.setName((String) e.getKey());
prop.setValue((String) e.getValue());
param.getProperty().add(prop);
}
}
return param;
}
}, jmsAvailability);
/* //update the useMasterBroker flag on the JmsService only if availabiltyEnabled is false
if(!availabilityEnabled.booleanValue()){
ConfigSupport.apply(new SingleConfigCode<JmsService>() {
public Object run(JmsService param) throws PropertyVetoException, TransactionFailure {
param.setUseMasterBroker(useMasterBroker.toString());
return param;
}
}, jmsservice);
}*/
} catch (TransactionFailure tfe) {
report.setMessage((changeIntegrationMode == null ? "" : changeIntegrationMode + "\n") + localStrings.getLocalString("configure.jms.cluster.fail", "Unable to Configure JMS Cluster for cluster {0}.", clusterName) + " " + tfe.getLocalizedMessage());
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(tfe);
}
report.setMessage((warning == null ? "" : warning + "\n") + (changeIntegrationMode == null ? "" : changeIntegrationMode + "\n") + localStrings.getLocalString("configure.jms.cluster.success", "JMS Cluster Configuration updated for Cluster {0}.", clusterName));
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
use of org.jvnet.hk2.config.Element in project Payara by payara.
the class WebContainer method createHttpListener.
protected WebConnector createHttpListener(NetworkListener listener, HttpService httpService, Mapper mapper) {
if (!Boolean.valueOf(listener.getEnabled())) {
return null;
}
int port = 8080;
WebConnector connector;
checkHostnameUniqueness(listener.getName(), httpService);
try {
port = Integer.parseInt(listener.getPort());
} catch (NumberFormatException nfe) {
String msg = rb.getString(LogFacade.HTTP_LISTENER_INVALID_PORT);
msg = MessageFormat.format(msg, listener.getPort(), listener.getName());
throw new IllegalArgumentException(msg);
}
if (mapper == null) {
for (Mapper m : habitat.<Mapper>getAllServices(Mapper.class)) {
if (m.getPort() == port && m instanceof ContextMapper) {
ContextMapper cm = (ContextMapper) m;
if (listener.getName().equals(cm.getId())) {
mapper = m;
break;
}
}
}
}
String defaultVS = listener.findHttpProtocol().getHttp().getDefaultVirtualServer();
if (!defaultVS.equals(org.glassfish.api.web.Constants.ADMIN_VS)) {
// Before we start a WebConnector, let's makes sure there is
// not another Container already listening on that port
DataChunk host = DataChunk.newInstance();
char[] c = defaultVS.toCharArray();
host.setChars(c, 0, c.length);
DataChunk mb = DataChunk.newInstance();
mb.setChars(new char[] { '/' }, 0, 1);
MappingData md = new MappingData();
try {
mapper.map(host, mb, md);
} catch (Exception e) {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "", e);
}
}
if (md.context != null && md.context instanceof ContextRootInfo) {
ContextRootInfo r = (ContextRootInfo) md.context;
if (!(r.getHttpHandler() instanceof ContainerMapper)) {
new BindException("Port " + port + " is already used by Container: " + r.getHttpHandler() + " and will not get started.").printStackTrace();
return null;
}
}
}
/*
* Create Connector. Connector is SSL-enabled if
* 'security-enabled' attribute in <http-listener>
* element is set to TRUE.
*/
boolean isSecure = Boolean.valueOf(listener.findHttpProtocol().getSecurityEnabled());
if (isSecure && defaultRedirectPort == -1) {
defaultRedirectPort = port;
}
String address = listener.getAddress();
if ("any".equals(address) || "ANY".equals(address) || "INADDR_ANY".equals(address)) {
address = null;
/*
* Setting 'address' to NULL will cause Tomcat to pass a
* NULL InetAddress argument to the java.net.ServerSocket
* constructor, meaning that the server socket will accept
* connections on any/all local addresses.
*/
}
connector = (WebConnector) _embedded.createConnector(address, port, isSecure);
connector.setMapper(mapper);
connector.setJvmRoute(engine.getJvmRoute());
if (logger.isLoggable(Level.INFO)) {
logger.log(Level.INFO, LogFacade.HTTP_LISTENER_CREATED, new Object[] { listener.getName(), listener.getAddress(), listener.getPort() });
}
connector.setDefaultHost(listener.findHttpProtocol().getHttp().getDefaultVirtualServer());
connector.setName(listener.getName());
connector.setInstanceName(instanceName);
connector.configure(listener, isSecure, httpService);
_embedded.addConnector(connector);
connectorMap.put(listener.getName(), connector);
// If we already know the redirect port, then set it now
// This situation will occurs when dynamic reconfiguration occurs
String redirectPort = listener.findHttpProtocol().getHttp().getRedirectPort();
if (redirectPort != null) {
connector.setRedirectPort(Integer.parseInt(redirectPort));
} else if (defaultRedirectPort != -1) {
connector.setRedirectPort(defaultRedirectPort);
}
ObservableBean httpListenerBean = (ObservableBean) ConfigSupport.getImpl(listener);
httpListenerBean.addListener(configListener);
return connector;
}
use of org.jvnet.hk2.config.Element in project Payara by payara.
the class WebServiceRefHandler method processAWsRef.
protected HandlerProcessingResult processAWsRef(AnnotationInfo annInfo, WebServiceRef annotation) throws AnnotationProcessorException {
AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler();
AnnotatedElement annElem = annInfo.getAnnotatedElement();
Class annotatedType = null;
Class declaringClass = null;
InjectionTarget target = null;
String defaultServiceRefName = null;
if (annInfo.getElementType().equals(ElementType.FIELD)) {
// this is a field injection
Field annotatedField = (Field) annElem;
// check this is a valid field
if (annCtx instanceof AppClientContext) {
if (!Modifier.isStatic(annotatedField.getModifiers())) {
throw new AnnotationProcessorException(localStrings.getLocalString("enterprise.deployment.annotation.handlers.injectionfieldnotstatic", "Injection fields for application clients must be declared STATIC"), annInfo);
}
}
annotatedType = annotatedField.getType();
declaringClass = annotatedField.getDeclaringClass();
defaultServiceRefName = declaringClass.getName() + "/" + annotatedField.getName();
target = new InjectionTarget();
target.setFieldName(annotatedField.getName());
target.setClassName(annotatedField.getDeclaringClass().getName());
} else if (annInfo.getElementType().equals(ElementType.METHOD)) {
// this is a method injection
Method annotatedMethod = (Method) annElem;
validateInjectionMethod(annotatedMethod, annInfo);
if (annCtx instanceof AppClientContext) {
if (!Modifier.isStatic(annotatedMethod.getModifiers())) {
throw new AnnotationProcessorException(localStrings.getLocalString("enterprise.deployment.annotation.handlers.injectionmethodnotstatic", "Injection methods for application clients must be declared STATIC"), annInfo);
}
}
annotatedType = annotatedMethod.getParameterTypes()[0];
declaringClass = annotatedMethod.getDeclaringClass();
// Derive javabean property name.
String propertyName = getInjectionMethodPropertyName(annotatedMethod, annInfo);
// prefixing with fully qualified type name
defaultServiceRefName = declaringClass.getName() + "/" + propertyName;
target = new InjectionTarget();
target.setMethodName(annotatedMethod.getName());
target.setClassName(annotatedMethod.getDeclaringClass().getName());
} else if (annInfo.getElementType().equals(ElementType.TYPE)) {
// name must be specified.
if (!ok(annotation.name())) {
throw new AnnotationProcessorException(localStrings.getLocalString("enterprise.deployment.annotation.handlers.nonametypelevel", "TYPE-Level annotation must specify name member."), annInfo);
}
// this is a dependency declaration, we need the service interface
// to be specified
annotatedType = annotation.type();
if (annotatedType == null || annotatedType == Object.class) {
throw new AnnotationProcessorException(localStrings.getLocalString("enterprise.deployment.annotation.handlers.typenotfound", "TYPE-level annotation symbol must specify type member."), annInfo);
}
declaringClass = (Class) annElem;
} else {
throw new AnnotationProcessorException(localStrings.getLocalString("enterprise.deployment.annotation.handlers.invalidtype", "annotation not allowed on this element."), annInfo);
}
MTOM mtom = null;
Addressing addressing = null;
RespectBinding respectBinding = null;
// Other annotations like SchemaValidation etc to be passed on to
// ServiceReferenceDescriptor
Map<Class<? extends Annotation>, Annotation> otherAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
for (Annotation a : annElem.getAnnotations()) {
if (!(a.annotationType().isAnnotationPresent(WebServiceFeatureAnnotation.class)))
continue;
if (a instanceof MTOM) {
mtom = (MTOM) a;
} else if (a instanceof Addressing) {
addressing = (Addressing) a;
} else if (a instanceof RespectBinding) {
respectBinding = (RespectBinding) a;
} else {
if (!otherAnnotations.containsKey(a.getClass())) {
otherAnnotations.put(a.getClass(), a);
}
}
}
String serviceRefName = !ok(annotation.name()) ? defaultServiceRefName : annotation.name();
ServiceReferenceContainer[] containers = null;
if (annCtx instanceof ServiceReferenceContainerContext) {
containers = ((ServiceReferenceContainerContext) annCtx).getServiceRefContainers();
}
if (containers == null || containers.length == 0) {
annInfo.getProcessingContext().getErrorHandler().fine(new AnnotationProcessorException(localStrings.getLocalString("enterprise.deployment.annotation.handlers.invalidannotationforthisclass", "Illegal annotation symbol for this class will be ignored"), annInfo));
return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
}
// now process the annotation for all the containers.
for (ServiceReferenceContainer container : containers) {
ServiceReferenceDescriptor aRef = null;
try {
aRef = container.getServiceReferenceByName(serviceRefName);
}// ignore
catch (Throwable t) {
}
if (aRef == null) {
// time to create it...
aRef = new ServiceReferenceDescriptor();
aRef.setName(serviceRefName);
container.addServiceReferenceDescriptor(aRef);
}
// merge other annotations
Map<Class<? extends Annotation>, Annotation> oa = aRef.getOtherAnnotations();
if (oa == null)
aRef.setOtherAnnotations(otherAnnotations);
else {
for (Map.Entry<Class<? extends Annotation>, Annotation> entry : otherAnnotations.entrySet()) {
if (!oa.containsKey(entry.getKey()))
oa.put(entry.getKey(), entry.getValue());
}
}
// merge wsdlLocation
if (!ok(aRef.getWsdlFileUri()) && ok(annotation.wsdlLocation()))
aRef.setWsdlFileUri(annotation.wsdlLocation());
if (!aRef.hasMtomEnabled() && mtom != null) {
aRef.setMtomEnabled(mtom.enabled());
aRef.setMtomThreshold(mtom.threshold());
}
// check Addressing annotation
if (aRef.getAddressing() == null && addressing != null) {
aRef.setAddressing(new com.sun.enterprise.deployment.Addressing(addressing.enabled(), addressing.required(), addressing.responses().toString()));
}
// check RespectBinding annotation
if (aRef.getRespectBinding() == null && respectBinding != null) {
aRef.setRespectBinding(new com.sun.enterprise.deployment.RespectBinding(respectBinding.enabled()));
}
// Store mapped name that is specified
if (!ok(aRef.getMappedName()) && ok(annotation.mappedName()))
aRef.setMappedName(annotation.mappedName());
// Store lookup name that is specified
if (!aRef.hasLookupName() && ok(getLookupValue(annotation, annInfo)))
aRef.setLookupName(getLookupValue(annotation, annInfo));
aRef.setInjectResourceType("javax.jws.WebServiceRef");
if (target != null)
aRef.addInjectionTarget(target);
// Read the WebServiceClient annotation for the service name space
// uri and wsdl (if required)
WebServiceClient wsclientAnn;
// of these default values.
if (!Object.class.equals(annotation.value()) && (!javax.xml.ws.Service.class.equals(annotation.value()))) {
// port.
if (aRef.getServiceInterface() == null) {
aRef.setServiceInterface(annotation.value().getName());
}
if (aRef.getPortInfoBySEI(annotatedType.getName()) == null) {
ServiceRefPortInfo portInfo = new ServiceRefPortInfo();
portInfo.setServiceEndpointInterface(annotatedType.getName());
aRef.addPortInfo(portInfo);
}
// set the port type requested for injection
if (aRef.getInjectionTargetType() == null) {
aRef.setInjectionTargetType(annotatedType.getName());
}
wsclientAnn = (WebServiceClient) annotation.value().getAnnotation(WebServiceClient.class);
} else {
// no value provided in the annotation
wsclientAnn = (WebServiceClient) annotatedType.getAnnotation(WebServiceClient.class);
}
if (wsclientAnn == null) {
throw new AnnotationProcessorException(localStrings.getLocalString("enterprise.deployment.annotation.handlers.classnotannotated", "Class must be annotated with a {1} annotation\n symbol : {1}\n location: {0}", new Object[] { annotatedType.toString(), WebServiceClient.class.toString() }));
}
// annotation, get it from WebServiceClient annotation
if (aRef.getWsdlFileUri() == null) {
aRef.setWsdlFileUri(wsclientAnn.wsdlLocation());
}
// Set service name space URI and service local part
if (aRef.getServiceName() == null) {
aRef.setServiceNamespaceUri(wsclientAnn.targetNamespace());
aRef.setServiceLocalPart(wsclientAnn.name());
}
if (aRef.getServiceInterface() == null) {
aRef.setServiceInterface(annotatedType.getName());
}
}
// have @HandlerChain but the SEI has one specified through JAXWS customization
if (annElem.getAnnotation(javax.jws.HandlerChain.class) == null) {
return (new HandlerChainHandler()).processHandlerChainAnnotation(annInfo, annCtx, annotatedType, declaringClass, false);
}
return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
}
Aggregations