private void buildCapabilityList() { capabilityList = new ArrayList<ExtendedCapability>(); // System.out.println("Selected Resource: " + resourceIndex); ExtendedRegistry tempExtendedRegistry = this.extendedRegistryList.get(resourceIndex); Resource tempResource = tempExtendedRegistry.getResource(); XmlObject tempObject = tempResource.copy(); XmlObject xmlObjectCapabilityChild[] = tempObject.selectChildren(new QName("", "capability")); Capability capabilityTemp = null; ExtendedCapability extendedCapabilityTemp = null; for (int j = 0; j < xmlObjectCapabilityChild.length; j++) { try { capabilityTemp = Capability.Factory.parse(xmlObjectCapabilityChild[j].xmlText()); extendedCapabilityTemp = new ExtendedCapability(j, capabilityTemp); } catch (XmlException e) { // TODO Auto-generated catch block e.printStackTrace(); } capabilityList.add(extendedCapabilityTemp); } }
public void setResourceIndex(int resourceIndex) { System.out.println("Selected Resource: " + resourceIndex); selectedExtendedRegistry = extendedRegistryList.get(resourceIndex); System.out.println(selectedExtendedRegistry.getResource().getTitle()); this.resourceIndex = resourceIndex; }
private void buildTableNameList() { databaseNode = new TreeNodeImpl(); TreeNodeImpl tableNode; tableList = new ArrayList<XmlObject>(); columnList = new ArrayList<XmlObject>(); tableNamesList = new ArrayList<String>(); ExtendedRegistry tempExtendedRegistry = this.extendedRegistryList.get(resourceIndex); Resource tempResource = tempExtendedRegistry.getResource(); XmlObject tempObject = tempResource.copy(); XmlObject xmlObjectTableChild[] = tempObject.selectChildren(new QName("", "table")); // System.out.println("Table: " + xmlObjectTableChild.length); for (int tableIndex = 0; tableIndex < xmlObjectTableChild.length; tableIndex++) { tableNode = new TreeNodeImpl(); XmlObject xmlObjectTableName[] = xmlObjectTableChild[tableIndex].selectChildren(new QName("", "name")); tableList.add(xmlObjectTableChild[tableIndex]); String tableXML = xmlObjectTableName[0].xmlText(); int indexGreaterThan = tableXML.indexOf(">") + 1; int indexSecondLessThan = tableXML.indexOf("</"); String tableName = tableXML.substring(indexGreaterThan, indexSecondLessThan); XmlObject xmlObjectColumnChild[] = xmlObjectTableChild[tableIndex].selectChildren(new QName("", "column")); for (int columnIndex = 0; columnIndex < xmlObjectColumnChild.length; columnIndex++) { XmlObject xmlObjectColumnName[] = xmlObjectColumnChild[columnIndex].selectChildren(new QName("", "name")); XmlObject xmlObjectColumnType[] = xmlObjectColumnChild[columnIndex].selectChildren(new QName("", "dataType")); columnList.add(xmlObjectColumnChild[columnIndex]); String columnXML = xmlObjectColumnName[0].xmlText(); indexGreaterThan = columnXML.indexOf(">") + 1; indexSecondLessThan = columnXML.indexOf("</"); String columnName = columnXML.substring(indexGreaterThan, indexSecondLessThan); if (xmlObjectColumnType.length > 0) { String columnTypeXML = xmlObjectColumnType[0].xmlText(); indexGreaterThan = columnTypeXML.indexOf(">") + 1; indexSecondLessThan = columnTypeXML.indexOf("</"); String columnType = columnTypeXML.substring(indexGreaterThan, indexSecondLessThan); TreeNodeImpl columnNode = new TreeNodeImpl(); columnNode.setData(columnName + ": " + columnType); tableNode.addChild(columnIndex, columnNode); /* */ } } tableNamesList.add(tableName); tableNode.setData(tableName); databaseNode.addChild(tableIndex, tableNode); } }
public void buildResourceList() { extendedRegistryList = new ArrayList<ExtendedRegistry>(); int extendedRegistryListCounter = 0; if (tempDoc == null) { registryBrowser(); } try { XQuerySearchResponseDocument responseDoc = XQuerySearchResponseDocument.Factory.parse(tempDoc); XQuerySearchResponse response = responseDoc.getXQuerySearchResponse(); /* * xmlns:ri="http://www.ivoa.net/xml/RegistryInterface/v1.0" * <ri:Resource> </ri:Resource> */ XmlObject xmlObject[] = response.selectChildren( new QName("http://www.ivoa.net/xml/RegistryInterface/v1.0", "Resource")); log.info("Number of Resources: " + xmlObject.length); Resource resourceTemp = null; ExtendedRegistry extendedRegistry = null; for (int i = 0; i < xmlObject.length; i++) { resourceTemp = Resource.Factory.parse(xmlObject[i].xmlText()); /* * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" * xsi:type="vr:Service" */ String resourceTypeComplete = resourceTemp .selectAttribute("http://www.w3.org/2001/XMLSchema-instance", "type") .getDomNode() .getNodeValue(); int index = resourceTypeComplete.indexOf(':') + 1; String resourceType = resourceTypeComplete.substring(index); log.info("Resource Type: " + resourceType); /* * Ignore Resource Type Registry, Authority * CeaApplication reduced only 3 resources * Organisation reduced only 1 resource * Service reduced 16 resources */ if (!resourceType.equals("Registry") && !resourceType.equals("Authority") && !resourceType.equals("CeaApplication") && !resourceType.equals("Organisation") && !resourceType.equals("Service")) { if (resourceTemp.getStatus().toString().equals("active")) { // System.out.println("resourceType: " + resourceType); // resourceList.add(resourceTemp); // System.out.println("i: " + i); extendedRegistry = new ExtendedRegistry(extendedRegistryListCounter++, resourceTemp); String webURL = resourceTemp.getContent().getReferenceURL(); log.info("web URL: " + webURL); if (webURL != null && webURL.trim().length() > 0) { extendedRegistry.setWebURL(webURL); } // Here Logic needs to be changed .....! // I need to capture TAP-XSAMS also ....! String[] accessURLs = buildCapabilityList(resourceTemp); log.info("Tap URL: " + accessURLs[0]); log.info("Tap XSAMs URL: " + accessURLs[1]); extendedRegistry.setTapURL(accessURLs[0]); if (accessURLs[1] != null && accessURLs[1].trim().length() > 0) { extendedRegistry.setXsamURL(accessURLs[1]); xsamsListForCheckBoxes.put(resourceTemp.getTitle(), accessURLs[1]); } if (resourceTemp.getCuration().getContactArray().length > 0) { extendedRegistry.setContactEmail( resourceTemp.getCuration().getContactArray()[0].getEmail()); extendedRegistry.setContactID( resourceTemp.getCuration().getContactArray()[0].getName().getIvoId()); } extendedRegistryList.add(extendedRegistry); XmlObject tempObject = resourceTemp.copy(); XmlObject xmlObjectApplicationChild[] = tempObject.selectChildren(new QName("", "applicationDefinition")); System.out.println("Application Definitition: " + xmlObjectApplicationChild.length); XmlObject xmlObjectTableChild[] = tempObject.selectChildren(new QName("", "table")); // System.out.println("Table: " + xmlObjectTableChild.length); for (int x = 0; x < xmlObjectTableChild.length; x++) { XmlObject xmlObjectTableName[] = xmlObjectTableChild[x].selectChildren(new QName("", "name")); // tableList.add(xmlObjectTableChild[x]); String tableXML = xmlObjectTableName[0].xmlText(); int indexGreaterThan = tableXML.indexOf(">") + 1; int indexSecondLessThan = tableXML.indexOf("</"); @SuppressWarnings("unused") String tableName = tableXML.substring(indexGreaterThan, indexSecondLessThan); // tableNamesList.add(tableName); @SuppressWarnings("unused") XmlObject xmlObjectColumnChild[] = xmlObjectTableChild[x].selectChildren(new QName("", "column")); /* System.out.println(tableName + " Column: " + xmlObjectColumnChild.length);*/ } } } } } catch (XmlException ex) { } }