Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CHOReVOLUTION
choreospec
Commits
8e948672
Commit
8e948672
authored
Jan 09, 2017
by
Francesco Chicchiriccò
Browse files
Fixing Javadoc errors (now warnings)
parent
9ac9e5ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
8e948672
target
src/main/java/eu/chorevolution/chors/Base.java
View file @
8e948672
...
...
@@ -34,68 +34,79 @@ import javax.xml.ws.Service;
targetNamespace
=
"http://services.chorevolution.eu/"
)
public
class
Base
implements
BaseService
{
protected
Map
<
String
,
String
>
address_map
=
null
;
protected
String
ENDPOINTADDRESS
=
null
;
/**
* 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
Base
(){
address_map
=
new
HashMap
<
String
,
String
>();
}
protected
Map
<
String
,
String
>
address_map
=
null
;
/* (non-Javadoc)
* @see org.choreos.services.Base#setInvocationAddress(java.lang.String, java.lang.String)
*/
/* (non-Javadoc)
* @see eu.chorevolution.enactment.dependencies.ConfigurableService#setInvocationAddress(java.lang.String, java.lang.String, java.util.List)
protected
String
ENDPOINTADDRESS
=
null
;
/**
* 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
Base
()
{
address_map
=
new
HashMap
<>();
}
/* (non-Javadoc)
* @see org.choreos.services.Base#setInvocationAddress(java.lang.String, java.lang.String)
*/
/* (non-Javadoc)
* @see eu.chorevolution.enactment.dependencies.ConfigurableService#setInvocationAddress(java.lang.String,
* java.lang.String, java.util.List)
*/
@Override
@Override
@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
));
}
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
));
}
/**
* (non-Javadoc)
* Example call: (Client1) (getPort("Client1", "http://localhost/client1?wsdl", Client1.class));
*
* @param <T>
* @param service_name
* @param wsdlLocation
* @param source_url
* @param client_class
* @return
* @throws java.net.MalformedURLException
* @throws java.lang.InterruptedException
*/
public
static
<
T
>
T
getPort
(
String
service_name
,
String
wsdlLocation
,
String
source_url
,
Class
<
T
>
client_class
)
throws
MalformedURLException
,
IOException
,
InterruptedException
{
/**
* Example call: (Client1) (getPort("Client1", "http://localhost/client1?wsdl", Client1.class));
* @throws MalformedURLException
* @throws InterruptedException
* */
public
static
<
T
>
T
getPort
(
String
service_name
,
String
wsdlLocation
,
String
source_url
,
Class
<
T
>
client_class
)
throws
MalformedURLException
,
IOException
,
InterruptedException
{
T
retPort
=
null
;
QName
serviceQName
=
null
;
URL
serviceUrl
=
null
;
Service
s
;
int
err_count
=
0
;
String
wsdl_content
=
null
;
serviceQName
=
new
QName
(
namespace
,
service_name
+
"Service"
);
T
retPort
=
null
;
QName
serviceQName
=
null
;
URL
serviceUrl
=
null
;
Service
s
;
int
err_count
=
0
;
String
wsdl_content
=
null
;
while
(
err_count
<
5
)
{
wsdl_content
=
new
Scanner
(
new
URL
(
wsdlLocation
).
openStream
(),
"UTF-8"
).
useDelimiter
(
"\\A"
).
next
();
if
((
wsdl_content
==
null
)||(
wsdl_content
.
contains
(
"<html>"
))||(
wsdl_content
.
contains
(
"<body>"
)))
{
serviceQName
=
new
QName
(
namespace
,
service_name
+
"Service"
);
while
(
err_count
<
5
)
{
wsdl_content
=
new
Scanner
(
new
URL
(
wsdlLocation
).
openStream
(),
"UTF-8"
).
useDelimiter
(
"\\A"
).
next
();
if
((
wsdl_content
==
null
)
||
(
wsdl_content
.
contains
(
"<html>"
))
||
(
wsdl_content
.
contains
(
"<body>"
)))
{
Thread
.
sleep
(
1000
);
err_count
++;
}
else
}
else
{
break
;
}
//System.out.println("[cfg] Service name: "+service_name+" - WSDL: "+wsdlLocation+" - Source URL: "+source_url);
s
=
Service
.
create
(
serviceUrl
,
serviceQName
);
retPort
=
(
T
)
s
.
getPort
(
client_class
);
BindingProvider
bp
=
(
BindingProvider
)
retPort
;
}
}
//System.out.println("[cfg] Service name: "+service_name+" - WSDL: "+wsdlLocation+" - Source URL: "+source_url);
s
=
Service
.
create
(
serviceUrl
,
serviceQName
);
retPort
=
s
.
getPort
(
client_class
);
BindingProvider
bp
=
(
BindingProvider
)
retPort
;
bp
.
getRequestContext
().
put
(
BindingProvider
.
ENDPOINT_ADDRESS_PROPERTY
,
source_url
);
return
retPort
;
}
return
retPort
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment