Commit 1a751dc7 authored by Alexandre GICQUEL's avatar Alexandre GICQUEL
Browse files

add m0

parent cdeaeb35
/M1/
/M2/
/M2Bis/
/M1sousCouche/
/Component/
/M0.class
import M1.Client;
import M1.Server;
import M1.SimpleCs;
public class M0 {
public static void main(String[] args) {
Server myServer = new Server("myServer");
SimpleCs mySystem = new SimpleCs("mySystel",myServer, 1);
Client myClient = (Client) mySystem.getListComponent().get(1);
System.out.println(myClient.getNomComponent());
//String r = myClient.serviceSend("1+1");
//System.out.println(r);
}
}
package M1;
import M2Bis.Component;
import M2Bis.Service;
public class Client extends Component {
public Client(String nomComponent, Service serviceFournis) {
super(nomComponent, serviceFournis);
this.getListPortCompRequis().add("receiveRequest");
public Client(String nomComponent) {
super(nomComponent);
this.getListPortCompRequis().add("sendRequest");
}
public String serviceSend(String x) {
this.getListPortCompRequis().set(0, x);
while(this.getListPortCompRequis().get(0) == "sendRequest"
||this.getListPortCompRequis().get(0) == x)
{
}
x = this.getListPortCompRequis().get(0);
this.getListPortCompRequis().set(0, "sendRequest");
return x;
}
}
......@@ -6,6 +6,18 @@ public class RPC extends Connector {
public RPC(String nomConnector) {
super(nomConnector, "called", "caller");
/*while(true) {
if(this.getRoleRequis()!="caller"
&& this.getRoleRequis()!="2") {
this.setRoleFournis(this.getRoleRequis());
this.setRoleRequis("caller");
}
if(this.getRoleFournis()!="called"
&& this.getRoleFournis()!="1+1") {
this.setRoleRequis(this.getRoleFournis());
this.setRoleFournis("called");
}
}*/
}
......
......@@ -6,6 +6,18 @@ public class ReceiveCalled extends AttachementReqFour {
public ReceiveCalled(String portCompRequis, String roleFournis) {
super(portCompRequis, roleFournis);
/*while(true) {
if(this.getRoleFournis()!="called"
&&this.getRoleFournis()!="2" ) {
this.setPortCompRequis(this.getRoleFournis());
this.setRoleFournis("called");
}
if(this.getPortCompRequis()!="receiveRequest"
&&this.getPortCompRequis()!="1+1") {
this.setRoleFournis(this.getPortCompRequis());
this.setPortCompRequis("receiveRequest");
}
}*/
}
}
......@@ -7,6 +7,18 @@ public class SendCaller extends AttachementFourReq {
public SendCaller(String portCompFournis, String roleRequis) {
super(portCompFournis, roleRequis);
/*while(true) {
if(this.getPortCompFournis()!="sendRequest"
&& this.getPortCompFournis()!="2" ) {
this.setRoleRequis(this.getPortCompFournis());
this.setPortCompFournis("sendRequest");
}
if(this.getRoleRequis()!="caller"
&& this.getRoleRequis()!="1+1") {
this.setPortCompFournis(this.getRoleRequis());
this.setRoleRequis("caller");
}
}*/
}
}
package M1;
import M1sousCouche.ServerDetail;
import M2Bis.Component;
import M2Bis.Service;
public class Server extends Component {
public Server(String nomComponent, Service serviceFournis, int nbClient) {
super(nomComponent, serviceFournis);
for(int i = 0;i<nbClient;i++) {
this.getListPortCompFournis().add("sendRequest"+i);
public Server(String nomComponent) {
super(nomComponent);
this.getListPortCompFournis().add("receiveRequest");
ServerDetail sDetail = new ServerDetail("serveurDetail",this.getListPortCompFournis().get(0));
this.setConfiguration(sDetail);
/*while(true) {
if(this.getListPortCompFournis().get(0)!="receiveRequest"
&&this.getListPortCompFournis().get(0)!="2") {
this.serviceServer(getListPortCompFournis().get(0));
}
}*/
}
public void serviceServer(String x) {
if(x == "1+1") {
this.getListPortCompRequis().set(0, "2");
}
// ServerDetail sDetail = new ServerDetail();
// this.setConfiguration(sDetail);
}
}
package M1;
import M2Bis.Component;
import M2Bis.Configuration;
public class ServerDetail extends Configuration {
connectionManager
securityManager
dataBase
connector :
- CMToSM
- SMToDB
- BMToSM
attachement :
- securityCheckToCallerCM
- CheckQueryToCallerDB
- QueryInterrogationToCallerCM
- SecurityAuthentificationToCalledCM
- SecurityManagementToCalledSM
- DBQueryToCalledDB
Binding : ReceiverRequestExternalSocket
public ServerDetail(String nomConfiguration, Component component) {
super(nomConfiguration, component);
// TODO Auto-generated constructor stub
}
}
package M1;
import java.util.ArrayList;
import M2Bis.Component;
import M2Bis.Configuration;
import M2Bis.Service;
public class SimpleCs extends Configuration {
public SimpleCs(String nomConfiguration, Server server,int nbClient) {
super(nomConfiguration, server);
for(int i=1;i<=nbClient;i++) {
Service serviceClient = new Service("ServiceClient"+i); // crer classe service pour changer la methode execution
Client client = new Client("Client"+i,serviceClient);
this.listComponent.add(client);
for(int i=0;i<nbClient;i++) {
Client client = new Client("Client"+i);
this.getListComponent().add(client);
RPC link = new RPC("RPC"+i);
this.listConnector.add(link);
this.getListConnector().add(link);
ReceiveCalled rCalled = new ReceiveCalled(client.getListPortCompRequis().get(0),
link.getRoleFournis());
this.listAttachement.add(rCalled);
SendCaller sCaller = new SendCaller(server.getListPortCompFournis().get(i),
this.getListAttachement().add(rCalled);
SendCaller sCaller = new SendCaller(server.getListPortCompFournis().get(0),
link.getRoleRequis());
this.listAttachement.add(sCaller);
this.getListAttachement().add(sCaller);
}
}
......
package M1sousCouche;
import M2Bis.Connector;
public class CMtoSM extends Connector{
public CMtoSM(String nomConnector) {
super(nomConnector, "calledCM", "callerSM");
}
}
package M1sousCouche;
import M2Bis.AttachementFourReq;
public class CheckQueryToCallerDB extends AttachementFourReq {
public CheckQueryToCallerDB(String portCompFournis, String roleRequis) {
super(portCompFournis, roleRequis);
}
}
package M1sousCouche;
import M2Bis.Component;
public class ConnectionManager extends Component {
public ConnectionManager(String nom) {
super(nom);
this.getListPortCompFournis().add("SecurityCheck");
this.getListPortCompRequis().add("ExternalSocket");
this.getListPortCompRequis().add("DBQuery");
}
}
package M1sousCouche;
import M2Bis.AttachementReqFour;
public class DBQueryToCalledDB extends AttachementReqFour {
public DBQueryToCalledDB(String portCompRequis, String roleFournis) {
super(portCompRequis, roleFournis);
}
}
package M1sousCouche;
import M2Bis.Connector;
public class DBtoCM extends Connector {
public DBtoCM(String nomConnector) {
super(nomConnector, "calledDB", "callerCM");
}
}
package M1sousCouche;
import M2Bis.Component;
public class DataBase extends Component {
public DataBase(String nom) {
super(nom);
this.getListPortCompFournis().add("QueryInterrogation");
this.getListPortCompRequis().add("SecurityManagement");
}
}
\ No newline at end of file
package M1sousCouche;
import M2Bis.AttachementFourReq;
public class QueryInterrogationToCallerCM extends AttachementFourReq {
public QueryInterrogationToCallerCM(String portCompFournis, String roleRequis) {
super(portCompFournis, roleRequis);
// TODO Auto-generated constructor stub
}
}
package M1sousCouche;
import M2Bis.BindingRequis;
public class ReceiverRequestExternalSocket extends BindingRequis {
public ReceiverRequestExternalSocket(String portConfRequis, String portCompRequis) {
super(portConfRequis, portCompRequis);
}
}
package M1sousCouche;
import M2Bis.Connector;
public class SMtoDB extends Connector {
public SMtoDB(String nomConnector) {
super(nomConnector, "calledSM", "callerDB");
}
}
package M1sousCouche;
import M2Bis.AttachementReqFour;
public class SecurityAuthentificationToCalledCM extends AttachementReqFour {
public SecurityAuthentificationToCalledCM(String portCompRequis, String roleFournis) {
super(portCompRequis, roleFournis);
// TODO Auto-generated constructor stub
}
}
package M1sousCouche;
import M2Bis.AttachementFourReq;
public class SecurityCheckToCallerSM extends AttachementFourReq {
public SecurityCheckToCallerSM(String portCompFournis, String roleRequis) {
super(portCompFournis, roleRequis);
// TODO Auto-generated constructor stub
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment