Commit 0c6877ff authored by frederic motte's avatar frederic motte
Browse files

add new setinvocationaddress implementation

parent 020cee9b
......@@ -203,7 +203,7 @@
</dependency>
<!-- <dependency> <groupId>eu.chorevolution</groupId> <artifactId>SecurityTokenService</artifactId>
<version>0.0.1-SNAPSHOT</version> </dependency> -->
<dependency>
<dependency>
<groupId>org.ow2.authzforce</groupId>
<artifactId>authzforce-ce-xacml-model</artifactId>
<version>3.4.0</version>
......@@ -211,7 +211,7 @@
<dependency>
<groupId>org.ow2.authzforce</groupId>
<artifactId>authzforce-ce-core</artifactId>
<version>5.0.2</version>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
......
......@@ -40,7 +40,6 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.ws.soap.SOAPFaultException;
import org.choreos.services.SetInvocationAddress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
......
......@@ -465,7 +465,7 @@ public class UsernameTokenValidator implements Validator {
Marshaller jaxbMarshaller = context.createMarshaller();
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
jaxbMarshaller.marshal(r, System.out);
System.out.println(r.toString());
//System.out.println(r.toString());
Response res = pdp.evaluate(r);
List<Result> result = res.getResults();
......
package org.choreos.services;
package eu.chorevolution.services;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
import org.choreos.services.SetInvocationAddress;
/**
* This object contains factory methods for each
......@@ -24,8 +23,8 @@ import org.choreos.services.SetInvocationAddress;
@XmlRegistry
public class ObjectFactory {
private final static QName _SetInvocationAddress_QNAME = new QName("http://services.choreos.org/", "setInvocationAddress");
private final static QName _SetInvocationAddressResponse_QNAME = new QName("http://services.choreos.org/", "setInvocationAddressResponse");
private final static QName _SetInvocationAddress_QNAME = new QName("http://services.chorevolution.eu/", "setInvocationAddress");
private final static QName _SetInvocationAddressResponse_QNAME = new QName("http://services.chorevolution.eu/", "setInvocationAddressResponse");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.choreos.services
......@@ -54,7 +53,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link SetInvocationAddress }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://services.choreos.org/", name = "setInvocationAddress")
@XmlElementDecl(namespace = "http://services.chorevolution.eu/", name = "setInvocationAddress")
public JAXBElement<SetInvocationAddress> createSetInvocationAddress(SetInvocationAddress value) {
return new JAXBElement<SetInvocationAddress>(_SetInvocationAddress_QNAME, SetInvocationAddress.class, null, value);
}
......@@ -63,7 +62,7 @@ public class ObjectFactory {
* Create an instance of {@link JAXBElement }{@code <}{@link SetInvocationAddressResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://services.choreos.org/", name = "setInvocationAddressResponse")
@XmlElementDecl(namespace = "http://services.chorevolution.eu/", name = "setInvocationAddressResponse")
public JAXBElement<SetInvocationAddressResponse> createSetInvocationAddressResponse(SetInvocationAddressResponse value) {
return new JAXBElement<SetInvocationAddressResponse>(_SetInvocationAddressResponse_QNAME, SetInvocationAddressResponse.class, null, value);
}
......
package org.choreos.services;
package eu.chorevolution.services;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
......
package org.choreos.services;
package eu.chorevolution.services;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
......@@ -27,7 +27,9 @@ import eu.chorevolution.SetInvocationAddressFilter;
@WebService (endpointInterface="org.choreos.services.SetInvocationAddressService")
@WebService (targetNamespace = "http://services.chorevolution.eu/",
serviceName = "BaseService",
endpointInterface="eu.chorevolution.services.SetInvocationAddressService")
public class SetInvocationAddressServiceImpl implements SetInvocationAddressService {
private static final Logger logger = LoggerFactory.getLogger(SetInvocationAddressServiceImpl.class);
......
@javax.xml.bind.annotation.XmlSchema(namespace = "http://services.choreos.org/")
package org.choreos.services;
@javax.xml.bind.annotation.XmlSchema(namespace = "http://services.chorevolution.eu/")
package eu.chorevolution.services;
package org.choreos.services;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.ws.Endpoint;
@WebService
public class BasicService {
protected Map<String,String> address_map=null;
protected String ENDPOINTADDRESS=null;
public static void main(String[] args) {
Endpoint.publish("http://localhost:9999/ws/hello", new BasicService());
}
/**
* Each BasicService subclass has the following lifecycle:
* 1. start the service
* 2. send it its own enpoint address
* 3. send the service dependency data (according to Enactment Engine choreography requirements)
* */
public BasicService(){
}
/* (non-Javadoc)
* @see org.choreos.services.Base#setInvocationAddress(java.lang.String, java.lang.String)
*/
@WebMethod
public void setInvocationAddress(String role, String name, List<String> endpoints) {
if (address_map.containsKey(name)) {
address_map.remove(name);
}
address_map.put(name, endpoints.get(0));
}
// @WebMethod
// public void setEndpointAddress(String addr){
// if (addr.indexOf("?wsdl")!=-1)
// ENDPOINTADDRESS=addr.substring(addr.indexOf("?wsdl")-1);
// else
// ENDPOINTADDRESS=addr;
// }
/**
* Example call: (Client1) (getPort("Client1", Client1.class));
* */
protected <T> T getPort(String service_name, Class<T> client_class){
String wsdlLocation=null;
wsdlLocation=retrieve_wsdl(service_name);
return getPort(service_name, wsdlLocation, client_class);
}
/**
* Example call: (Client1) (getPort("Client1", "http://localhost/client1?wsdl", Client1.class));
* */
protected <T> T getPort(String service_name, String wsdlLocation, Class<T> client_class){
T retPort = null;
QName serviceQName = null;
URL serviceUrl = null;
Service s;
//FIXME remove the replaceAll when integrating EE
service_name=service_name.replaceAll("[0-9.]", "");
// logger.info("Service name= "+service_name+" WsdlLocation= "+wsdlLocation+ " Class= "+client_class);
//
// if(!service_name.contains("AcrbMonitor")){
//
// serviceQName = new QName("http://services.choreos.org/", service_name+"Service");
// }
// else{
// serviceQName = new QName("http://service.acrbmonitorservice.choreos.org/", service_name+"Service");
// }
//
// try {
// serviceUrl = new URL(wsdlLocation);
// } catch (MalformedURLException ex) {
// logger.error(ex.toString());
// }
//
// try{
// s = Service.create(serviceUrl, serviceQName);
// retPort=(T) s.getPort(client_class);
// if(retPort != null){
// logger.info(service_name+" port found with WSDL location: " + wsdlLocation);
// }
// }catch(Exception e){
// logger.error("Impossible to create service: " + service_name +
// " from wsdl: " + wsdlLocation +
// " class: " + client_class.toString() + " Exception: " + e.toString());
// }
return retPort;
}
protected String retrieve_wsdl(String service_name) {
String wsdlLocation=null;
Pattern p = Pattern.compile("\\d+");
Matcher m = null;
String srv_num="";
// EE-Compliant solution
/*wsdlLocation=address_map.get(service_name);
if (wsdlLocation==null) {
logger.error(service_name+" port not found at "+wsdlLocation);
return null;
}*/
m=p.matcher(service_name);
while (m.find()) {
srv_num=srv_num+m.group();
}
// M24-Compliant solution
//wsdlLocation=cfg.getServiceBaseUrl("service."+service_name.toLowerCase().replaceAll("[0-9.]", ""))+srv_num+"?wsdl";
return wsdlLocation;
}
// protected ServicesAnalyzer getMonitorProxy(){
// ServicesAnalyzer proxy = null;
// try{
// //String acrbmonito_serv_name = AcrbMonitorConfig.SERVICE_ACRB_MONITOR.replaceAll("service.", "");
// Class c = ServicesAnalyzer.class;
// String acrbmonito_serv_name = "AcrbMonitor";
// proxy = (ServicesAnalyzer)getPort(acrbmonito_serv_name, ServicesAnalyzer.class);
// }
// catch(Exception e){
// e.printStackTrace();
// }
// return proxy;
// }
}
......@@ -35,6 +35,6 @@
<jaxws:endpoint
name="SetInvocationAddressServiceImpl"
implementor="org.choreos.services.SetInvocationAddressServiceImpl"
implementor="eu.chorevolution.services.SetInvocationAddressServiceImpl"
address="/setInvocationAddress"/>
</beans>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment