List of usage examples for org.jdom2 Namespace getURI
public String getURI()
Namespace
. 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(/*from www . j av a 2s.c om*/ 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; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.SLActionToXmlRdf.java
License:Open Source License
public static Element createSLActionElement(final Namespace nameSpace, final Document documentParent, final SLAction slAction) { Element slActionElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":ServiceLevelAction"); slActionElement.appendChild(/*from w w w . j av a 2s . co m*/ XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasName", slAction.getHasName())); slActionElement.appendChild( XmlUtility.createSimpleTextElement(nameSpace, documentParent, "callUrl", slAction.getCallUri())); return slActionElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.SLAgreementToXmlRdf.java
License:Open Source License
public static Element createSLAgreementElement(final Namespace nameSpace, final Document documentParent, final SLAgreement slAgreement, final String uriSlAgreement) { Element slAgreementElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":ServiceLevelAgreement"); slAgreementElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", uriSlAgreement); boolean firstSlObjective = true; Element hasSLObjectiveElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasSLObjective"); for (SLObjective slObjective : slAgreement.getSlObjectiveList()) { if (slObjective != null) { if (firstSlObjective) { slAgreementElement.appendChild(hasSLObjectiveElement); firstSlObjective = false; }/*from w w w . j a va 2 s.co m*/ hasSLObjectiveElement.appendChild( SLObjectiveToXmlRdf.createSLObjectiveElement(nameSpace, documentParent, slObjective)); } } slAgreementElement.appendChild(XmlUtility.createDateTimeElement(nameSpace, documentParent, "hasStartTime", slAgreement.getHasStartTime() + ":00")); slAgreementElement.appendChild(XmlUtility.createDateTimeElement(nameSpace, documentParent, "hasEndTime", slAgreement.getHasEndTime() + ":00")); return slAgreementElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.SLMetricToXmlRdf.java
License:Open Source License
public static Element createSLMetricElement(final Namespace nameSpace, final Document documentParent, final SLMetric slMetric) { Element slMetricElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":ServiceLevelSimpleMetric"); slMetricElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMetricName", slMetric.getHasName()));//from ww w . j a v a 2s .c o m if ("less".equals(slMetric.getHasSymbol())) { slMetricElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasMetricValueLessThan", slMetric.getHasMetricValue())); } if ("greater".equals(slMetric.getHasSymbol())) { slMetricElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasMetricValueGreaterThan", slMetric.getHasMetricValue())); } if ("equal".equals(slMetric.getHasSymbol())) { slMetricElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasMetricValue", slMetric.getHasMetricValue())); } slMetricElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMetricUnit", slMetric.getHasMetricUnit())); slMetricElement.appendChild( XmlUtility.createResourceElement(nameSpace, documentParent, "dependsOn", slMetric.getDependsOn())); return slMetricElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.SLObjectiveToXmlRdf.java
License:Open Source License
public static Element createSLObjectiveElement(final Namespace nameSpace, final Document documentParent, final SLObjective slObjective) { Element slObjectiveElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":ServiceLevelObjective"); boolean firstSlAction = true; Element hasSLActionElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasSLAction"); for (SLAction slAction : slObjective.getSlActionList()) { if (slAction != null) { if (firstSlAction) { slObjectiveElement.appendChild(hasSLActionElement); firstSlAction = false;//from www . java 2s. c om } hasSLActionElement .appendChild(SLActionToXmlRdf.createSLActionElement(nameSpace, documentParent, slAction)); } } boolean firstSlMetric = true; Element hasSLMetricElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasSLMetric"); Element hasSLAndMetricElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":ServiceLevelAndMetric"); Element dependsOnElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":dependsOn"); for (SLMetric slMetric : slObjective.getSlMetricList()) { if (slMetric != null) { if (firstSlMetric) { slObjectiveElement.appendChild(hasSLMetricElement); firstSlMetric = false; if (slObjective.getSlMetricList().size() > 1) { hasSLMetricElement.appendChild(hasSLAndMetricElement); hasSLAndMetricElement.appendChild(dependsOnElement); } } if (slObjective.getSlMetricList().size() > 1) { dependsOnElement.appendChild( SLMetricToXmlRdf.createSLMetricElement(nameSpace, documentParent, slMetric)); } else { hasSLMetricElement.appendChild( SLMetricToXmlRdf.createSLMetricElement(nameSpace, documentParent, slMetric)); } // TODO rivedere se si pu far di meglio } } return slObjectiveElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.UserToXmlRdf.java
License:Open Source License
public static Element createUserElement(final Namespace nameSpace, final Document documentParent, final User user, final String uriUser) { Element userElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":User"); userElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", uriUser);/*from w w w . j a va2 s . c o m*/ userElement.appendChild(XmlUtility.createSimpleTextElement(NameSpaceRepository.FOAF, documentParent, "name", user.getNameFoaf())); userElement.appendChild(XmlUtility.createSimpleTextElement(NameSpaceRepository.FOAF, documentParent, "mbox", user.getMboxFoaf())); return userElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.VirtualMachineToXmlRdf.java
License:Open Source License
public static Element createVirtualMachineElement(final Namespace nameSpace, final Document documentParent, final VirtualMachine virtualMachine) { Element virtualMachineElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":VirtualMachine"); virtualMachineElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", virtualMachine.getUri()); virtualMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasName", virtualMachine.getHasName())); virtualMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIdentifier", virtualMachine.getHasIdentifier())); virtualMachineElement.appendChild(XmlUtility.createPositiveIntegerElement(nameSpace, documentParent, "hasCPUCount", virtualMachine.getHasCPUCount())); virtualMachineElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasCPUSpeedReservation", virtualMachine.getHasCPUSpeedReservation())); virtualMachineElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasCPUSpeedLimit", virtualMachine.getHasCPUSpeedLimit())); virtualMachineElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasMemorySize", virtualMachine.getHasMemorySize())); virtualMachineElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasMemoryReservation", virtualMachine.getHasMemoryReservation())); virtualMachineElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasMemoryLimit", virtualMachine.getHasMemoryLimit())); boolean firstVirtualStorage = true; Element hasVirtualStorageElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasVirtualStorage"); for (VirtualStorage virtualStorage : virtualMachine.getHasVirtualStorageList()) { if (virtualStorage != null) { if (firstVirtualStorage) { virtualMachineElement.appendChild(hasVirtualStorageElement); firstVirtualStorage = false; }/*ww w. ja v a2 s . co m*/ hasVirtualStorageElement.appendChild(VirtualStorageToXmlRdf.createVirtualStorageElement(nameSpace, documentParent, virtualStorage)); } } boolean firstNetworkAdapter = true; Element hasNetworkAdapterElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasNetworkAdapter"); for (NetworkAdapter networkAdapter : virtualMachine.getHasNetworkAdapterList()) { if (networkAdapter != null) { if (firstNetworkAdapter) { virtualMachineElement.appendChild(hasNetworkAdapterElement); firstNetworkAdapter = false; } hasNetworkAdapterElement.appendChild(NetworkAdapterToXmlRdf.createNetworkAdapterElement(nameSpace, documentParent, networkAdapter)); } } virtualMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasExternalIPAddress", virtualMachine.getHasExternalIPAddress())); virtualMachineElement.appendChild(XmlUtility.createResourceElement(nameSpace, documentParent, "hasOS", "http://www.cloudicaro.it/cloud_ontology/core#" + virtualMachine.getHasOS())); virtualMachineElement.appendChild(XmlUtility.createResourceElement(nameSpace, documentParent, "isPartOf", virtualMachine.getIsPartOf())); virtualMachineElement.appendChild(XmlUtility.createResourceElement(nameSpace, documentParent, "isStoredOn", virtualMachine.getIsStoredOn())); virtualMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "isInDomain", virtualMachine.getIsInDomain())); virtualMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasAuthUserName", virtualMachine.getHasAuthUserName())); virtualMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasAuthUserPassword", virtualMachine.getHasAuthUserPassword())); virtualMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMonitorIPAddress", virtualMachine.getHasMonitorIPAddress())); boolean firstMonitorInfo = true; Element hasMonitorInfoElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":hasMonitorInfo"); for (MonitorInfo monitorInfo : virtualMachine.getHasMonitorInfoList()) { if (monitorInfo != null) { if (firstMonitorInfo) { virtualMachineElement.appendChild(hasMonitorInfoElement); firstMonitorInfo = false; } hasMonitorInfoElement.appendChild( MonitorInfoToXmlRdf.createMonitorInfoElement(nameSpace, documentParent, monitorInfo)); } } virtualMachineElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasMonitorState", virtualMachine.getHasMonitorState())); return virtualMachineElement; }
From source file:org.cloudsimulator.xml.rdf.xmlrdfconverter.VirtualStorageToXmlRdf.java
License:Open Source License
public static Element createVirtualStorageElement(final Namespace nameSpace, final Document documentParent, final VirtualStorage virtualStorage) { Element virtualStorageElement = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":VirtualStorage"); virtualStorageElement.setAttributeNS(NameSpaceRepository.RDF.getURI(), NameSpaceRepository.RDF.getPrefix() + ":about", virtualStorage.getUri()); virtualStorageElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasName", virtualStorage.getHasName())); virtualStorageElement.appendChild(XmlUtility.createSimpleTextElement(nameSpace, documentParent, "hasIdentifier", virtualStorage.getHasIdentifier())); virtualStorageElement.appendChild(XmlUtility.createDecimalElement(nameSpace, documentParent, "hasDiskSize", virtualStorage.getHasDiskSize())); virtualStorageElement.appendChild(XmlUtility.createResourceElement(nameSpace, documentParent, "isStoredOn", virtualStorage.getIsStoredOn())); return virtualStorageElement; }
From source file:org.cloudsimulator.xml.XmlUtility.java
License:Open Source License
public static Element createSimpleTextElement(final Namespace nameSpace, final Document documentParent, final String elementTagName, final String elementText) { Element element = documentParent.createElementNS(nameSpace.getURI(), nameSpace.getPrefix() + ":" + elementTagName); element.appendChild(documentParent.createTextNode(elementText)); return element; }