ProducerOfferedPortletImpl.java |
1 /* 2 * Copyright 2000-2001,2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /* 18 19 */ 20 21 package org.apache.wsrp4j.producer.provider.driver; 22 23 import java.util.Iterator; 24 import java.util.LinkedList; 25 26 import org.apache.wsrp4j.producer.provider.ConsumerConfiguredPortlet; 27 import org.apache.wsrp4j.producer.provider.ProducerOfferedPortlet; 28 29 /** 30 * <p>This class implements the ProducerOfferedPortlet interface encapsulating 31 * ProducerOfferedPortlet-objects. Provides setters and getters.</p> 32 * 33 * @author <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a> 34 * 35 * @see ProducerOfferedPortlet 36 */ 37 public class ProducerOfferedPortletImpl extends PortletImpl implements 38 ProducerOfferedPortlet { 39 // handle ID 40 private String handle = ""; 41 42 // boolean, if registration is required or not 43 private boolean requiresRegistration = false; 44 45 // list of clone handles for this ProducerOfferedPortlet 46 public LinkedList cloneHandles = null; 47 48 /** 49 * constructor 50 */ 51 public ProducerOfferedPortletImpl() { 52 cloneHandles = new LinkedList(); 53 } 54 55 /** 56 * Returns the portletHandle. 57 * 58 * @return A String representing the portletHandle. 59 */ 60 public String getPortletHandle() { 61 return this.handle; 62 } 63 64 /** 65 * Returns a flag indicating whether registration is required or not. 66 * 67 * @return Boolean flag. 68 */ 69 public boolean isRegistrationRequired() { 70 return this.requiresRegistration; 71 } 72 73 /** 74 * Sets the flag indicating whether registration is required or not. 75 * 76 * @param required Boolean to be assigned to the requiresReg.-flag. 77 */ 78 public void setRegistrationRequired(boolean required) { 79 this.requiresRegistration = required; 80 } 81 82 /** 83 * Sets the portletHandle to enable identification of the portlet. 84 * 85 * @param portletHandle String to be assigned to handle. 86 */ 87 public void setPortletHandle(String portletHandle) { 88 this.handle = portletHandle; 89 } 90 91 /** 92 * Adds a clone referencing a ConsumerConfiguredPortlet. 93 * 94 */ 95 public void addClone(ConsumerConfiguredPortlet cce) { 96 cloneHandles.add(cce); 97 } 98 99 /** 100 * Deletes a clone referencing a ConsumerConfiguredPortlet. 101 * 102 * @param cce String representing the portlet-handle of the 103 * corresponding ConsumerConfiguredPortlet. 104 */ 105 public void deleteClone(ConsumerConfiguredPortlet cce) { 106 if (cloneHandles.remove(cce)) { 107 } 108 } 109 110 /** 111 * Returns an iterator containing all clone-handles. 112 * 113 * @return Iterator 114 */ 115 public Iterator getClones() { 116 return cloneHandles.iterator(); 117 } 118 119 /** 120 * Redefines the clone-method of the Cloneable-interface. This is necessary 121 * as the clone-method is declared protected in the Object class. 122 * 123 * @return Object representing the cloned object. 124 */ 125 public Object clone() { 126 127 ConsumerConfiguredPortlet clone = new ConsumerConfiguredPortletImpl(); 128 129 clone.setParentHandle(handle); 130 131 return clone; 132 } 133 134 }