Commit 117a17b5 authored by Philippe Merle's avatar Philippe Merle
Browse files

* Simplified implementation of methods toStringBuffer()

* Added and used new methods hasBaseService(), getBaseService(), hasBaseReference(), getBaseReference(), getFractalComponent()
* Renamed computeBindingURI() to completeBindingURI()
* Renamed USTL to University of Lille 1
parent 43d6ae85
......@@ -2,7 +2,7 @@
<!--
* OW2 FraSCAti: Assembly Factory Module
*
* Copyright (c) 2008-2010 INRIA, USTL
* Copyright (c) 2008-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2008-2010 INRIA, USTL
* Copyright (C) 2008-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/***
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2009-2010 INRIA, USTL
* Copyright (C) 2009-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2008-2010 INRIA, USTL
* Copyright (C) 2008-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2009-2010 INRIA, USTL
* Copyright (C) 2009-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2010 INRIA, USTL
* Copyright (C) 2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2010 INRIA, USTL
* Copyright (C) 2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2010 INRIA, USTL
* Copyright (C) 2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2010 INRIA, USTL
* Copyright (C) 2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2009-2010 INRIA, USTL
* Copyright (C) 2009-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2009-2010 INRIA, USTL
* Copyright (C) 2009-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2010 INRIA, USTL
* Copyright (C) 2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -30,6 +30,8 @@ import org.eclipse.stp.sca.BaseService;
import org.eclipse.stp.sca.BaseReference;
import org.eclipse.stp.sca.Binding;
import org.objectweb.fractal.api.Component;
import org.ow2.frascati.assembly.factory.api.ProcessingContext;
import org.ow2.frascati.assembly.factory.api.ProcessorException;
......@@ -68,7 +70,6 @@ public abstract class AbstractBindingProcessor<BindingType extends Binding>
append(sb, "uri", binding.getUri());
append(sb, "policySets", binding.getPolicySets());
append(sb, "requires", binding.getRequires());
sb.append('>');
}
/**
......@@ -82,12 +83,48 @@ public abstract class AbstractBindingProcessor<BindingType extends Binding>
checkChildrenNotSupported(binding, "sca:operation", binding.getOperation().size() > 0, processingContext);
}
/**
* Test if the parent of a binding is a BaseService instance.
*
* @return true is the parent of a binding is a BaseService instance, else false.
*/
protected boolean hasBaseService(BindingType binding)
{
return binding.eContainer() instanceof BaseService;
}
/**
* Get the BaseService parent of a binding.
*/
protected BaseService getBaseService(BindingType binding)
{
return getParent(binding, BaseService.class);
}
/**
* Get the Java interface of the base service of a binding.
*/
protected Class<?> getBaseServiceJavaInterface(BindingType binding, ProcessingContext processingContext)
{
return AbstractInterfaceProcessor.getClass(((BaseService) binding.eContainer()).getInterface(), processingContext);
return AbstractInterfaceProcessor.getClass(getBaseService(binding).getInterface(), processingContext);
}
/**
* Test if the parent of a binding is a BaseReference instance.
*
* @return true is the parent of a binding is a BaseReference instance, else false.
*/
protected boolean hasBaseReference(BindingType binding)
{
return binding.eContainer() instanceof BaseReference;
}
/**
* Get the BaseReference parent of a binding.
*/
protected BaseReference getBaseReference(BindingType binding)
{
return getParent(binding, BaseReference.class);
}
/**
......@@ -95,13 +132,21 @@ public abstract class AbstractBindingProcessor<BindingType extends Binding>
*/
protected Class<?> getBaseReferenceJavaInterface(BindingType binding, ProcessingContext processingContext)
{
return AbstractInterfaceProcessor.getClass(((BaseReference) binding.eContainer()).getInterface(), processingContext);
return AbstractInterfaceProcessor.getClass(getBaseReference(binding).getInterface(), processingContext);
}
/**
* Get the Fractal component for a binding.
*/
protected Component getFractalComponent(BindingType binding, ProcessingContext processingContext)
{
return processingContext.getData(binding.eContainer().eContainer(), Component.class);
}
/**
* Complete binding URI with binding uri base.
* Complete binding URI with binding URI base.
*/
protected String computeBindingURI(BindingType binding)
protected String completeBindingURI(BindingType binding)
{
String uri = binding.getUri();
if(uri != null && uri.startsWith("/")) {
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2010 INRIA, USTL
* Copyright (C) 2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2008-2010 INRIA, USTL
* Copyright (C) 2008-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2010 INRIA, USTL
* Copyright (C) 2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2010 INRIA, USTL
* Copyright (C) 2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -55,7 +55,6 @@ public abstract class AbstractImplementationProcessor<ImplementationType extends
protected void toStringBuffer(ImplementationType implementation, StringBuffer sb) {
append(sb, "policySets", implementation.getPolicySets());
append(sb, "requires", implementation.getRequires());
sb.append('>');
}
/**
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2009-2010 INRIA, USTL
* Copyright (C) 2009-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2010 INRIA, USTL
* Copyright (C) 2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -52,7 +52,6 @@ public abstract class AbstractInterfaceProcessor<InterfaceType extends Interface
*/
@Override
protected void toStringBuffer(InterfaceType interfaze, StringBuffer sb) {
sb.append('>');
}
/**
......
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2009-2010 INRIA, USTL
* Copyright (C) 2009-2010 INRIA, University of Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment