| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ComponentService |
|
| 1.0;1 |
| 1 | /** | |
| 2 | * Copyright 2005-2011 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php | |
| 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 | package org.kuali.rice.core.api.component; | |
| 17 | ||
| 18 | import org.kuali.rice.core.api.CoreConstants; | |
| 19 | import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; | |
| 20 | ||
| 21 | import javax.jws.WebMethod; | |
| 22 | import javax.jws.WebParam; | |
| 23 | import javax.jws.WebResult; | |
| 24 | import javax.jws.WebService; | |
| 25 | import javax.jws.soap.SOAPBinding; | |
| 26 | import javax.xml.bind.annotation.XmlElement; | |
| 27 | import javax.xml.bind.annotation.XmlElementWrapper; | |
| 28 | import java.util.List; | |
| 29 | ||
| 30 | /** | |
| 31 | * Defines the contract for a service which can be used to interact with the Rice core component store. | |
| 32 | * | |
| 33 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 34 | */ | |
| 35 | @WebService(name = "componentService", targetNamespace = CoreConstants.Namespaces.CORE_NAMESPACE_2_0) | |
| 36 | @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) | |
| 37 | public interface ComponentService { | |
| 38 | ||
| 39 | @WebMethod(operationName = "getComponentByCode") | |
| 40 | @WebResult(name = "component") | |
| 41 | Component getComponentByCode( | |
| 42 | @WebParam(name = "namespaceCode") String namespaceCode, | |
| 43 | @WebParam(name = "componentCode") String componentCode | |
| 44 | ) throws RiceIllegalArgumentException; | |
| 45 | ||
| 46 | @WebMethod(operationName = "getAllComponentsByNamespaceCode") | |
| 47 | @WebResult(name = "components") | |
| 48 | @XmlElementWrapper(name = "components", required = true) | |
| 49 | @XmlElement(name = "component", required = false) | |
| 50 | List<Component> getAllComponentsByNamespaceCode( | |
| 51 | @WebParam(name = "namespaceCode") String namespaceCode | |
| 52 | ) throws RiceIllegalArgumentException; | |
| 53 | ||
| 54 | @WebMethod(operationName = "getActiveComponentsByNamespaceCode") | |
| 55 | @WebResult(name = "components") | |
| 56 | @XmlElementWrapper(name = "components", required = true) | |
| 57 | @XmlElement(name = "component", required = false) | |
| 58 | List<Component> getActiveComponentsByNamespaceCode( | |
| 59 | @WebParam(name = "namespaceCode") String namespaceCode | |
| 60 | ) throws RiceIllegalArgumentException; | |
| 61 | ||
| 62 | @WebMethod(operationName = "getDerivedComponentSet") | |
| 63 | @WebResult(name = "components") | |
| 64 | @XmlElementWrapper(name = "components", required = true) | |
| 65 | @XmlElement(name = "component", required = false) | |
| 66 | List<Component> getDerivedComponentSet(@WebParam(name = "componentSetId") String componentSetId) throws RiceIllegalArgumentException; | |
| 67 | ||
| 68 | /** | |
| 69 | * Publishes the given set of derived components to make them available to the component system. It should only | |
| 70 | * ever be necessary to invoke this service whenever published components for an application change. However, it is | |
| 71 | * always safe to invoke this method even if the client cannot make this determination as the implementation of this | |
| 72 | * service should be responsible for handling the given information and ignoring it if no publication needs to | |
| 73 | * occur. To this end, this method should be idempotent. | |
| 74 | * | |
| 75 | * <p>When invoked, the set of components known to the component system for the given component set id will be | |
| 76 | * replaced with the given list. Any previously published components for the component set id which are not | |
| 77 | * contained within the given list will be deleted.</p> | |
| 78 | * | |
| 79 | * <p>The {@code componentSetId} should be an identifier generated by the client application which uniquely | |
| 80 | * identifies the component set being published (either newly published or updated). A simple value to use would | |
| 81 | * be the {@code applicationId} of the client application but this would mean an application could only ever publish | |
| 82 | * a single custom component set. So the {@code applicationId} could also be combined with some additional | |
| 83 | * information on the source of the components being published if a particular application needs to publish custom | |
| 84 | * components from multiple sources.</p> | |
| 85 | * | |
| 86 | * <p>The {@code componentSetId} on each of the components supplied in the list must either be null or equal to the | |
| 87 | * component set id that is passed to this method, otherwise an {@code IllegalArgumentException} will be thrown.</p> | |
| 88 | * | |
| 89 | * @param componentSetId an id that uniquely identifies this set of components being checked. The service will use | |
| 90 | * this to track the components being published | |
| 91 | * @param components the components to publish, may be empty or null, in which case all published components for the | |
| 92 | * given component set id will be deleted from the component system if any exist | |
| 93 | * | |
| 94 | * @throws RiceIllegalArgumentException if componentSetId is a null or blank value | |
| 95 | * @throws RiceIllegalArgumentException if any of the components in the given list have a non-null componentSetId | |
| 96 | * which does not match the componentSetId parameter supplied to this method | |
| 97 | */ | |
| 98 | @WebMethod(operationName = "publishDerivedComponents") | |
| 99 | void publishDerivedComponents(@WebParam(name = "componentSetId") String componentSetId, | |
| 100 | @WebParam(name = "components") List<Component> components) throws RiceIllegalArgumentException; | |
| 101 | ||
| 102 | } |