Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
prisma-wildfly
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Descartes Research
prisma-wildfly
Commits
1d041ca8
Commit
1d041ca8
authored
8 years ago
by
Simon Spinner
Browse files
Options
Downloads
Patches
Plain Diff
Add support for application external calls.
parent
198792a7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools.descartes.prisma.agent.wildfly/src/main/java/tools/descartes/prisma/agent/wildfly/service/ModelExtractionService.java
+64
-45
64 additions, 45 deletions
.../prisma/agent/wildfly/service/ModelExtractionService.java
with
64 additions
and
45 deletions
tools.descartes.prisma.agent.wildfly/src/main/java/tools/descartes/prisma/agent/wildfly/service/ModelExtractionService.java
+
64
−
45
View file @
1d041ca8
...
...
@@ -419,11 +419,26 @@ public class ModelExtractionService extends AgentController implements Service<M
}
RepositoryComponent
callerComponent
=
implementationComponent
;
// 4. Now add the called component (if applicable)
// 4. Check if this is a call that goes to a destination outside of the
// system.
InterfaceRequiringRole
systemRequiringRole
=
null
;
if
(
callerRequiringRole
!=
null
)
{
String
systemRequiringRoleName
=
getSystemInterfaceRequiringRoleName
(
outgoingIrec
);
systemRequiringRole
=
RepositoryFactory
.
eINSTANCE
.
createInterfaceRequiringRole
();
systemRequiringRole
.
setName
(
toName
(
systemRequiringRoleName
));
systemRequiringRole
.
setInterface
(
outgoingInterface
);
systemRequiringRole
=
ModelSkeletonUtil
.
find
(
((
ApplicationScope
)
getContainerScope
()).
getApplication
().
getInterfaceRequiringRoles
(),
systemRequiringRole
);
}
// 5. Now add the called component (if applicable)
// IMPORTANT: Only do this if the call is within the same application
// (i.e., systemRequiringRole == null)
InterfaceProvidingRole
calledProvidingRole
=
null
;
RepositoryComponent
calledComponent
=
null
;
boolean
differentModule
=
false
;
if
(
callerRequiringRole
!=
null
)
{
if
(
callerRequiringRole
!=
null
&&
systemRequiringRole
==
null
)
{
differentModule
=
isDifferentModule
(
incomingCrec
,
outgoingCrec
);
calledComponent
=
createCalledComponent
(
outgoingCrec
,
differentModule
);
String
calledProvingRoleName
;
...
...
@@ -453,7 +468,7 @@ public class ModelExtractionService extends AgentController implements Service<M
}
}
//
5
. Now wrap the implementation in a composite component (if
//
6
. Now wrap the implementation in a composite component (if
// necessary)
CompositeComponent
compositeComponent
=
createCompositeComponent
(
incomingCrec
,
callerComponent
);
AssemblyContext
innerAssemblyContext
=
null
;
...
...
@@ -512,28 +527,30 @@ public class ModelExtractionService extends AgentController implements Service<M
requiringConnector
.
setAssemblyContext
(
innerAssemblyContext
);
ModelSkeletonUtil
.
insert
(
compositeComponent
.
getRequiringDelegationConnectors
(),
requiringConnector
);
}
else
{
// Local call: Also add an assembly context for the called
// component within the composite component
// and connect it with an assembly connector.
AssemblyContext
calledAssembly
=
addAssemblyContext
(
compositeComponent
,
outgoingCrec
,
calledComponent
);
AssemblyConnector
connector
=
RepositoryFactory
.
eINSTANCE
.
createAssemblyConnector
();
connector
.
setName
(
toName
(
innerAssemblyContext
.
getName
()
+
" -> "
+
calledAssembly
.
getName
()));
connector
.
setInterfaceProvidingRole
(
calledProvidingRole
);
connector
.
setInterfaceRequiringRole
(
callerRequiringRole
);
connector
.
setProvidingAssemblyContext
(
calledAssembly
);
connector
.
setRequiringAssemblyContext
(
innerAssemblyContext
);
ModelSkeletonUtil
.
insert
(
compositeComponent
.
getAssemblyConnectors
(),
connector
);
if
(
calledComponent
!=
null
)
{
// Local call: Also add an assembly context for the
// called component within the composite component
// and connect it with an assembly connector.
AssemblyContext
calledAssembly
=
addAssemblyContext
(
compositeComponent
,
outgoingCrec
,
calledComponent
);
AssemblyConnector
connector
=
RepositoryFactory
.
eINSTANCE
.
createAssemblyConnector
();
connector
.
setName
(
toName
(
innerAssemblyContext
.
getName
()
+
" -> "
+
calledAssembly
.
getName
()));
connector
.
setInterfaceProvidingRole
(
calledProvidingRole
);
connector
.
setInterfaceRequiringRole
(
callerRequiringRole
);
connector
.
setProvidingAssemblyContext
(
calledAssembly
);
connector
.
setRequiringAssemblyContext
(
innerAssemblyContext
);
ModelSkeletonUtil
.
insert
(
compositeComponent
.
getAssemblyConnectors
(),
connector
);
}
}
}
callerRequiringRole
=
remoteRequiringRole
;
callerComponent
=
compositeComponent
;
}
//
6
. Now create the assembly contexts
//
7
. Now create the assembly contexts
AssemblyContext
callerContext
=
addAssemblyContext
(
skeleton
.
getSystem
(),
incomingCrec
,
callerComponent
);
if
(
calle
rRequiringRole
!=
null
)
{
if
(
calle
dComponent
!=
null
)
{
AssemblyContext
calledContext
=
addAssemblyContext
(
skeleton
.
getSystem
(),
outgoingCrec
,
calledComponent
);
AssemblyConnector
connector
=
RepositoryFactory
.
eINSTANCE
.
createAssemblyConnector
();
...
...
@@ -543,9 +560,21 @@ public class ModelExtractionService extends AgentController implements Service<M
connector
.
setProvidingAssemblyContext
(
calledContext
);
connector
.
setRequiringAssemblyContext
(
callerContext
);
ModelSkeletonUtil
.
insert
(
skeleton
.
getSystem
().
getAssemblyConnectors
(),
connector
);
}
else
if
(
systemRequiringRole
!=
null
)
{
// This is a call to a component in a different application
systemRequiringRole
=
ModelSkeletonUtil
.
adopt
(
this
,
systemRequiringRole
);
skeleton
.
getSystem
().
getInterfaceRequiringRoles
().
add
(
systemRequiringRole
);
RequiringDelegationConnector
systemRequiringConnector
=
RepositoryFactory
.
eINSTANCE
.
createRequiringDelegationConnector
();
systemRequiringConnector
.
setName
(
toName
(
callerContext
.
getName
()));
systemRequiringConnector
.
setInnerInterfaceRequiringRole
(
callerRequiringRole
);
systemRequiringConnector
.
setOuterInterfaceRequiringRole
(
systemRequiringRole
);
systemRequiringConnector
.
setAssemblyContext
(
callerContext
);
ModelSkeletonUtil
.
insert
(
skeleton
.
getSystem
().
getRequiringDelegationConnectors
(),
systemRequiringConnector
);
}
//
7
. Expose the provided remote interfaces as system interfaces (if
//
8
. Expose the provided remote interfaces as system interfaces (if
// this port is marked as system interface)
String
systemProvidingRoleName
=
getInterfaceProvidingRoleName
(
incomingIrec
,
callerContext
.
getName
());
// Do not create a new providing/requiring role for the system, only use
...
...
@@ -572,31 +601,7 @@ public class ModelExtractionService extends AgentController implements Service<M
ModelSkeletonUtil
.
insert
(
skeleton
.
getSystem
().
getProvidingDelegationConnectors
(),
systemProvidingConnector
);
}
if
(
callerRequiringRole
!=
null
)
{
String
systemRequiringRoleName
=
getInterfaceRequiringRoleName
(
outgoingIrec
,
callerContext
.
getName
());
InterfaceRequiringRole
systemRequiringRole
=
RepositoryFactory
.
eINSTANCE
.
createInterfaceRequiringRole
();
systemRequiringRole
.
setName
(
toName
(
systemRequiringRoleName
));
systemRequiringRole
.
setInterface
(
outgoingInterface
);
systemRequiringRole
=
ModelSkeletonUtil
.
find
(
((
ApplicationScope
)
getContainerScope
()).
getApplication
().
getInterfaceRequiringRoles
(),
systemRequiringRole
);
if
(
systemRequiringRole
!=
null
)
{
systemRequiringRole
=
ModelSkeletonUtil
.
adopt
(
this
,
systemRequiringRole
);
skeleton
.
getSystem
().
getInterfaceRequiringRoles
()
.
add
(
ModelSkeletonUtil
.
adopt
(
this
,
systemRequiringRole
));
RequiringDelegationConnector
systemRequiringConnector
=
RepositoryFactory
.
eINSTANCE
.
createRequiringDelegationConnector
();
systemRequiringConnector
.
setName
(
toName
(
callerContext
.
getName
()));
systemRequiringConnector
.
setInnerInterfaceRequiringRole
(
callerRequiringRole
);
systemRequiringConnector
.
setOuterInterfaceRequiringRole
(
systemRequiringRole
);
systemRequiringConnector
.
setAssemblyContext
(
callerContext
);
ModelSkeletonUtil
.
insert
(
skeleton
.
getSystem
().
getRequiringDelegationConnectors
(),
systemRequiringConnector
);
}
}
// 8. Add sensor descriptions for application metrics
// 9. Add sensor descriptions for application metrics
List
<
AssemblyContext
>
instancePath
=
new
LinkedList
<>();
instancePath
.
add
(
callerContext
);
if
(
innerAssemblyContext
!=
null
)
{
...
...
@@ -604,7 +609,7 @@ public class ModelExtractionService extends AgentController implements Service<M
}
addSensors
(
incomingIrec
,
outgoingIrec
,
instancePath
,
innerCallerProvidingRole
,
incomingSignature
,
externalCall
);
//
9
. Remember to deploy this context (only for the caller component)
//
10
. Remember to deploy this context (only for the caller component)
undeployedAssemblyContexts
.
add
(
callerContext
);
}
...
...
@@ -938,6 +943,20 @@ public class ModelExtractionService extends AgentController implements Service<M
return
res
.
toString
();
}
private
String
getSystemInterfaceRequiringRoleName
(
InvocationRecord
record
)
{
StringBuilder
res
=
new
StringBuilder
();
res
.
append
(
record
.
getOperation
().
getProtocol
());
res
.
append
(
"://"
);
res
.
append
(
record
.
getOperation
().
getComponent
().
getServerNode
());
res
.
append
(
"/"
);
if
(!
record
.
getOperation
().
getComponent
().
getApplication
().
isEmpty
())
{
res
.
append
(
record
.
getOperation
().
getComponent
().
getApplication
());
res
.
append
(
"/"
);
}
res
.
append
(
record
.
getOperation
().
getComponent
().
getComponentName
());
return
res
.
toString
();
}
private
String
getInterfaceRequiringRoleName
(
InvocationRecord
record
,
String
assembly
)
{
StringBuilder
res
=
new
StringBuilder
();
res
.
append
(
record
.
getOperation
().
getProtocol
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment