Skip to content

Commit

Permalink
Some bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
dguedesb committed Apr 30, 2014
1 parent 5e73685 commit f17bd10
Show file tree
Hide file tree
Showing 14 changed files with 356 additions and 354 deletions.
480 changes: 240 additions & 240 deletions SPIN_API/DebuggingFiles/MAzureSmallPrePaid6m.ttl

Large diffs are not rendered by default.

174 changes: 87 additions & 87 deletions SPIN_API/DebuggingFiles/amazonOD.ttl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion SPIN_API/src/usdl/constants/enums/ResourceNameEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public String getResourceType(){
}

public String getResourceName() {
return name + " " + PricingAPIProperties.resourceCounter++;
return name + "_" + PricingAPIProperties.resourceCounter++;
}
}
8 changes: 4 additions & 4 deletions SPIN_API/src/usdl/servicemodel/CloudProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public CloudProvider(CloudProvider source) {//copy constructor
super();

if(source.getName() != null)
this.setName(source.getName() + PricingAPIProperties.resourceCounter++);
this.setName(source.getName() + "_" +PricingAPIProperties.resourceCounter++);

if(source.getComment() != null)
this.setComment(source.getComment());
Expand Down Expand Up @@ -171,14 +171,14 @@ protected static CloudProvider readFromModel(Resource resource, Model model){
* @param model Model to where the object is to be written on.
* @throws InvalidLinkedUSDLModelException
*/
@SuppressWarnings("null")
protected void writeToModel(Resource owner,Model model,String baseURI) throws InvalidLinkedUSDLModelException{

Resource provider = null;


if(baseURI != null || !baseURI.equalsIgnoreCase("")) // the baseURI argument is valid
this.namespace = baseURI;
if(baseURI != null ) // the baseURI argument is valid
if(!baseURI.equalsIgnoreCase(""))
this.namespace = baseURI;
else if(this.getNamespace() == null) //use the default baseURI
this.namespace = PricingAPIProperties.defaultBaseURI;

Expand Down
8 changes: 4 additions & 4 deletions SPIN_API/src/usdl/servicemodel/Offering.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Offering(Offering source) {//copy constructor
super();

if(source.getName() != null)
this.setName(source.getName() + PricingAPIProperties.resourceCounter++);
this.setName(source.getName() + "_" +PricingAPIProperties.resourceCounter++);

if(source.getComment() != null)
this.setComment(source.getComment());
Expand Down Expand Up @@ -167,13 +167,13 @@ public static Offering readFromModel(Resource resource, Model model){
* @param model Model to where the object is to be written on.
* @throws InvalidLinkedUSDLModelException
*/
@SuppressWarnings("null")
public void writeToModel(Model model, String baseURI) throws InvalidLinkedUSDLModelException
{
Resource offering = null;

if (baseURI != null || !baseURI.equalsIgnoreCase("")) // the baseURIargument is valid
this.namespace = baseURI;
if (baseURI != null ) // the baseURIargument is valid
if(!baseURI.equalsIgnoreCase(""))
this.namespace = baseURI;
else if(this.getNamespace() == null) // use the default baseURI
this.namespace = PricingAPIProperties.defaultBaseURI;

Expand Down
9 changes: 5 additions & 4 deletions SPIN_API/src/usdl/servicemodel/PriceComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public PriceComponent(PriceComponent source) {//copy construct
metrics = new ArrayList<QuantitativeValue>();

if(source.getName() != null)
this.setName(source.getName() + PricingAPIProperties.resourceCounter++);
this.setName(source.getName() +"_" + PricingAPIProperties.resourceCounter++);

if(source.getComment() != null)
this.setComment(source.getComment());
Expand Down Expand Up @@ -208,14 +208,15 @@ public PriceSpec calculatePrice()
* @param model Model to where the object is to be written on.
* @throws InvalidLinkedUSDLModelException
*/
@SuppressWarnings("null")

protected void writeToModel(Resource owner, Model model,String baseURI) throws InvalidLinkedUSDLModelException
{
Resource pc = null;


if(baseURI != null || !baseURI.equalsIgnoreCase("")) // the baseURI argument is valid
this.namespace = baseURI;
if(baseURI != null ) // the baseURI argument is valid
if(!baseURI.equalsIgnoreCase(""))
this.namespace = baseURI;
else if(this.getNamespace() == null) //use the default baseURI
this.namespace = PricingAPIProperties.defaultBaseURI;

Expand Down
11 changes: 6 additions & 5 deletions SPIN_API/src/usdl/servicemodel/PriceFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public PriceFunction(PriceFunction source) {//copy constructor
constraints = new ArrayList<Constraint>();

if(source.getName() != null)
this.setName(source.getName() + PricingAPIProperties.resourceCounter++);
this.setName(source.getName() +"_" + PricingAPIProperties.resourceCounter++);

if(source.getComment() != null)
this.setComment(source.getComment());
Expand Down Expand Up @@ -221,14 +221,14 @@ public void removeConstraintAtIndex(int index)
* @param model Model to where the object is to be written on.
* @throws InvalidLinkedUSDLModelException
*/
@SuppressWarnings("null")
protected void writeToModel(Resource owner,Model model,String baseURI) throws InvalidLinkedUSDLModelException
{

SPINModuleRegistry.get().init();
Function func = null;
String oldURI = this.namespace;
if(baseURI != null || !baseURI.equalsIgnoreCase("")) // the baseURI argument is valid
this.namespace = baseURI;
if(baseURI != null ) // the baseURI argument is valid
if(!baseURI.equalsIgnoreCase(""))
this.namespace = baseURI;
else if(this.getNamespace() == null) //use the default baseURI
this.namespace = PricingAPIProperties.defaultBaseURI;

Expand Down Expand Up @@ -288,6 +288,7 @@ else if(this.SPARQLFunction != null && stringFunction == null)
*/
protected static PriceFunction readFromModel(Resource resource,Model model)
{
SPINModuleRegistry.get().init();
PriceFunction pf = null;
if(resource.getLocalName() != null && resource.getNameSpace() != null){
pf = new PriceFunction(resource.getLocalName().replaceAll("_", " "), resource.getNameSpace());
Expand Down
6 changes: 3 additions & 3 deletions SPIN_API/src/usdl/servicemodel/PricePlan.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public PricePlan(PricePlan source) {//copy construct
priceComponents = new ArrayList<PriceComponent>();

if(source.getName() != null)
this.setName(source.getName() + PricingAPIProperties.resourceCounter++);
this.setName(source.getName() +"_" + PricingAPIProperties.resourceCounter++);

if(source.getComment() != null)
this.setComment(source.getComment());
Expand Down Expand Up @@ -156,7 +156,7 @@ public void removePriceComponentAt(int index)
* @return A PriceSpec instance that contains the price value of the Price Plan.
*/
//TODO: review the calculation process
public Double calculatePrice(Model model)
public double calculatePrice(Model model)
{
//sum each of the price components price value
String finalprice = "";
Expand All @@ -172,7 +172,7 @@ public Double calculatePrice(Model model)
QueryExecution qexecc = ARQFactory.get().createQueryExecution(q, model);

ResultSet rsc = qexecc.execSelect();
//System.out.println(q.toString());
// System.out.println(q.toString());
function_price = rsc.nextSolution().getLiteral("result").getDouble();// final result is store in the ?result variable of the query
}
}
Expand Down
2 changes: 1 addition & 1 deletion SPIN_API/src/usdl/servicemodel/PriceSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public PriceSpec(String name, String nameSpace) {
public PriceSpec(PriceSpec source)//copy constructor
{
if(source.getName() != null)
this.setName(source.getName() + PricingAPIProperties.resourceCounter++);
this.setName(source.getName() +"_" + PricingAPIProperties.resourceCounter++);

if(source.getCurrency() != null)
this.setCurrency(source.getCurrency());
Expand Down
2 changes: 1 addition & 1 deletion SPIN_API/src/usdl/servicemodel/Provider.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Provider(Provider source) {//copy constructor
super();
// TODO Auto-generated constructor stub
if(source.getName() != null)
this.setName(source.getName() + PricingAPIProperties.resourceCounter++);
this.setName(source.getName() +"_" + PricingAPIProperties.resourceCounter++);

if(source.getComment() != null)
this.setComment(source.getComment());
Expand Down
2 changes: 1 addition & 1 deletion SPIN_API/src/usdl/servicemodel/QualitativeValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public QualitativeValue(String name, String nameSpace) {
public QualitativeValue(QualitativeValue source) {//copy constructor

if(source.getName() != null)
this.setName(source.getName() + PricingAPIProperties.resourceCounter++);
this.setName(source.getName() +"_" + PricingAPIProperties.resourceCounter++);

if(source.getComment() != null)
this.setComment(source.getComment());
Expand Down
2 changes: 1 addition & 1 deletion SPIN_API/src/usdl/servicemodel/QuantitativeValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public QuantitativeValue(String name, String nameSpace) {
public QuantitativeValue(QuantitativeValue source) {//copy constructor

if(source.getName() != null)
this.setName(source.getName() + PricingAPIProperties.resourceCounter++);
this.setName(source.getName() + "_" +PricingAPIProperties.resourceCounter++);
if(source.getComment() != null)
this.setComment(source.getComment());

Expand Down
2 changes: 1 addition & 1 deletion SPIN_API/src/usdl/servicemodel/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Service(String name, String nameSpace) {
public Service(Service source) {//copy constructor

if(source.getName() != null)
this.setName(source.getName() + PricingAPIProperties.resourceCounter++);
this.setName(source.getName() +"_" + PricingAPIProperties.resourceCounter++);

if(source.getComment() != null)
this.setComment(source.getComment());
Expand Down
2 changes: 1 addition & 1 deletion SPIN_API/src/usdl/servicemodel/Usage.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Usage(String name, String nameSpace) {
public Usage(Usage source) {//copy constructor
super();
if(source.getName() != null)
this.setName(source.getName() + PricingAPIProperties.resourceCounter++);
this.setName(source.getName() +"_" + PricingAPIProperties.resourceCounter++);

if(source.getComment() != null)
this.setComment(source.getComment());
Expand Down

0 comments on commit f17bd10

Please sign in to comment.