source: fedd/abac-src/ttg/process/StrategyFactory.java @ 8780cbec

axis_examplecompt_changesinfo-opsversion-1.30version-2.00version-3.01version-3.02
Last change on this file since 8780cbec was 8780cbec, checked in by Jay Jacobs <Jay.Jacobs@…>, 15 years ago

ABAC sources from Cobham

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package com.nailabs.abac.process;
2
3import java.util.*;
4
5/**
6 * Factory for creating a specific strategy.
7 */
8public class StrategyFactory {
9
10    public static Strategy getStrategy(HashMap config) {
11        Strategy strat = null;
12        System.out.println("config = " + config);
13        Properties props = (Properties)config.get("Strategy");
14        String type = props.getProperty("type");
15        NegotiationContext context = (NegotiationContext)config.get("context");
16        if(type == null) {                 // if no config then use default
17            strat = new Strategy(context);
18            System.out.print("Creating default strategy for ");
19        } else if(type.equalsIgnoreCase("Stingy")) { 
20            // stingy strategy construction
21            StingyStrategy stingy = new StingyStrategy(context, props);
22            System.out.print("Creating stingy strategy for ");
23            strat = stingy;
24        } else {                           // default strategy construction
25            strat = new Strategy(context);
26            System.out.print("Creating default strategy for ");
27        }
28        System.out.println(context.getSelf());
29        return strat;
30    }
31
32}
Note: See TracBrowser for help on using the repository browser.