Fields Summary |
---|
private Document | mDocDocument object of the XML config file. |
private DescriptorEndpointInfo[] | mEPListList of endpoints in the SU jbi.xml. |
private int | mNoOfConsumersNumber of consumers. |
private int | mNoOfProvidersNumber of providers. |
private String | mTypeType of deployment, WSDL, XML or WSDL11 |
private String | mSu_Name |
private EndpointRegistry | registry |
private static final String | prefix_NS |
private static final String | ept_Mappings |
private Map | wsdlEndpts |
private Map | jbiEndpts |
Methods Summary |
---|
int | getConsumerCount()Returns the number of consumer endpoints.
return mNoOfConsumers;
|
DescriptorEndpointInfo[] | getEndpoints()
return mEPList;
|
private java.lang.String | getLocalName(java.lang.String qname)Gets the local name from the quname.
StringTokenizer tok = new StringTokenizer(qname, ":");
if (tok.countTokens() == 1) {
return qname;
}
tok.nextToken();
return tok.nextToken();
|
private java.lang.String | getNamespace(java.lang.String qname)Gets the namespace from the qname.
StringTokenizer tok = new StringTokenizer(qname, ":");
String prefix;
if (tok.countTokens() == 1) {
return "";
}
prefix = tok.nextToken();
NamedNodeMap map = mDoc.getDocumentElement().getAttributes();
for (int j = 0; j < map.getLength(); j++) {
Node n = map.item(j);
if (n.getLocalName().trim().equals(prefix.trim())) {
return n.getNodeValue();
}
}
return "";
|
int | getProviderCount()Returns the number of provider endpoints.
return mNoOfProviders;
|
java.lang.String | getType()Gets the type of artifact
return mType;
|
void | init(org.w3c.dom.Document doc)Initializes the config file and loads services.
mDoc = doc;
mDoc.getDocumentElement().normalize();
load();
|
void | load()Loads the data.
NodeList providers = mDoc.getElementsByTagName("provides");
mNoOfProviders = providers.getLength();
NodeList consumers = mDoc.getElementsByTagName("consumes");
mNoOfConsumers = consumers.getLength();
mEPList = new DescriptorEndpointInfo[mNoOfConsumers + mNoOfProviders];
setArtifacts();
for (int i = 0; i < mNoOfProviders; i++) {
Node node = providers.item(i);
DescriptorEndpointInfo sb = new DescriptorEndpointInfo(mSu_Name);
setEndpoint(node, sb);
sb.setProvider();
mEPList[i] = sb;
}
for (int i = 0; i < mNoOfConsumers; i++) {
Node node = consumers.item(i);
DescriptorEndpointInfo sb = new DescriptorEndpointInfo(mSu_Name);
setEndpoint(node, sb);
mEPList[i + mNoOfProviders] = sb;
}
NodeList eptMappings = mDoc.getElementsByTagNameNS(prefix_NS, ept_Mappings);
if(eptMappings.getLength() > 0)
eptMappings = eptMappings.item(0).getChildNodes();
for(int i = 0; i < eptMappings.getLength(); i++) {
if(!eptMappings.item(i).getNodeName().contains("ept-mapping"))
continue;
NodeList nList = eptMappings.item(i).getChildNodes();
DescriptorEndpointInfo dei = new DescriptorEndpointInfo(mSu_Name);
DescriptorEndpointInfo dei1 = new DescriptorEndpointInfo(mSu_Name);
for (int j = 0; j < nList.getLength(); j++) {
Node node = nList.item(j);
if(node.getNodeName().contains("java-ept")) {
setEndpoint(node, dei);
String type =
node.getAttributes().getNamedItem("type").getNodeValue();
if(type.equals("provider")) {
dei.setProvider();
dei1.setProvider();
}
} else if(node.getNodeName().contains("wsdl-ept"))
setEndpoint(node, dei1);
}
wsdlEndpts.put(dei.getKey(), dei1);
jbiEndpts.put(dei1.getKey(), dei);
}
if (!wsdlEndpts.isEmpty()) {
for (int i = 0; i < mEPList.length; i++) {
DescriptorEndpointInfo dei = mEPList[i];
if(wsdlEndpts.get(dei.getKey())!=null)
mEPList[i] = wsdlEndpts.get(dei.getKey());
}
}
|
private void | setArtifacts()
NodeList namelist = mDoc.getElementsByTagNameNS("*", "artifactstype");
if (namelist == null) {
/* This means the tag is not present. default type is WSDL20
*/
setType("WSDL20");
return;
}
Element name = (Element) namelist.item(0);
String sValue;
try {
sValue = (name.getChildNodes().item(0)).getNodeValue().trim();
} catch (NullPointerException ne) {
setType("WSDL20");
return;
}
setType(sValue);
|
private void | setEndpoint(org.w3c.dom.Node node, DescriptorEndpointInfo ep)Sets the endpoitn attributes.
NamedNodeMap map = node.getAttributes();
String epname = map.getNamedItem("endpoint-name").getNodeValue();
String sername = map.getNamedItem("service-name").getNodeValue();
String intername = map.getNamedItem("interface-name").getNodeValue();
ep.setServiceName(new QName(getNamespace(sername), getLocalName(sername)));
ep.setInterfaceName(new QName(getNamespace(intername), getLocalName(intername)));
ep.setEndpointName(epname);
|
private void | setType(java.lang.String type)Sets the type of artifact.
mType = type;
|