/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.tuscany.sca.assembly.impl; import java.util.ArrayList; import java.util.List; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.Callback; import org.apache.tuscany.sca.assembly.EventTarget; import org.apache.tuscany.sca.assembly.EventTypes; import org.apache.tuscany.sca.assembly.Producer; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.policy.PolicySet; /** * Represents a producer. * * @version $$ */ public class ProducerImpl extends ContractImpl implements Producer { private String name; private EventTypes theEventTypes = new EventTypesImpl(); private ArrayList bindings = new ArrayList(); private ArrayList targets = new ArrayList(); private ArrayList applicablePolicySets = new ArrayList(); private ArrayList policySets = new ArrayList(); public String getName() { return name; } public void setName(String name) { this.name = name; } /** * Sets the EventTypes handled by the target */ public void setEventTypes( EventTypes eventTypes) { theEventTypes = eventTypes; } // end setEventTypes /** * Gets the EventTypes handled by the target */ public EventTypes getEventType() { return theEventTypes; } // end getEventType public List getTargets() { return targets; } public List getApplicablePolicySets() { return applicablePolicySets; } public List getPolicySets() { return policySets; } public B getBinding(Class bindingClass) { for (Binding binding : bindings) { if (bindingClass.isInstance(binding)) { return bindingClass.cast(binding); } } return null; } public List getBindings() { return bindings; } public Callback getCallback() { return null; } public B getCallbackBinding(Class bindingClass) { return null; } public InterfaceContract getInterfaceContract(Binding binding) { return getInterfaceContract(); } public void setCallback(Callback callback) { } @Override @SuppressWarnings("unchecked") public Object clone() throws CloneNotSupportedException { ProducerImpl clone = (ProducerImpl)super.clone(); clone.applicablePolicySets = (ArrayList)applicablePolicySets.clone(); clone.policySets = (ArrayList)policySets.clone(); clone.bindings = (ArrayList)bindings.clone(); clone.targets = (ArrayList)targets.clone(); return clone; } }