CAS Unit Tests
Clover coverage report - CAS Unit Tests
Coverage timestamp: Mon Jul 4 2005 18:13:17 CDT
file stats: LOC: 96   Methods: 8
NCLOC: 50   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ResourceActionsMap.java 0% 0% 0% 0%
coverage
 1    /*
 2    * Portions of this file Copyright 1999-2005 University of Chicago
 3    * Portions of this file Copyright 1999-2005 The University of Southern California.
 4    *
 5    * This file or a portion of this file is licensed under the
 6    * terms of the Globus Toolkit Public License, found at
 7    * http://www.globus.org/toolkit/download/license.html.
 8    * If you redistribute this file, with or without
 9    * modifications, you must include this notice in the file.
 10    */
 11    package org.globus.cas.impl.client;
 12   
 13    import java.util.Vector;
 14   
 15    /**
 16    * Class to store resource: actions mapping
 17    */
 18    public class ResourceActionsMap {
 19   
 20    private String resource;
 21    private Vector actions;
 22   
 23    /**
 24    * @param resource
 25    * Name of resource (stored as "Namespace|resourceName")
 26    * @param action
 27    * Service action (stored as "serviceType actionName")
 28    */
 29  0 public ResourceActionsMap(String resource, String action)
 30    throws Exception {
 31  0 if ((resource == null) ||
 32    ((action == null) || (action.trim().equals("")))) {
 33  0 throw new Exception("Resource and action cannot be null");
 34    }
 35  0 this.resource = resource;
 36  0 this.actions = new Vector();
 37  0 this.actions.add(action);
 38    }
 39   
 40    /**
 41    * @param resource
 42    * Name of resource (stored as "Namespace|resourceName")
 43    * @param actions
 44    * Vector of service actions (each action is stored as
 45    * "serviceType actionName")
 46    */
 47  0 ResourceActionsMap(String resource, Vector actions)
 48    throws Exception {
 49  0 if ((resource == null) || (actions == null)) {
 50  0 throw new Exception("Resource and action cannot be null");
 51    }
 52  0 this.resource = resource;
 53  0 this.actions = actions;
 54    }
 55   
 56    /**
 57    * @param action
 58    * Service action (stored as "serviceType actionName")
 59    */
 60  0 public void addAction(String action) {
 61  0 if ((action != null) && (!action.trim().equals("")))
 62  0 this.actions.add(action);
 63    }
 64   
 65    /*
 66    * @param actions
 67    * Vector of service actions (each action is stored as
 68    * "serviceType actionName")
 69    */
 70  0 public void addActions(Vector actions) {
 71  0 if (actions != null)
 72  0 this.actions.addAll(actions);
 73    }
 74   
 75  0 public String getResource() {
 76  0 return resource;
 77    }
 78   
 79  0 public String[] getActions() {
 80  0 String[] actionStrs = new String[actions.size()];
 81  0 actions.toArray(actionStrs);
 82  0 return actionStrs;
 83    }
 84   
 85  0 public Vector getActionsAsVector() {
 86  0 return actions;
 87    }
 88   
 89  0 public String toString() {
 90  0 String returnString = "Resource: " + resource + "\n Actions: \n";
 91  0 for (int i=0; i<actions.size(); i++) {
 92  0 returnString = returnString + (String)actions.get(i);
 93    }
 94  0 return returnString;
 95    }
 96    }