Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
frascati
frascati
Commits
aa2a501f
Commit
aa2a501f
authored
Aug 20, 2009
by
Christophe Demarey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update examples to use the FraSCAti MOJO.
parent
581879f2
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
109 additions
and
93 deletions
+109
-93
assembly-factory/maven-plugin/src/main/java/org/ow2/frascati/factory/FrascatiMojo.java
.../src/main/java/org/ow2/frascati/factory/FrascatiMojo.java
+78
-15
assembly-factory/tools/src/main/java/org/ow2/frascati/factory/Launcher.java
...ools/src/main/java/org/ow2/frascati/factory/Launcher.java
+0
-40
examples/calculator/server/pom.xml
examples/calculator/server/pom.xml
+0
-3
examples/counter-rest/client/pom.xml
examples/counter-rest/client/pom.xml
+0
-1
examples/counter-rest/server/pom.xml
examples/counter-rest/server/pom.xml
+0
-3
examples/dictionary/pom.xml
examples/dictionary/pom.xml
+1
-0
examples/helloworld-annotated/pom.xml
examples/helloworld-annotated/pom.xml
+1
-1
examples/helloworld-pojo/pom.xml
examples/helloworld-pojo/pom.xml
+1
-1
examples/helloworld-rmi/client/pom.xml
examples/helloworld-rmi/client/pom.xml
+0
-1
examples/helloworld-rmi/server/pom.xml
examples/helloworld-rmi/server/pom.xml
+0
-3
examples/helloworld-script/pom.xml
examples/helloworld-script/pom.xml
+1
-1
examples/helloworld-ws/client/pom.xml
examples/helloworld-ws/client/pom.xml
+0
-1
examples/helloworld-ws/server/pom.xml
examples/helloworld-ws/server/pom.xml
+0
-3
examples/isbn-test/pom.xml
examples/isbn-test/pom.xml
+1
-0
examples/pom.xml
examples/pom.xml
+22
-19
examples/twitter-rest/pom.xml
examples/twitter-rest/pom.xml
+1
-1
examples/twitter-weather/pom.xml
examples/twitter-weather/pom.xml
+1
-0
examples/verify-mail/pom.xml
examples/verify-mail/pom.xml
+1
-0
examples/weather/pom.xml
examples/weather/pom.xml
+1
-0
No files found.
assembly-factory/maven-plugin/src/main/java/org/ow2/frascati/factory/FrascatiMojo.java
View file @
aa2a501f
...
...
@@ -24,11 +24,15 @@
package
org.ow2.frascati.factory
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.logging.LogManager
;
import
org.apache.maven.artifact.Artifact
;
import
org.apache.maven.plugin.AbstractMojo
;
...
...
@@ -43,6 +47,14 @@ import org.apache.maven.project.MavenProject;
* @goal exec
*/
public
class
FrascatiMojo
extends
AbstractMojo
{
/**
* The path to the logging configuration file.
*
* @parameter expression="${loggingConfFile}"
* @required
* @since 1.1
*/
private
String
loggingConfFile
;
/**
* The name of the SCA composite to execute.
*
...
...
@@ -71,7 +83,14 @@ public class FrascatiMojo extends AbstractMojo {
* @parameter expression="${params}"
* @since 1.1
*/
private
String
[]
params
;
private
String
methodParams
;
/**
* List of method parameters with parameter children tags.
*
* @parameter expression="${parameters}"
* @since 1.1
*/
private
String
[]
methodParameters
;
/**
* The Maven project reference.
...
...
@@ -115,27 +134,71 @@ public class FrascatiMojo extends AbstractMojo {
return
list
.
toArray
(
new
URL
[
list
.
size
()]);
}
/**
* Tells if a MOJO parameter is empty or not.
*
* @param s A string parameter.
* @return True if the parameter is not filled.
*/
private
static
boolean
isEmpty
(
String
s
)
{
return
((
s
==
null
)
||
(
s
.
trim
().
isEmpty
()));
}
/**
* Parse method parameters specified either in the params tag or in the parameters tag.
*
* Return the list of parameters.
*/
private
String
[]
getMethodParams
()
throws
MojoFailureException
{
if
(
!
isEmpty
(
methodParams
)
)
{
// params tag is filled
if
(
methodParameters
.
length
>
0
)
throw
new
MojoFailureException
(
"You have to choose ONE (and only one) one way to specify parameters: "
+
"either <params> or <parameters> tag."
);
else
{
return
methodParams
.
split
(
" "
);
}
}
else
{
if
(
methodParameters
.
length
>
0
)
{
return
methodParameters
;
}
else
// else no parameters nor params
return
new
String
[
0
];
}
}
/**
* Launch the Runtime Factory with specified parameters.
*/
public
void
execute
()
throws
MojoExecutionException
,
MojoFailureException
{
try
{
LogManager
.
getLogManager
().
readConfiguration
(
new
FileInputStream
(
loggingConfFile
)
);
}
catch
(
Exception
e
)
{
getLog
().
warn
(
"Cannot load logging configuration file : "
+
loggingConfFile
);
}
String
[]
methodParams
=
getMethodParams
();
Launcher
launcher
=
new
Launcher
(
composite
,
new
Factory
(),
getClasspath
());
if
(
service
==
null
)
{
// Run in a server mode
System
.
out
.
println
(
"FraSCAti is running in a server mode..."
);
System
.
out
.
println
(
"Press Ctrl+C to quit..."
);
Thread
.
yield
();
if
(
isEmpty
(
service
)
)
{
// Run in a server mode
getLog
().
info
(
"FraSCAti is running in a server mode..."
);
getLog
().
info
(
"Press Ctrl+C to quit..."
);
try
{
System
.
in
.
read
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
else
{
System
.
out
.
println
(
"Calling the '"
+
service
+
"' service: "
);
System
.
out
.
println
(
"\tMethod '"
+
method
+
"'"
+
((
p
arams
.
length
==
0
)
?
""
:
" with params: "
+
pa
ra
m
s
.
toString
()));
if
(
p
arams
==
null
)
p
arams
=
new
String
[
0
];
Object
result
=
launcher
.
call
(
service
,
method
,
Object
.
class
,
p
arams
);
System
.
out
.
println
(
"Call done!"
);
if
(
result
!=
null
)
{
System
.
out
.
println
(
"Service response:"
);
System
.
out
.
println
(
result
);
getLog
().
info
(
"Calling the '"
+
service
+
"' service: "
);
getLog
().
info
(
"\tMethod '"
+
method
+
"'"
+
((
methodP
arams
.
length
==
0
)
?
""
:
" with params: "
+
Ar
ra
y
s
.
toString
(
methodParams
)));
if
(
methodP
arams
==
null
)
methodP
arams
=
new
String
[
0
];
Object
result
=
launcher
.
call
(
service
,
method
,
Object
.
class
,
methodP
arams
);
getLog
().
info
(
"Call done!"
);
if
(
result
!=
null
)
{
getLog
().
info
(
"Service response:"
);
getLog
().
info
(
result
.
toString
()
);
}
}
}
...
...
assembly-factory/tools/src/main/java/org/ow2/frascati/factory/Launcher.java
View file @
aa2a501f
...
...
@@ -191,44 +191,4 @@ public class Launcher {
}
}
//---------------------------------------------------------------------------
// Main method
// --------------------------------------------------------------------------
/**
* Build a launcher for an SCA composite and perform a call on a service. If
* no service is given, the Launcher runs in a server mode.
* <p>
* Usage:
* <code>Launcher compositeName [serviceName methodName [params]]</code>
*
* @param args
* an array containing, ordered as following:
* <ol>
* <li> the SCA composite name (required) <li> the service name <li>
* the method name <li> arguments of the method
* </ol>
*/
public
static
void
main
(
String
[]
args
)
{
if
(
args
.
length
==
0
)
{
throw
new
Error
(
"Please, provide a composite name."
);
}
Launcher
l
=
new
Launcher
(
args
[
0
]);
if
(
args
[
1
]
==
null
||
args
[
1
].
equals
(
""
))
{
// Run in a server mode
System
.
out
.
println
(
"FraSCAti is running in a server mode..."
);
System
.
out
.
println
(
"Press Ctrl+C to quit..."
);
Thread
.
yield
();
}
else
{
String
p
=
args
[
3
];
Object
[]
params
=
p
.
split
(
" "
);
System
.
out
.
println
(
"Calling the '"
+
args
[
1
]
+
"' service: "
);
System
.
out
.
println
(
"\tMethod '"
+
args
[
2
]
+
"'"
+
((
params
.
length
==
0
)
?
""
:
" with params: "
+
p
));
Object
result
=
l
.
call
(
args
[
1
],
args
[
2
],
Object
.
class
,
params
);
if
(
result
!=
null
)
{
System
.
out
.
println
(
"Service response:"
);
System
.
out
.
println
(
result
.
toString
());
}
}
}
}
examples/calculator/server/pom.xml
View file @
aa2a501f
...
...
@@ -45,9 +45,6 @@
<properties>
<composite.file>
soap-calc
</composite.file>
<service.name>
''
</service.name>
<method.name>
''
</method.name>
<method.params>
''
</method.params>
</properties>
</project>
examples/counter-rest/client/pom.xml
View file @
aa2a501f
...
...
@@ -47,7 +47,6 @@
<composite.file>
counter-client
</composite.file>
<service.name>
r
</service.name>
<method.name>
run
</method.name>
<method.params>
' '
</method.params>
</properties>
</project>
examples/counter-rest/server/pom.xml
View file @
aa2a501f
...
...
@@ -45,9 +45,6 @@
<properties>
<composite.file>
counter-server
</composite.file>
<service.name>
''
</service.name>
<method.name>
''
</method.name>
<method.params>
''
</method.params>
</properties>
</project>
examples/dictionary/pom.xml
View file @
aa2a501f
...
...
@@ -44,6 +44,7 @@
</parent>
<properties>
<logging.conf.file>
../../distribution/standalone/src/main/conf/logging.properties
</logging.conf.file>
<wsdl.file>
http://services.aonaware.com/DictService/DictService.asmx?wsdl
</wsdl.file>
<composite.file>
dictionary
</composite.file>
<service.name>
Dictionary
</service.name>
...
...
examples/helloworld-annotated/pom.xml
View file @
aa2a501f
...
...
@@ -43,10 +43,10 @@
</parent>
<properties>
<logging.conf.file>
../../distribution/standalone/src/main/conf/logging.properties
</logging.conf.file>
<composite.file>
helloworld-wired
</composite.file>
<service.name>
r
</service.name>
<method.name>
run
</method.name>
<method.params>
' '
</method.params>
</properties>
</project>
examples/helloworld-pojo/pom.xml
View file @
aa2a501f
...
...
@@ -43,10 +43,10 @@
</parent>
<properties>
<logging.conf.file>
../../distribution/standalone/src/main/conf/logging.properties
</logging.conf.file>
<composite.file>
helloworld-pojo
</composite.file>
<service.name>
r
</service.name>
<method.name>
run
</method.name>
<method.params>
' '
</method.params>
</properties>
</project>
examples/helloworld-rmi/client/pom.xml
View file @
aa2a501f
...
...
@@ -47,7 +47,6 @@
<composite.file>
helloworld-rmi-client
</composite.file>
<service.name>
r
</service.name>
<method.name>
run
</method.name>
<method.params>
' '
</method.params>
</properties>
</project>
examples/helloworld-rmi/server/pom.xml
View file @
aa2a501f
...
...
@@ -45,9 +45,6 @@
<properties>
<composite.file>
helloworld-rmi-server
</composite.file>
<service.name>
''
</service.name>
<method.name>
''
</method.name>
<method.params>
''
</method.params>
</properties>
</project>
examples/helloworld-script/pom.xml
View file @
aa2a501f
...
...
@@ -43,10 +43,10 @@
</parent>
<properties>
<logging.conf.file>
../../distribution/standalone/src/main/conf/logging.properties
</logging.conf.file>
<composite.file>
helloworld-script
</composite.file>
<service.name>
runnable
</service.name>
<method.name>
run
</method.name>
<method.params>
' '
</method.params>
</properties>
<repositories>
...
...
examples/helloworld-ws/client/pom.xml
View file @
aa2a501f
...
...
@@ -48,7 +48,6 @@
<composite.file>
helloworld-ws-client
</composite.file>
<service.name>
r
</service.name>
<method.name>
run
</method.name>
<method.params>
' '
</method.params>
</properties>
<build>
...
...
examples/helloworld-ws/server/pom.xml
View file @
aa2a501f
...
...
@@ -45,9 +45,6 @@
<properties>
<composite.file>
helloworld-ws-server
</composite.file>
<service.name>
''
</service.name>
<method.name>
''
</method.name>
<method.params>
''
</method.params>
</properties>
</project>
examples/isbn-test/pom.xml
View file @
aa2a501f
...
...
@@ -44,6 +44,7 @@
</parent>
<properties>
<logging.conf.file>
../../distribution/standalone/src/main/conf/logging.properties
</logging.conf.file>
<wsdl.file>
http://webservices.daehosting.com/services/isbnservice.wso?wsdl
</wsdl.file>
<composite.file>
isbntest
</composite.file>
<service.name>
Verifier
</service.name>
...
...
examples/pom.xml
View file @
aa2a501f
...
...
@@ -22,7 +22,7 @@
*
* Author: Nicolas Dolet
*
* Contributor(s): Philippe Merle
* Contributor(s): Philippe Merle
, Christophe Demarey
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
...
...
@@ -39,6 +39,7 @@
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<logging.conf.file>
../../../distribution/standalone/src/main/conf/logging.properties
</logging.conf.file>
</properties>
<build>
...
...
@@ -58,7 +59,7 @@
<dependencies>
<dependency>
<groupId>
org.ow2.frascati.factory
</groupId>
<artifactId>
frascati-factory-
tools
</artifactId>
<artifactId>
frascati-factory-
plugin
</artifactId>
<version>
${project.version}
</version>
</dependency>
...
...
@@ -87,26 +88,28 @@
<!-- To execute an SCA composite type 'mvn -Prun'. -->
<profile>
<id>
run
</id>
<build>
<defaultGoal>
exec:exec
</defaultGoal>
<plugins>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
exec-maven-plugin
</artifactId>
<plugins>
<plugin>
<groupId>
org.ow2.frascati.factory
</groupId>
<artifactId>
frascati-factory-plugin
</artifactId>
<executions>
<execution>
<phase>
package
</phase>
<goals>
<goal>
exec
</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>
java
</executable>
<arguments>
<argument>
-Djava.util.logging.config.file=../../distribution/standalone/src/main/conf/logging.properties
</argument>
<argument>
-classpath
</argument>
<classpath
/>
<argument>
org.ow2.frascati.factory.Launcher
</argument>
<argument>
${composite.file}
</argument>
<argument>
${service.name}
</argument>
<argument>
${method.name}
</argument>
<argument>
${method.params}
</argument>
</arguments>
<loggingConfFile>
${logging.conf.file}
</loggingConfFile>
<composite>
${composite.file}
</composite>
<service>
${service.name}
</service>
<method>
${method.name}
</method>
<methodParams>
${method.params}
</methodParams>
</configuration>
</plugin>
</plugin>
</plugins>
</build>
</profile>
...
...
examples/twitter-rest/pom.xml
View file @
aa2a501f
...
...
@@ -43,10 +43,10 @@
</parent>
<properties>
<logging.conf.file>
../../distribution/standalone/src/main/conf/logging.properties
</logging.conf.file>
<composite.file>
twitter-client
</composite.file>
<service.name>
r
</service.name>
<method.name>
run
</method.name>
<method.params>
' '
</method.params>
</properties>
</project>
examples/twitter-weather/pom.xml
View file @
aa2a501f
...
...
@@ -43,6 +43,7 @@
</parent>
<properties>
<logging.conf.file>
../../distribution/standalone/src/main/conf/logging.properties
</logging.conf.file>
<wsdl.file>
http://www.webservicex.net/globalweather.asmx?wsdl
</wsdl.file>
<composite.file>
twitter-weather
</composite.file>
<service.name>
tw
</service.name>
...
...
examples/verify-mail/pom.xml
View file @
aa2a501f
...
...
@@ -43,6 +43,7 @@
</parent>
<properties>
<logging.conf.file>
../../distribution/standalone/src/main/conf/logging.properties
</logging.conf.file>
<wsdl.file>
http://ws.xwebservices.com/XWebEmailValidation/V2/XWebEmailValidation.wsdl
</wsdl.file>
<composite.file>
verifymail
</composite.file>
<service.name>
Verifier
</service.name>
...
...
examples/weather/pom.xml
View file @
aa2a501f
...
...
@@ -44,6 +44,7 @@
</parent>
<properties>
<logging.conf.file>
../../distribution/standalone/src/main/conf/logging.properties
</logging.conf.file>
<wsdl.file>
http://www.webservicex.net/globalweather.asmx?wsdl
</wsdl.file>
<composite.file>
weather
</composite.file>
<service.name>
Weather
</service.name>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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