Skip to content

Commit 49b58ff

Browse files
committed
after thesis
1 parent 1568126 commit 49b58ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+7585
-0
lines changed

bin/cube-script-extension-2.0.jar

8.23 KB
Binary file not shown.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* Copyright 2011-2013 Adele Research Group (http://adele.imag.fr/)
3+
* LIG Laboratory (http://www.liglab.fr)
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
19+
package fr.liglab.adele.cube.extensions.core.resolvers;
20+
21+
import fr.liglab.adele.cube.extensions.AbstractUnaryResolver;
22+
import fr.liglab.adele.cube.extensions.Extension;
23+
import fr.liglab.adele.cube.metamodel.InvalidNameException;
24+
import fr.liglab.adele.cube.metamodel.ManagedElement;
25+
import fr.liglab.adele.cube.metamodel.PropertyExistException;
26+
import fr.liglab.adele.cube.metamodel.PropertyNotExistException;
27+
28+
/**
29+
* Author: debbabi
30+
* Date: 4/29/13
31+
* Time: 2:07 AM
32+
*/
33+
public class HasMaxInputComponents extends AbstractUnaryResolver {
34+
35+
public HasMaxInputComponents(Extension extension) {
36+
super(extension);
37+
}
38+
39+
public String getName() {
40+
return this.getClass().getSimpleName();
41+
}
42+
43+
public boolean check(ManagedElement me, String value) {
44+
if (me != null && value != null) {
45+
46+
if (value != null) {
47+
String pname = null;
48+
String pvalue = null;
49+
if (value.toString().contains("=")) {
50+
String[] tmp = value.toString().split("=");
51+
if (tmp != null && tmp.length==2) {
52+
pname = tmp[0];
53+
pvalue = tmp[1];
54+
}
55+
} else {
56+
pname = value.toString();
57+
}
58+
if (pvalue == null) {
59+
return me.hasAttribute(pname);
60+
} else {
61+
if (me.hasAttribute(pname) == false) {
62+
return false;
63+
} else {
64+
String attributeValue = me.getAttribute(pname);
65+
return attributeValue.equalsIgnoreCase(pvalue);
66+
}
67+
}
68+
}
69+
}
70+
return false;
71+
}
72+
73+
public boolean perform(ManagedElement me, String value) {
74+
if (me != null && value != null) {
75+
String pname = null;
76+
String pvalue = null;
77+
if (value.contains("=")) {
78+
String[] tmp = value.split("=");
79+
if (tmp != null && tmp.length==2) {
80+
pname = tmp[0];
81+
pvalue = tmp[1];
82+
}
83+
} else {
84+
pname = value;
85+
}
86+
if (pvalue == null) {
87+
return false;
88+
} else {
89+
if (me.hasAttribute(pname)) {
90+
try {
91+
me.updateAttribute(pname, pvalue);
92+
return true;
93+
} catch (PropertyNotExistException e) {
94+
e.printStackTrace();
95+
}
96+
} else {
97+
try {
98+
me.addAttribute(pname, pvalue);
99+
} catch (PropertyExistException e) {
100+
e.printStackTrace();
101+
} catch (InvalidNameException e) {
102+
e.printStackTrace();
103+
}
104+
}
105+
}
106+
107+
}
108+
return false;
109+
}
110+
111+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright 2011-2013 Adele Research Group (http://adele.imag.fr/)
3+
* LIG Laboratory (http://www.liglab.fr)
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
19+
package fr.liglab.adele.cube.extensions.core.resolvers;
20+
21+
import fr.liglab.adele.cube.extensions.AbstractUnaryResolver;
22+
import fr.liglab.adele.cube.extensions.Extension;
23+
import fr.liglab.adele.cube.extensions.core.model.Component;
24+
import fr.liglab.adele.cube.metamodel.*;
25+
26+
/**
27+
* Author: debbabi
28+
* Date: 4/29/13
29+
* Time: 2:07 AM
30+
*/
31+
public class HasMaxInstancesPerAM extends AbstractUnaryResolver {
32+
33+
public HasMaxInstancesPerAM(Extension extension) {
34+
super(extension);
35+
}
36+
37+
public String getName() {
38+
return this.getClass().getSimpleName();
39+
}
40+
41+
public boolean check(ManagedElement me, String value) {
42+
if (me != null && value != null) {
43+
Reference r = me.getReference(Component.CORE_COMPONENT_INPUTS);
44+
if (r != null) {
45+
return r.getReferencedElements().size() < new Integer(value);
46+
} else {
47+
return true;
48+
}
49+
}
50+
return false;
51+
}
52+
53+
public boolean perform(ManagedElement me, String value) {
54+
return true;
55+
}
56+
57+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright 2011-2013 Adele Research Group (http://adele.imag.fr/)
3+
* LIG Laboratory (http://www.liglab.fr)
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
19+
package fr.liglab.adele.cube.extensions.core.resolvers;
20+
21+
import fr.liglab.adele.cube.extensions.AbstractUnaryResolver;
22+
import fr.liglab.adele.cube.extensions.Extension;
23+
import fr.liglab.adele.cube.metamodel.ManagedElement;
24+
25+
/**
26+
* Author: debbabi
27+
* Date: 4/29/13
28+
* Time: 2:07 AM
29+
*/
30+
public class HasNode extends AbstractUnaryResolver {
31+
32+
public HasNode(Extension extension) {
33+
super(extension);
34+
}
35+
36+
public String getName() {
37+
return this.getClass().getSimpleName();
38+
}
39+
40+
public boolean check(ManagedElement me, String value) {
41+
if (me != null && value != null) {
42+
if (value.equalsIgnoreCase("true")) {
43+
String am1 = me.getAutonomicManager();
44+
String am2 = getExtension().getAutonomicManager().getUri();
45+
if (am1.equalsIgnoreCase(am2)) {
46+
return true;
47+
}
48+
}
49+
}
50+
return false;
51+
}
52+
53+
public boolean perform(ManagedElement me, String value) {
54+
if (me != null && value != null) {
55+
me.setAutonomicManager(value);
56+
return true;
57+
}
58+
return false;
59+
}
60+
61+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* Copyright 2011-2013 Adele Research Group (http://adele.imag.fr/)
3+
* LIG Laboratory (http://www.liglab.fr)
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
19+
package fr.liglab.adele.cube.extensions.core.resolvers;
20+
21+
import fr.liglab.adele.cube.extensions.AbstractUnaryResolver;
22+
import fr.liglab.adele.cube.extensions.Extension;
23+
import fr.liglab.adele.cube.metamodel.InvalidNameException;
24+
import fr.liglab.adele.cube.metamodel.ManagedElement;
25+
import fr.liglab.adele.cube.metamodel.PropertyExistException;
26+
import fr.liglab.adele.cube.metamodel.PropertyNotExistException;
27+
28+
/**
29+
* Author: debbabi
30+
* Date: 4/29/13
31+
* Time: 2:07 AM
32+
*/
33+
public class IsLocal extends AbstractUnaryResolver {
34+
35+
public IsLocal(Extension extension) {
36+
super(extension);
37+
}
38+
39+
public String getName() {
40+
return this.getClass().getSimpleName();
41+
}
42+
43+
public boolean check(ManagedElement me, String value) {
44+
if (me != null && value != null) {
45+
46+
if (value != null) {
47+
String pname = null;
48+
String pvalue = null;
49+
if (value.toString().contains("=")) {
50+
String[] tmp = value.toString().split("=");
51+
if (tmp != null && tmp.length==2) {
52+
pname = tmp[0];
53+
pvalue = tmp[1];
54+
}
55+
} else {
56+
pname = value.toString();
57+
}
58+
if (pvalue == null) {
59+
return me.hasAttribute(pname);
60+
} else {
61+
if (me.hasAttribute(pname) == false) {
62+
return false;
63+
} else {
64+
String attributeValue = me.getAttribute(pname);
65+
return attributeValue.equalsIgnoreCase(pvalue);
66+
}
67+
}
68+
}
69+
}
70+
return false;
71+
}
72+
73+
public boolean perform(ManagedElement me, String value) {
74+
if (me != null && value != null) {
75+
String pname = null;
76+
String pvalue = null;
77+
if (value.contains("=")) {
78+
String[] tmp = value.split("=");
79+
if (tmp != null && tmp.length==2) {
80+
pname = tmp[0];
81+
pvalue = tmp[1];
82+
}
83+
} else {
84+
pname = value;
85+
}
86+
if (pvalue == null) {
87+
return false;
88+
} else {
89+
if (me.hasAttribute(pname)) {
90+
try {
91+
me.updateAttribute(pname, pvalue);
92+
return true;
93+
} catch (PropertyNotExistException e) {
94+
e.printStackTrace();
95+
}
96+
} else {
97+
try {
98+
me.addAttribute(pname, pvalue);
99+
} catch (PropertyExistException e) {
100+
e.printStackTrace();
101+
} catch (InvalidNameException e) {
102+
e.printStackTrace();
103+
}
104+
}
105+
}
106+
107+
}
108+
return false;
109+
}
110+
111+
}

0 commit comments

Comments
 (0)