List of usage examples for org.jdom2 Namespace getPrefix
public String getPrefix()
Namespace
. 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 w w w.j a v a 2 s. c om } 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)); }//from w w w . j a v a 2 s .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(/* w w w . j a v a2 s.c o m*/ 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 w w w . j av a 2s .com 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; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.ServiceMetricToXmlRdf.java
License:Open Source License
public static Element createServiceMetricElement(final Namespace nameSpace, final Document documentParent, final ServiceMetric serviceMetric) { Element serviceMetricElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":ServiceMetric"); serviceMetricElement.appendChild(// w ww . j av a 2s . co m XmlUtility.createDateTimeElement(nameSpace, documentParent, "atTime", serviceMetric.getAtTime())); serviceMetricElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMetricName", serviceMetric.getHasMetricName())); serviceMetricElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasMetricValue", serviceMetric.getHasMetricValue())); serviceMetricElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMetricUnit", serviceMetric.getHasMetricUnit())); serviceMetricElement.appendChild(XmlUtility.createResourceElement(nameSpace, documentParent, "dependsOn", serviceMetric.getDependsOn())); return serviceMetricElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.SharedStorageVolumeToXmlRdf.java
License:Open Source License
public static Element createSharedStorageVolumeElement(final Namespace nameSpace, final Document documentParent, final SharedStorageVolume sharedStorageVolume) { Element sharedStorageVolumeElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":SharedStorageVolume"); sharedStorageVolumeElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", sharedStorageVolume.getUri()); sharedStorageVolumeElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasName", sharedStorageVolume.getHasName())); sharedStorageVolumeElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIdentifier", sharedStorageVolume.getHasIdentifier())); sharedStorageVolumeElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasDiskSize", sharedStorageVolume.getHasDiskSize())); return sharedStorageVolumeElement; }