]> git.somenet.org - pub/jan/lsdc.git/blob - src/at/ac/tuwien/lsdc/federation/Federation.java
Federation now "works"
[pub/jan/lsdc.git] / src / at / ac / tuwien / lsdc / federation / Federation.java
1 package at.ac.tuwien.lsdc.federation;
2
3 import at.ac.tuwien.lsdc.types.Application;
4
5 /**
6  * Cloudpartners management. Class to be used to ask cloudpartners to take one
7  * of our APPs over to their infrastructure.
8  * 
9  * @author jan
10  * 
11  */
12 public class Federation {
13
14         private int numPartners;
15         public final static int fak = 100;
16         public final static int th = 20;
17
18         public Federation(int numPartners) {
19                 this.numPartners = numPartners;
20         }
21
22         /**
23          * Try to outsource app.
24          * 
25          * @param app
26          *          Application to outsource.
27          * @return true, if application can be outsourced.
28          */
29         public boolean askToOutsource(Application app) {
30                 for (int i = 0; i < numPartners; i++) {
31                         if (Math.random() * fak < th)
32                                 return true;
33                 }
34                 return false;
35         }
36
37 }