1 9 package org.jboss.portal.server.plugins.mode; 10 11 import java.util.HashSet ; 12 import java.util.Iterator ; 13 import java.util.Set ; 14 15 import org.jboss.portal.common.metadata.MetaData; 16 import org.jboss.portal.common.plugin.PluginContainer; 17 import org.jboss.portal.server.metadata.ModesMetaData; 18 import org.jboss.portal.server.plugins.PluginService; 19 20 24 public class Modes 25 extends PluginService 26 implements ModeProvider 27 { 28 29 30 protected Set modes; 31 32 33 protected PluginContainer container; 34 35 36 protected ModesMetaData metaData; 37 38 public Set getModes() 39 { 40 return modes; 41 } 42 43 public boolean containsMode(Mode mode) 44 { 45 return modes.contains(mode); 46 } 47 48 public void addMode(Mode mode) 49 { 50 modes.add(mode); 51 } 52 53 public void removeMode(Mode mode) 54 { 55 modes.remove(mode); 56 } 57 58 public void setPluginContainer(PluginContainer container) 59 { 60 this.container = container; 61 } 62 63 public PluginContainer getPluginContainer() 64 { 65 return container; 66 } 67 68 public void start() throws Exception 69 { 70 modes = new HashSet (); 71 for (Iterator i = this.metaData.getModes().iterator();i.hasNext();) 72 { 73 String modeAsString = (String )i.next(); 74 Mode mode = Mode.create(modeAsString); 75 modes.add(mode); 76 } 77 } 78 79 public void setMetaData(MetaData metaData) 80 { 81 this.metaData = (ModesMetaData)metaData; 82 } 83 84 public MetaData getMetaData() 85 { 86 return metaData; 87 } 88 } 89 | Popular Tags |