Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
frascati
frascati
Commits
64bbb48a
Commit
64bbb48a
authored
Mar 19, 2013
by
Gwenael Cattez
Browse files
Impacted commit, refactoring of introspection module
for more details see README.txt
parent
4a8f143d
Changes
69
Hide whitespace changes
Inline
Side-by-side
frascati/modules/frascati-introspection/frascati-introspection-api/pom.xml
View file @
64bbb48a
...
...
@@ -195,6 +195,14 @@ public class Node</value>
<artifactId>
fractal-api
</artifactId>
<version>
${fractal-api.version}
</version>
</dependency>
<!-- OW2 FraSCAti Assembly Factory -->
<dependency>
<groupId>
org.ow2.frascati
</groupId>
<artifactId>
frascati-assembly-factory
</artifactId>
<version>
${project.version}
</version>
</dependency>
</dependencies>
</project>
frascati/modules/frascati-introspection/frascati-introspection-api/src/main/java/org/ow2/frascati/remote/introspection/Deployment.java
View file @
64bbb48a
/**
*
* OW2 FraSCAti Introspection
* Copyright (C) 20
08-2011 INRIA
, University of Lille 1
*
/**
* OW2 FraSCAti Introspection
API
* Copyright (C) 20
13 Inria
, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
...
...
@@ -14,13 +14,17 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Contact: frascati@ow2.org
*
* Authors: Christophe Demarey
*
* Contributor(s): Gwenael Cattez
*
*
*/
package
org.ow2.frascati.remote.introspection
;
import
javax.ws.rs.DELETE
;
...
...
@@ -39,6 +43,16 @@ import org.ow2.frascati.remote.introspection.stringlist.StringList;
@Service
public
interface
Deployment
{
/**
* Get the composite file names from a zip ( useful because reading jar is complicated for some clients)
* Http method is POST because of the size of the encodedComposite
* @return a long string compose with the name of the different composite file name separate by %S%
*/
@POST
@Path
(
"/util/getCompositesName"
)
@Produces
({
"text/plain"
})
public
String
getCompositeEntriesFromJar
(
@FormParam
(
"jar"
)
String
encodedComposite
);
/**
* Deploy a contribution on the FraSCAti runtime.
*
...
...
@@ -74,15 +88,5 @@ public interface Deployment
@Path
(
"/undeploy/composite/{id:.*}"
)
@Produces
({
"text/plain"
})
public
int
undeployComposite
(
@PathParam
(
"id"
)
String
fullCompositeId
);
/**
* Get the composite file names from a zip ( useful because reading jar is complicated for some clients)
* Http method is POST because of the size of the encodedComposite
* @return a long string compose with the name of the different composite file name separate by %S%
*/
@POST
@Path
(
"/util/getCompositesName"
)
@Produces
({
"text/plain"
})
public
String
getCompositeEntriesFromJar
(
@FormParam
(
"jar"
)
String
encodedComposite
);
}
frascati/modules/frascati-introspection/frascati-introspection-api/src/main/java/org/ow2/frascati/remote/introspection/RemoteScaDomain.java
View file @
64bbb48a
/**
* OW2 FraSCAti Introspection
* Copyright (C) 20
08-2011 INRIA
, University of Lille 1
*
* OW2 FraSCAti Introspection
API
* Copyright (C) 20
13 Inria
, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
...
...
@@ -14,8 +14,9 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Contact: frascati@ow2.org
*
* Author: Christophe Demarey
...
...
@@ -163,6 +164,8 @@ public interface RemoteScaDomain
public
void
addBinding
(
@PathParam
(
"id"
)
String
fullInterfaceId
,
MultivaluedMap
<
String
,
String
>
params
);
/**
* DEPRECATED
*
* Remove a binding at a position from a Fractal interface
*
* @param id, id of the fractal interface that hold the binding
...
...
@@ -173,6 +176,18 @@ public interface RemoteScaDomain
@Produces
({
"text/plain"
})
public
void
removeBinding
(
@PathParam
(
"id"
)
String
fullInterfaceId
,
@QueryParam
(
"position"
)
String
position
);
/**
* Remove a binding at a position from a Fractal interface
*
* @param id, id of the fractal interface that hold the binding
* @param params the parameter of the binding to remove
*/
@DELETE
@Path
(
"/binding/tocome/{id:.*}/"
)
@Consumes
(
"application/x-www-form-urlencoded"
)
@Produces
({
"text/plain"
})
public
void
removeBinding
(
@PathParam
(
"id"
)
String
fullInterfaceId
,
MultivaluedMap
<
String
,
String
>
params
);
/**
* Set an attribute of a binding hold by a Fractal Component
*
...
...
@@ -185,4 +200,18 @@ public interface RemoteScaDomain
@Path
(
"/binding/{id:.*}/"
)
@Produces
({
"text/plain"
})
public
void
setBindingAttribute
(
@PathParam
(
"id"
)
String
fullInterfaceId
,
@QueryParam
(
"position"
)
String
position
,
@QueryParam
(
"attribute"
)
String
attribute
,
@QueryParam
(
"newValue"
)
String
newValue
);
/**
* Set an attribute of a binding hold by a Fractal Component
*
* @param id, id of the fractal interface that will be modified
* @param position , position of the binding in the binding list of the interface
* @param attribute, the name of the attribute to change
* @param newValue, the new value to assign
*/
@PUT
@Path
(
"/binding/tocome/{id:.*}/{attribute}/{newValue}"
)
@Consumes
(
"application/x-www-form-urlencoded"
)
@Produces
({
"text/plain"
})
public
void
setBindingAttribute
(
@PathParam
(
"id"
)
String
fullInterfaceId
,
MultivaluedMap
<
String
,
String
>
params
,
@PathParam
(
"attribute"
)
String
attribute
,
@PathParam
(
"newValue"
)
String
newValue
);
}
frascati/modules/frascati-introspection/frascati-introspection-
impl
/src/
test
/java/org/ow2/frascati/remote/introspection/in
formationsTests/GetInterfac
e.java
→
frascati/modules/frascati-introspection/frascati-introspection-
api
/src/
main
/java/org/ow2/frascati/remote/introspection/
b
in
ding/BindingAttribut
e.java
View file @
64bbb48a
/**
* OW2 FraSCAti
Assembly Factory
* Copyright (C) 20
08-2012
Inria, University of Lille
*
* OW2 FraSCAti
Introspection API
* Copyright (C) 20
13
Inria, University of Lille
1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
...
...
@@ -14,42 +14,57 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Contact: frascati@ow2.org
*
* Author: Gwnal Cattez
* Author: Gw
e
na
e
l Cattez
*
* Contributor(s):
*
*/
package
org.ow2.frascati.remote.introspection.informationsTests
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
package
org.ow2.frascati.remote.introspection.binding
;
import
org.junit.BeforeClass
;
import
org.junit.Test
;
import
org.ow2.frascati.remote.introspection.IntrospectionAllTest
;
import
org.ow2.frascati.remote.introspection.resources.Port
;
/**
*
*/
public
class
GetInterfac
e
public
class
BindingAttribut
e
{
@BeforeClass
public
static
void
startTest
()
private
String
name
;
private
String
clazz
;
private
String
value
;
public
BindingAttribute
(
String
name
,
Class
<?>
clazz
,
Object
value
)
{
this
.
name
=
name
;
this
.
clazz
=
clazz
.
getName
();
if
(
value
==
null
)
{
this
.
value
=
"undefined value"
;
}
else
{
this
.
value
=
value
.
toString
();
}
}
public
String
getName
()
{
System
.
out
.
println
(
"-- Get Interface Tests"
)
;
return
name
;
}
@Test
public
final
void
testGetInterface
()
public
String
getClazz
()
{
System
.
out
.
println
(
"** Getting port on org.ow2.frascati.FraSCAti/component-factory/membrane-generation component..."
);
Port
p
=
IntrospectionAllTest
.
domain
.
getInterface
(
"org.ow2.frascati.FraSCAti/component-factory/membrane-generation"
);
assertNotNull
(
p
);
return
clazz
;
}
public
String
getValue
()
{
return
value
;
}
}
frascati/modules/frascati-introspection/frascati-introspection-api/src/main/java/org/ow2/frascati/remote/introspection/binding/BindingBundle.java
0 → 100644
View file @
64bbb48a
/**
* OW2 FraSCAti Introspection API
* Copyright (C) 2013 Inria, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Contact: frascati@ow2.org
*
* Author: Gwenael Cattez
*
* Contributor(s):
*
*/
package
org.ow2.frascati.remote.introspection.binding
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf
;
/**
*
*/
public
class
BindingBundle
{
private
HashMap
<
BindingProcessorItf
,
List
<
Object
>>
processorMap
;
private
boolean
isReferenceBinding
;
public
BindingBundle
()
{
this
.
processorMap
=
new
HashMap
<
BindingProcessorItf
,
List
<
Object
>>();
this
.
isReferenceBinding
=
false
;
}
public
void
setReferenceBinding
(
boolean
isReferenceBinding
)
{
this
.
isReferenceBinding
=
isReferenceBinding
;
}
public
boolean
isReferenceBinding
()
{
return
isReferenceBinding
;
}
public
void
addBinding
(
BindingProcessorItf
processor
,
Object
boundedObject
)
{
List
<
Object
>
boundedObjects
=
processorMap
.
get
(
processor
);
if
(
boundedObjects
==
null
)
{
boundedObjects
=
new
ArrayList
<
Object
>();
processorMap
.
put
(
processor
,
boundedObjects
);
}
boundedObjects
.
add
(
boundedObject
);
}
public
boolean
isEmpty
()
{
return
processorMap
.
isEmpty
();
}
public
List
<
BindingProcessorItf
>
getProcessors
()
{
return
new
ArrayList
<
BindingProcessorItf
>(
processorMap
.
keySet
());
}
public
List
<
Object
>
getBoundedObjects
()
{
List
<
Object
>
boundedObjects
=
new
ArrayList
<
Object
>();
for
(
BindingProcessorItf
processor
:
processorMap
.
keySet
())
{
boundedObjects
.
addAll
(
processorMap
.
get
(
processor
));
}
return
boundedObjects
;
}
public
List
<
Object
>
getBoundedObjects
(
BindingProcessorItf
processor
)
{
return
processorMap
.
get
(
processor
);
}
@Override
public
String
toString
()
{
StringBuilder
stringBuilder
=
new
StringBuilder
(
"BindingBundle for "
);
stringBuilder
.
append
(
isReferenceBinding
?
"reference"
:
"service"
);
stringBuilder
.
append
(
" :\n"
);
for
(
BindingProcessorItf
key
:
processorMap
.
keySet
())
{
stringBuilder
.
append
(
"\t"
+
key
.
getBindingKind
().
name
()+
"\n"
);
for
(
Object
o
:
processorMap
.
get
(
key
))
{
stringBuilder
.
append
(
"\t\t"
+
o
.
getClass
().
getName
()+
"\n"
);
}
}
return
stringBuilder
.
toString
();
}
}
frascati/modules/frascati-introspection/frascati-introspection-api/src/main/java/org/ow2/frascati/remote/introspection/binding/BindingManagerItf.java
0 → 100644
View file @
64bbb48a
/**
* OW2 FraSCAti Introspection API
* Copyright (C) 2013 Inria, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Contact: frascati@ow2.org
*
* Author: Gwenael Cattez
*
* Contributor(s):
*
*/
package
org.ow2.frascati.remote.introspection.binding
;
import
java.util.Map
;
import
org.objectweb.fractal.api.Interface
;
import
org.objectweb.fractal.api.NoSuchInterfaceException
;
import
org.ow2.frascati.remote.introspection.binding.exception.NoBindingKindException
;
import
org.ow2.frascati.remote.introspection.binding.exception.UnsupportedBindingComponentException
;
import
org.ow2.frascati.remote.introspection.binding.exception.UnsupportedBindingException
;
import
org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorException
;
import
org.ow2.frascati.remote.introspection.binding.processor.BindingProcessorItf
;
import
org.ow2.frascati.remote.introspection.resources.BindingKind
;
/**
* TODO doc
*/
public
interface
BindingManagerItf
{
/**
* Get the BindingProcessor for kind (WS,REST,SCA...)
*
* @param kind of processed binding
* @return BindingProcessorItf for king
* @throws UnsupportedBindingException if no Processor is found
*/
public
BindingProcessorItf
getBindingProcessor
(
String
kind
)
throws
UnsupportedBindingException
;
/**
* Get the BindingProcessor for kind (WS,REST,SCA...)
*
* @param BindingKind of processed binding
* @return BindingProcessorItf for bindingKind
* @throws UnsupportedBindingException if no BindingProcessor is found
*/
public
BindingProcessorItf
getBindingProcessor
(
BindingKind
bindingKing
)
throws
UnsupportedBindingException
;
/**
* Get the BindingProcessor used to generate the component Object
* ie, give the BindingProcessor related to a stub or skelton object
*
* @param component the stub or skelton from a Binding
* @return BindingProcessorItf used to process component
* @throws UnsupportedBindingComponentException if no BindingProcessor is found
*/
public
BindingProcessorItf
getBindingProcessor
(
Object
component
)
throws
UnsupportedBindingComponentException
;
/**
* Get the BindingBundle related to a fractal Interface
* This bundle contains description of all Binding found for itf
* @see org.ow2.frascati.remote.introspection.binding.BindingBundle
*
* @param itf fractal interface
* @return BindingBundle related to itf
* @throws NoSuchInterfaceException TODO
*/
public
BindingBundle
getBindingBundle
(
Interface
itf
)
throws
NoSuchInterfaceException
;
/**
* Add a binding to a fractal interface based on hints
*
* @param itf the fractal interface to bind
* @param itfPath the full path of the interface
* @param stringHints the parameters of the binding to add
* @throws NoBindingKindException if no kind parameter is found in hints
* @throws UnsupportedBindingException if no BindingProcessor can be found for kind
* @throws BindingProcessorException if problems occur during binding instantiation
*/
public
void
bind
(
Interface
itf
,
String
itfPath
,
Map
<
String
,
String
>
stringHints
)
throws
NoBindingKindException
,
UnsupportedBindingException
,
BindingProcessorException
;
/**
* Remove the binding found at position on fractal interface
*
* @param itf the fractal interface
* @param itfPath the full path of the interface
* @param position position of the binding
* @throws BindingProcessorException if problems occur during unbinding phase
* @throws UnsupportedBindingComponentException if no BindingProcessor can be found to process unbind
*/
public
void
unbind
(
Interface
itf
,
String
itfPath
,
int
position
)
throws
BindingProcessorException
,
UnsupportedBindingComponentException
;
/**
* Remove the binding with hints stringHints found on a fractal interface
*
* @param itf the fractal interface
* @param itfPath the full path of the interface
* @param stringHints hints of the binding to remove
* @throws BindingProcessorException if problems occur during unbinding phase
* @throws UnsupportedBindingComponentException if no BindingProcessor can be found to process unbind
*/
public
void
unbind
(
Interface
itf
,
String
itfPath
,
Map
<
String
,
String
>
stringHints
)
throws
NoBindingKindException
,
UnsupportedBindingException
,
BindingProcessorException
;
/**
* Set attribute value to newValue on binding found on fractal interface at position
*
* @param itf the fractal interface
* @param position position of the binding
* @param attribute the name of the attribute to set
* @param newValue the new value for attribute
* @throws BindingProcessorException if problems occur during setting attribute phase
* @throws UnsupportedBindingComponentException if no BindingProcessor can be found to process set attribute action
*/
public
void
setBindingAttribute
(
Interface
itf
,
int
position
,
String
attribute
,
String
newValue
)
throws
BindingProcessorException
,
UnsupportedBindingComponentException
;
/**
* Set attribute value to newValue on binding with hints stringHints on fractal interface
*
* @param itf the fractal interface
* @param stringHints hints of the binding to set attribute
* @param attribute the name of the attribute to set
* @param newValue the new value for attribute
* @throws BindingProcessorException if problems occur during setting attribute phase
* @throws UnsupportedBindingComponentException if no BindingProcessor can be found to process set attribute action
*/
public
void
setBindingAttribute
(
Interface
itf
,
Map
<
String
,
String
>
stringHints
,
String
attribute
,
String
newValue
)
throws
NoBindingKindException
,
UnsupportedBindingException
,
BindingProcessorException
;
}
frascati/modules/frascati-introspection/frascati-introspection-
impl
/src/
test
/java/org/ow2/frascati/remote/introspection/
deployementTests/DeployTestSuite
.java
→
frascati/modules/frascati-introspection/frascati-introspection-
api
/src/
main
/java/org/ow2/frascati/remote/introspection/
binding/exception/NoBindingKindException
.java
View file @
64bbb48a
/**
* OW2 FraSCAti
Assembly Factory
* Copyright (C) 20
08-2012
Inria, University of Lille
*
* OW2 FraSCAti
Introspection API
* Copyright (C) 20
13
Inria, University of Lille
1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
...
...
@@ -14,34 +14,29 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Contact: frascati@ow2.org
*
* Author: Gw
�
na
�
l Cattez
* Author: Gw
e
na
e
l Cattez
*
* Contributor(s):
*
*/
package
org.ow2.frascati.remote.introspection.deployementTests
;
import
org.junit.BeforeClass
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.Suite
;
import
org.junit.runners.Suite.SuiteClasses
;
package
org.ow2.frascati.remote.introspection.binding.exception
;
/**
*
*/
@RunWith
(
Suite
.
class
)
@SuiteClasses
({
DeployContribution
.
class
,
DeployJar
.
class
,
UndeployComposite
.
class
})
public
class
DeployTestSuite
public
class
NoBindingKindException
extends
Exception