List of usage examples for org.jdom2 Namespace getURI
public String getURI()
Namespace
. From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.FirewallToRdf.java
License:Open Source License
public static Element createFirewallElement(final Namespace nameSpace, final Document documentParent, final Firewall firewall) { Element firewallElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":Firewall"); firewallElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", firewall.getUri()); firewallElement.appendChild(/*from ww w . jav a 2s. c o m*/ XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasName", firewall.getHasName())); firewallElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIdentifier", firewall.getHasIdentifier())); firewallElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasModelName", firewall.getHasModelName())); boolean firstNetworkAdapter = true; Element hasNetworkAdapterElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasNetworkAdapter"); for (NetworkAdapter networkAdapter : firewall.getHasNetworkAdapterList()) { if (networkAdapter != null) { if (firstNetworkAdapter) { firewallElement.appendChild(hasNetworkAdapterElement); firstNetworkAdapter = false; } hasNetworkAdapterElement.appendChild(NetworkAdapterToXmlRdf.createNetworkAdapterElement(nameSpace, documentParent, networkAdapter)); } } firewallElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMonitorIPAddress", firewall.getHasMonitorIPAddress())); boolean firstMonitorInfo = true; Element hasMonitorInfoElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasMonitorInfo"); for (MonitorInfo monitorInfo : firewall.getHasMonitorInfoList()) { if (monitorInfo != null) { if (firstMonitorInfo) { firewallElement.appendChild(hasMonitorInfoElement); firstMonitorInfo = false; } hasMonitorInfoElement.appendChild( MonitorInfoToXmlRdf.createMonitorInfoElement(nameSpace, documentParent, monitorInfo)); } } firewallElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMonitorState", firewall.getHasMonitorState())); return firewallElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.HostMachineToXmlRdf.java
License:Open Source License
public static Element createHostMachineElement(final Namespace nameSpace, final Document documentParent, final Element dataCenterElement, final String uriDataCenter, final HostMachine hostMachine) throws LocalNetworkTooLittleException { Element hasPartElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasPart"); hasPartElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":resource", hostMachine.getUri()); dataCenterElement.appendChild(hasPartElement); Element hostMachineElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":HostMachine"); hostMachineElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", hostMachine.getUri()); hostMachineElement.appendChild(//from w ww. ja va 2 s.c om XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasName", hostMachine.getHasName())); hostMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIdentifier", hostMachine.getHasIdentifier())); hostMachineElement.appendChild(XmlUtility.createPositiveIntegerElement(nameSpace, documentParent, "hasCPUCount", hostMachine.getHasCPUCount())); hostMachineElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasCPUSpeed", hostMachine.getHasCPUSpeed())); hostMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasCPUType", hostMachine.getHasCPUType())); hostMachineElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasMemorySize", hostMachine.getHasMemorySize())); boolean firstLocalStorage = true; Element hasLocalStorageElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasLocalStorage"); for (LocalStorage localStorage : hostMachine.getHasLocalStorageList()) { if (localStorage != null) { if (firstLocalStorage) { hostMachineElement.appendChild(hasLocalStorageElement); firstLocalStorage = false; } hasLocalStorageElement.appendChild( LocalStorageToXmlRdf.createLocalStorageElement(nameSpace, documentParent, localStorage)); } } for (String uriSharedStorageVolume : hostMachine.getUseSharedStorageList()) { hostMachineElement.appendChild(XmlUtility.createResourceElement(nameSpace, documentParent, "useSharedStorage", uriSharedStorageVolume)); } boolean firstNetworkAdapter = true; Element hasNetworkAdapterElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasNetworkAdapter"); for (NetworkAdapter networkAdapter : hostMachine.getHasNetworkAdapterList()) { if (networkAdapter != null) { if (firstNetworkAdapter) { hostMachineElement.appendChild(hasNetworkAdapterElement); firstNetworkAdapter = false; } hasNetworkAdapterElement.appendChild(NetworkAdapterToXmlRdf.createNetworkAdapterElement(nameSpace, documentParent, networkAdapter)); } } hostMachineElement.appendChild(XmlUtility.createResourceElement(nameSpace, documentParent, "hasOS", "http://www.cloudicaro.it/cloud_ontology/core#" + hostMachine.getHasOS())); hostMachineElement.appendChild( XmlUtility.createResourceElement(nameSpace, documentParent, "isPartOf", uriDataCenter)); hostMachineElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasCapacity", hostMachine.getHasCapacity())); hostMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "isInDomain", hostMachine.getIsInDomain())); hostMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasAuthUserName", hostMachine.getHasAuthUserName())); hostMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasAuthUserPassword", hostMachine.getHasAuthUserPassword())); hostMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMonitorIPAddress", hostMachine.getHasMonitorIPAddress())); boolean firstMonitorInfo = true; Element hasMonitorInfoElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasMonitorInfo"); for (MonitorInfo monitorInfo : hostMachine.getHasMonitorInfoList()) { if (monitorInfo != null) { if (firstMonitorInfo) { hostMachineElement.appendChild(hasMonitorInfoElement); firstMonitorInfo = false; } hasMonitorInfoElement.appendChild( MonitorInfoToXmlRdf.createMonitorInfoElement(nameSpace, documentParent, monitorInfo)); } } hostMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMonitorState", hostMachine.getHasMonitorState())); return hostMachineElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.IcaroApplicationToXmlRdf.java
License:Open Source License
public static Element createIcaroApplicationElement(final Namespace nameSpace, final Document documentParent, final IcaroApplication icaroApplication, final String uriIcaroApplication) { Element icaroApplicationElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":IcaroApplication"); icaroApplicationElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", uriIcaroApplication); icaroApplicationElement.appendChild(XmlUtility.createResourceElement(NameSpaceRepository.RDF, documentParent, "type", icaroApplication.getTypeRdf())); icaroApplicationElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasName", icaroApplication.getHasName())); icaroApplicationElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIdentifier", icaroApplication.getHasIdentifier())); for (User creator : icaroApplication.getCreatorList()) { if (creator != null) { icaroApplicationElement.appendChild( XmlUtility.createResourceElement(nameSpace, documentParent, "createdBy", creator.getUri())); }//from www. j av a 2s.co m } boolean firstNeeds = true; Element needsElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":needs"); for (IcaroService icaroService : icaroApplication.getIcaroServiceList()) { if (icaroService != null) { if (firstNeeds) { icaroApplicationElement.appendChild(needsElement); firstNeeds = false; } needsElement.appendChild(IcaroServiceToXmlRdf.createIcaroServiceElement(nameSpace, documentParent, icaroService, IcaroService.getPathUri() + icaroService.getTypeRdf().replace("&icr;", "") + ":" + icaroApplication.getIcaroServiceList().indexOf(icaroService))); } } boolean firstSlAgreement = true; Element hasSLAElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasSLA"); for (SLAgreement slAgreement : icaroApplication.getSlAgreementList()) { if (slAgreement != null) { if (firstSlAgreement) { icaroApplicationElement.appendChild(hasSLAElement); firstSlAgreement = false; } hasSLAElement.appendChild( SLAgreementToXmlRdf.createSLAgreementElement(nameSpace, documentParent, slAgreement, slAgreement.getPathUri() + uriIcaroApplication.replace(IcaroApplication.getPathUri(), "") + "_" + icaroApplication.getSlAgreementList().indexOf(slAgreement))); } } icaroApplicationElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasCapacity", icaroApplication.getHasCapacity())); return icaroApplicationElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.IcaroServiceToXmlRdf.java
License:Open Source License
public static Element createIcaroServiceElement(final Namespace nameSpace, final Document documentParent, final IcaroService icaroService, final String uriIcaroService) { Element icaroServiceElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":IcaroService"); icaroServiceElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", uriIcaroService); icaroServiceElement.appendChild(XmlUtility.createResourceElement(NameSpaceRepository.RDF, documentParent, "type", icaroService.getTypeRdf())); icaroServiceElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasName", icaroService.getHasName())); icaroServiceElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIdentifier", icaroService.getHasIdentifier())); icaroServiceElement.appendChild(XmlUtility.createResourceElement(nameSpace, documentParent, "runsOnVM", icaroService.getRunsOnVm())); icaroServiceElement.appendChild(XmlUtility.createResourceElement(nameSpace, documentParent, "supportsLanguage", icaroService.getSupportsLanguage())); for (Integer tcpPort : icaroService.getUsesTcpPortList()) { icaroServiceElement.appendChild( XmlUtility.createUnsignedShortElement(nameSpace, documentParent, "usesTcpPort", tcpPort)); }// w w w .j ava2s. c o m for (Integer udpPort : icaroService.getUsesUdpPortList()) { icaroServiceElement.appendChild( XmlUtility.createUnsignedShortElement(nameSpace, documentParent, "usesUdpPort", udpPort)); } icaroServiceElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMonitorIPAddress", icaroService.getHasMonitorIPAddress())); icaroServiceElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasProcessName", icaroService.getHasProcessName())); icaroServiceElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasAuthUserName", icaroService.getHasAuthUserName())); icaroServiceElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasAuthUserPassword", icaroService.getHasAuthUserPassword())); boolean firstMonitorInfo = true; Element hasMonitorInfoElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasMonitorInfo"); for (MonitorInfo monitorInfo : icaroService.getMonitorInfoList()) { if (monitorInfo != null) { if (firstMonitorInfo) { icaroServiceElement.appendChild(hasMonitorInfoElement); firstMonitorInfo = false; } hasMonitorInfoElement.appendChild( MonitorInfoToXmlRdf.createMonitorInfoElement(nameSpace, documentParent, monitorInfo)); } } icaroServiceElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMonitorState", icaroService.getHasMonitorState())); return icaroServiceElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.IcaroTenantToXmlRdf.java
License:Open Source License
public static Element createIcaroTenantElement(final Namespace nameSpace, final Document documentParent, final IcaroTenant icaroTenant, final String uriIcaroTenant) { Element icaroTenantElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":IcaroTenant"); icaroTenantElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", uriIcaroTenant); icaroTenantElement.appendChild(/*from w ww .ja v a 2 s . com*/ XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasName", icaroTenant.getHasName())); icaroTenantElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIdentifier", icaroTenant.getHasIdentifier())); icaroTenantElement.appendChild(XmlUtility.createResourceElement(nameSpace, documentParent, "isTenantOf", "urn:cloudicaro:ApplicazioneDiProva")); // for (User creator : icaroTenant.getCreatorList()) { // if (creator != null) { icaroTenantElement.appendChild(XmlUtility.createResourceElement(nameSpace, documentParent, "createdBy", "urn:cloudicaro:User:UtenteDiProva")); // } // } // TODO da modificare inserire il pannelo di creazioneutente boolean firstMonitorInfo = true; Element hasMonitorInfoElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasMonitorInfo"); for (MonitorInfo monitorInfo : icaroTenant.getMonitorInfoList()) { if (monitorInfo != null) { if (firstMonitorInfo) { icaroTenantElement.appendChild(hasMonitorInfoElement); firstMonitorInfo = false; } hasMonitorInfoElement.appendChild( MonitorInfoToXmlRdf.createMonitorInfoElement(nameSpace, documentParent, monitorInfo)); } } icaroTenantElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMonitorState", icaroTenant.getHasMonitorState())); boolean firstSlAgreement = true; Element hasSLAElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasSLA"); for (SLAgreement slAgreement : icaroTenant.getSlAgreementList()) { if (slAgreement != null) { if (firstSlAgreement) { icaroTenantElement.appendChild(hasSLAElement); firstSlAgreement = false; } hasSLAElement.appendChild( SLAgreementToXmlRdf.createSLAgreementElement(nameSpace, documentParent, slAgreement, slAgreement.getPathUri() + uriIcaroTenant.replace(IcaroApplication.getPathUri(), "") + "_" + icaroTenant.getSlAgreementList().indexOf(slAgreement))); } } return icaroTenantElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.LocalNetworkToXmlRdf.java
License:Open Source License
public static Element createLocalNetworkElement(final Namespace nameSpace, final Document documentParent, final LocalNetwork localNetwork) throws LocalNetworkTooLittleException { Element localNetworkElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":LocalNetwork"); localNetworkElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", localNetwork.getUri()); localNetworkElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasName", localNetwork.getHasName())); localNetworkElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIdentifier", localNetwork.getHasIdentifier())); localNetworkElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasSubNetworkMask", localNetwork.getHasSubNetworkMask())); localNetworkElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIPAddress", localNetwork.getHasIPAddress())); return localNetworkElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.LocalStorageToXmlRdf.java
License:Open Source License
public static Element createLocalStorageElement(final Namespace nameSpace, final Document documentParent, final LocalStorage localStorage) { Element localStorageElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":LocalStorage"); localStorageElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", localStorage.getUri()); localStorageElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasName", localStorage.getHasName())); localStorageElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIdentifier", localStorage.getHasIdentifier())); localStorageElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasDiskSize", localStorage.getHasDiskSize())); return localStorageElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.MonitorInfoToXmlRdf.java
License:Open Source License
public static Element createMonitorInfoElement(final Namespace nameSpace, final Document documentParent, final MonitorInfo monitorInfo) { Element monitorInfoElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":MonitorInfo"); monitorInfoElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMetricName", monitorInfo.getHasMetricName())); monitorInfoElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasArguments", monitorInfo.getHasArguments())); monitorInfoElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasWarningValue", monitorInfo.getHasWarningValue())); monitorInfoElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasCriticalValue", monitorInfo.getHasCriticalValue())); monitorInfoElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMonitorState", monitorInfo.getHasMonitorState())); monitorInfoElement.appendChild(XmlUtility.createPositiveIntegerElement(nameSpace, documentParent, "hasMaxCheckAttempts", monitorInfo.getHasMaxCheckAttempts())); monitorInfoElement.appendChild(XmlUtility.createPositiveIntegerElement(nameSpace, documentParent, "hasCheckInterval", monitorInfo.getHasCheckInterval())); monitorInfoElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasCheckMode", monitorInfo.getHasCheckMode())); return monitorInfoElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.NetworkAdapterToXmlRdf.java
License:Open Source License
public static Element createNetworkAdapterElement(final Namespace nameSpace, final Document documentParent, final NetworkAdapter networkAdapter) { Element networkAdapterElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":NetworkAdapter"); networkAdapterElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIPAddress", networkAdapter.getHasIPAddress())); networkAdapterElement.appendChild(XmlUtility.createResourceElement(nameSpace, documentParent, "boundToNetwork", networkAdapter.getBoundToNetwork())); return networkAdapterElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.RouterToXmlRdf.java
License:Open Source License
public static Element createRouterElement(final Namespace nameSpace, final Document documentParent, final Router router) { Element routerElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":Router"); routerElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", router.getUri()); routerElement.appendChild(//from ww w . jav a2s. c o m XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasName", router.getHasName())); routerElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIdentifier", router.getHasIdentifier())); routerElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasModelName", router.getHasModelName())); boolean firstNetworkAdapter = true; Element hasNetworkAdapterElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasNetworkAdapter"); for (NetworkAdapter networkAdapter : router.getHasNetworkAdapterList()) { if (networkAdapter != null) { if (firstNetworkAdapter) { routerElement.appendChild(hasNetworkAdapterElement); firstNetworkAdapter = false; } hasNetworkAdapterElement.appendChild(NetworkAdapterToXmlRdf.createNetworkAdapterElement(nameSpace, documentParent, networkAdapter)); } } routerElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMonitorIPAddress", router.getHasMonitorIPAddress())); boolean firstMonitorInfo = true; Element hasMonitorInfoElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasMonitorInfo"); for (MonitorInfo monitorInfo : router.getHasMonitorInfoList()) { if (monitorInfo != null) { if (firstMonitorInfo) { routerElement.appendChild(hasMonitorInfoElement); firstMonitorInfo = false; } hasMonitorInfoElement.appendChild( MonitorInfoToXmlRdf.createMonitorInfoElement(nameSpace, documentParent, monitorInfo)); } } routerElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMonitorState", router.getHasMonitorState())); return routerElement; }