001: /*
002: * Copyright 2000-2001,2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: /*
018:
019: */
020:
021: package org.apache.wsrp4j.producer.provider.driver;
022:
023: import java.util.Iterator;
024: import java.util.LinkedList;
025:
026: import org.apache.wsrp4j.producer.provider.ConsumerConfiguredPortlet;
027: import org.apache.wsrp4j.producer.provider.ProducerOfferedPortlet;
028:
029: /**
030: * <p>This class implements the ProducerOfferedPortlet interface encapsulating
031: * ProducerOfferedPortlet-objects. Provides setters and getters.</p>
032: *
033: * @author <a href="mailto:stefan.behl@de.ibm.com">Stefan Behl</a>
034: *
035: * @see ProducerOfferedPortlet
036: */
037: public class ProducerOfferedPortletImpl extends PortletImpl implements
038: ProducerOfferedPortlet {
039: // handle ID
040: private String handle = "";
041:
042: // boolean, if registration is required or not
043: private boolean requiresRegistration = false;
044:
045: // list of clone handles for this ProducerOfferedPortlet
046: public LinkedList cloneHandles = null;
047:
048: /**
049: * constructor
050: */
051: public ProducerOfferedPortletImpl() {
052: cloneHandles = new LinkedList();
053: }
054:
055: /**
056: * Returns the portletHandle.
057: *
058: * @return A String representing the portletHandle.
059: */
060: public String getPortletHandle() {
061: return this .handle;
062: }
063:
064: /**
065: * Returns a flag indicating whether registration is required or not.
066: *
067: * @return Boolean flag.
068: */
069: public boolean isRegistrationRequired() {
070: return this .requiresRegistration;
071: }
072:
073: /**
074: * Sets the flag indicating whether registration is required or not.
075: *
076: * @param required Boolean to be assigned to the requiresReg.-flag.
077: */
078: public void setRegistrationRequired(boolean required) {
079: this .requiresRegistration = required;
080: }
081:
082: /**
083: * Sets the portletHandle to enable identification of the portlet.
084: *
085: * @param portletHandle String to be assigned to handle.
086: */
087: public void setPortletHandle(String portletHandle) {
088: this .handle = portletHandle;
089: }
090:
091: /**
092: * Adds a clone referencing a ConsumerConfiguredPortlet.
093: *
094: */
095: public void addClone(ConsumerConfiguredPortlet cce) {
096: cloneHandles.add(cce);
097: }
098:
099: /**
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: }
|