/** * A quick check to see if a declaration is an endpoint implementation. */ protected boolean isEndpointImplementation(TypeElement declaration) { if (declaration.getKind() == ElementKind.CLASS && !declaration.getQualifiedName().equals(getQualifiedName())) { WebService webServiceInfo = declaration.getAnnotation(WebService.class); return webServiceInfo != null && getQualifiedName().toString().equals(webServiceInfo.endpointInterface()); } return false; }
/** * Calculates a namespace URI for a given package. Default implementation uses the algorithm defined in * section 3.2 of the jax-ws spec. * * @return The calculated namespace uri. */ protected String calculateNamespaceURI() { PackageElement pkg = getPackage(); if ((pkg == null) || ("".equals(pkg.getQualifiedName().toString()))) { throw new EnunciateException(getQualifiedName() + ": a web service in no package must specify a target namespace."); } String[] tokens = pkg.getQualifiedName().toString().split("\\."); String uri = "http://"; for (int i = tokens.length - 1; i >= 0; i--) { uri += tokens[i]; if (i != 0) { uri += "."; } } uri += "/"; return uri; }
@Override public Operation findOperationFor(String classname, String method) { if (method.isEmpty() || classname.isEmpty()) { return null; } for (ServiceGroup serviceGroup : getServiceGroups()) { for (Service service : serviceGroup.getServices()) { for (Operation operation : service.getOperations()) { if (operation instanceof OperationImpl) { if (method.startsWith(((OperationImpl)operation).getWebMethod().getSimpleName().toString()) && ((OperationImpl)operation).getWebMethod().getDeclaringEndpointInterface().getQualifiedName().contentEquals(classname)) { return operation; } } } } } return null; }
@Override public Service findServiceFor(String classname) { if (classname.isEmpty()) { return null; } for (ServiceGroup serviceGroup : getServiceGroups()) { for (Service service : serviceGroup.getServices()) { for (Operation operation : service.getOperations()) { if (operation instanceof OperationImpl) { if (((OperationImpl)operation).getWebMethod().getDeclaringEndpointInterface().getQualifiedName().contentEquals(classname)) { return service; } } } } } return null; } }
if (isEndpointImplementation(declaration)) { WebService ws = declaration.getAnnotation(WebService.class); if (getQualifiedName().toString().equals(ws.endpointInterface())) { impls.add(new EndpointImplementation(declaration, this, context));
for (TypeMirror referenceType : getThrownTypes()) { if (!(referenceType instanceof DeclaredType)) { throw new EnunciateException("Method " + getSimpleName() + " of " + endpointInterface.getQualifiedName() + ": Thrown type must be a declared type."); throw new EnunciateException("Method " + getSimpleName() + " of " + endpointInterface.getQualifiedName() + ": unknown declaration for " + referenceType);
debug("Added %s as a JAX-WS endpoint interface.", ei.getQualifiedName()); debug("Unable to find source file for %s.", ei.getQualifiedName());