| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.apache.ws.scout.registry.infomodel; |
| 18 | |
|
| 19 | |
import java.util.ArrayList; |
| 20 | |
import java.util.Collection; |
| 21 | |
import java.util.Iterator; |
| 22 | |
|
| 23 | |
import javax.xml.registry.BusinessQueryManager; |
| 24 | |
import javax.xml.registry.JAXRException; |
| 25 | |
import javax.xml.registry.LifeCycleManager; |
| 26 | |
import javax.xml.registry.RegistryService; |
| 27 | |
import javax.xml.registry.UnexpectedObjectException; |
| 28 | |
import javax.xml.registry.infomodel.Organization; |
| 29 | |
import javax.xml.registry.infomodel.Service; |
| 30 | |
import javax.xml.registry.infomodel.ServiceBinding; |
| 31 | |
|
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
public class ServiceImpl extends RegistryEntryImpl implements Service |
| 39 | |
{ |
| 40 | |
|
| 41 | 116 | private Organization org = null; |
| 42 | 116 | private Collection<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>(); |
| 43 | 116 | private String orgKey = null; |
| 44 | |
|
| 45 | |
|
| 46 | |
|
| 47 | |
|
| 48 | |
public ServiceImpl(LifeCycleManager lifeCycleManager) |
| 49 | |
{ |
| 50 | 116 | super(lifeCycleManager); |
| 51 | 116 | } |
| 52 | |
|
| 53 | |
public void addServiceBinding(ServiceBinding sb) |
| 54 | |
throws JAXRException |
| 55 | |
{ |
| 56 | 56 | serviceBindings.add(sb); |
| 57 | 56 | ((ServiceBindingImpl)sb).setService(this); |
| 58 | 56 | } |
| 59 | |
|
| 60 | |
public void addServiceBindings(Collection col) |
| 61 | |
throws JAXRException |
| 62 | |
{ |
| 63 | |
try{ |
| 64 | 2 | Iterator iter = col.iterator(); |
| 65 | 4 | while(iter.hasNext()) |
| 66 | |
{ |
| 67 | 2 | addServiceBinding((ServiceBinding)iter.next()); |
| 68 | |
} |
| 69 | 0 | }catch(ClassCastException ce) |
| 70 | |
{ |
| 71 | 0 | throw new UnexpectedObjectException(ce.getLocalizedMessage()); |
| 72 | 2 | } |
| 73 | 2 | } |
| 74 | |
|
| 75 | |
public Organization getProvidingOrganization() |
| 76 | |
throws JAXRException |
| 77 | |
{ |
| 78 | 20 | if (org == null) { |
| 79 | 0 | if (super.getSubmittingOrganization() != null) { |
| 80 | 0 | return super.getSubmittingOrganization(); |
| 81 | |
} else { |
| 82 | 0 | RegistryService rs = super.getLifeCycleManager().getRegistryService(); |
| 83 | 0 | BusinessQueryManager bqm = rs.getBusinessQueryManager(); |
| 84 | 0 | if (orgKey==null) return null; |
| 85 | 0 | Organization o = (Organization) bqm.getRegistryObject(orgKey, |
| 86 | |
LifeCycleManager.ORGANIZATION); |
| 87 | 0 | setProvidingOrganization(o); |
| 88 | 0 | return o; |
| 89 | |
} |
| 90 | |
} |
| 91 | 20 | return org; |
| 92 | |
} |
| 93 | |
|
| 94 | |
public Collection getServiceBindings() throws JAXRException |
| 95 | |
{ |
| 96 | 30 | return serviceBindings; |
| 97 | |
} |
| 98 | |
|
| 99 | |
public void removeServiceBinding(ServiceBinding serviceBinding) |
| 100 | |
throws JAXRException |
| 101 | |
{ |
| 102 | 0 | serviceBindings.remove(serviceBinding); |
| 103 | 0 | } |
| 104 | |
|
| 105 | |
public void removeServiceBindings(Collection collection) |
| 106 | |
throws JAXRException |
| 107 | |
{ |
| 108 | 0 | serviceBindings.removeAll(collection); |
| 109 | 0 | } |
| 110 | |
|
| 111 | |
public void setProvidingOrganization(Organization organization) |
| 112 | |
throws JAXRException |
| 113 | |
{ |
| 114 | 46 | this.org = organization; |
| 115 | 46 | } |
| 116 | |
|
| 117 | |
public void setSubmittingOrganizationKey(String key) { |
| 118 | 20 | orgKey = key; |
| 119 | 20 | } |
| 120 | |
|
| 121 | |
public String getSubmittingOrganizationKey() { |
| 122 | 0 | return orgKey; |
| 123 | |
} |
| 124 | |
} |