Save This Page
Home » geronimo-2.2-source-release » org.apache.geronimo.corba.security.config.css » [javadoc | source]
    1   /**
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  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   package org.apache.geronimo.corba.security.config.css;
   18   
   19   import java.io.Serializable;
   20   import java.util.ArrayList;
   21   import java.util.Iterator;
   22   import java.util.List;
   23   
   24   import org.apache.geronimo.corba.security.config.tss.TSSCompoundSecMechConfig;
   25   import org.apache.geronimo.corba.security.config.tss.TSSCompoundSecMechListConfig;
   26   
   27   
   28   /**
   29    * @version $Rev: 503274 $ $Date: 2007-02-03 10:19:18 -0800 (Sat, 03 Feb 2007) $
   30    */
   31   public class CSSCompoundSecMechListConfig implements Serializable {
   32   
   33       private boolean stateful;
   34       private final ArrayList mechs = new ArrayList();
   35   
   36       public boolean isStateful() {
   37           return stateful;
   38       }
   39   
   40       public void setStateful(boolean stateful) {
   41           this.stateful = stateful;
   42       }
   43   
   44       public void add(CSSCompoundSecMechConfig mech) {
   45           mechs.add(mech);
   46       }
   47   
   48       public CSSCompoundSecMechConfig mechAt(int i) {
   49           return (CSSCompoundSecMechConfig) mechs.get(i);
   50       }
   51   
   52       public int size() {
   53           return mechs.size();
   54       }
   55   
   56       public List findCompatibleSet(TSSCompoundSecMechListConfig mechList) {
   57           List result = new ArrayList();
   58   
   59           for (Iterator availMechs = mechs.iterator(); availMechs.hasNext();) {
   60               CSSCompoundSecMechConfig aConfig = (CSSCompoundSecMechConfig) availMechs.next();
   61   
   62               int size = mechList.size();
   63               for (int i = 0; i < size; i++) {
   64                   TSSCompoundSecMechConfig requirement = mechList.mechAt(i);
   65   
   66                   if (aConfig.canHandle(requirement)) {
   67                       result.add(aConfig);
   68                   }
   69               }
   70   
   71           }
   72   
   73           return result;
   74       }
   75   
   76       public String toString() {
   77           StringBuffer buf = new StringBuffer();
   78           toString("", buf);
   79           return buf.toString();
   80       }
   81   
   82       void toString(String spaces, StringBuffer buf) {
   83           buf.append(spaces).append("CSSCompoundSecMechListConfig: [\n");
   84           for (Iterator availMechs = mechs.iterator(); availMechs.hasNext();) {
   85               CSSCompoundSecMechConfig aConfig = (CSSCompoundSecMechConfig) availMechs.next();
   86               aConfig.toString(spaces + "  ", buf);
   87               buf.append("\n");
   88           }
   89           buf.append(spaces).append("]\n");
   90       }
   91   
   92   }

Save This Page
Home » geronimo-2.2-source-release » org.apache.geronimo.corba.security.config.css » [javadoc | source]