Commit 723d5c91 authored by Munilla Christophe's avatar Munilla Christophe
Browse files

- update fractal-bf, bridge-service, and frascati-binding to be able to use...

- update fractal-bf, bridge-service, and frascati-binding to be able to use the 'nxservice' binding.nuxeo attribute
- add some comments and headers
parent 06927e5e
......@@ -33,6 +33,47 @@ import org.objectweb.fractal.bf.BindHints;
*/
public class NuxeoBindHints implements BindHints
{
// ---------------------------------------------------------------------------
// Internal state.
// --------------------------------------------------------------------------
/**
* the name of the component providing the service
*/
private String nxservice;
// ---------------------------------------------------------------------------
// Internal methods.
// --------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// Public methods.
// --------------------------------------------------------------------------
/**
* Return the nxservice attribute value
* nxservice value is used to identify the component providing the binded service
*
* @return the nxservice attribute value
*/
public String getNxservice()
{
return this.nxservice;
}
/**
* Set the nxservice attribute value
* nxservice value is used to identify the component providing the binded service
*
* @param nxservice
* the nxservice attribute to set
*/
public void setNxservice(String nxservice)
{
this.nxservice = nxservice;
}
/**
* {@inheritDoc}
*
......@@ -41,7 +82,9 @@ public class NuxeoBindHints implements BindHints
@Override
public String toString()
{
StringBuilder builder = new StringBuilder("NuxoeBindHints {}");
StringBuilder builder = new StringBuilder("NuxeoBindHints {");
builder.append(nxservice != null ? nxservice : "");
builder.append(" }");
return builder.toString();
}
}
......@@ -26,17 +26,17 @@
*/
package org.objectweb.fractal.bf.connectors.nuxeo;
//import java.util.HashMap;
import java.util.Map;
//import java.util.logging.Level;
import org.objectweb.fractal.bf.connectors.common.AbstractConnector;
//import java.util.logging.Level;
//import java.util.HashMap;
//import org.objectweb.fractal.api.Component;
//import org.objectweb.fractal.api.NoSuchInterfaceException;
//import org.objectweb.fractal.api.factory.GenericFactory;
//import org.objectweb.fractal.api.factory.InstantiationException;
//import org.objectweb.fractal.api.type.InterfaceType;
//import org.objectweb.fractal.bf.BindingFactoryException;
import org.objectweb.fractal.bf.connectors.common.AbstractConnector;
//import org.objectweb.fractal.bf.connectors.ws.WsConnectorConstants;
//import org.objectweb.fractal.julia.type.BasicComponentType;
//import org.objectweb.fractal.julia.type.BasicInterfaceType;
......@@ -96,6 +96,28 @@ public class NuxeoConnector extends
{
return "org.objectweb.fractal.bf.connectors.nuxeo.NuxeoSkeleton";
}
/**
* {@inheritDoc}
*
* @see org.objectweb.fractal.bf.connectors.common.AbstractConnector#
* initSkeletonAdlContext(org.objectweb.fractal.bf.ExportHints, java.util.Map)
*/
@Override
protected void initSkeletonAdlContext(NuxeoExportHints exportHints,
Map<String, Object> context)
{
log.info("initSkeletonAdlContext");
String nxservice = exportHints.getNxservice();
if (nxservice == null)
{
nxservice = NuxeoConnectorConstants.DEFAULT_NXSERVICE_VALUE;
log.warning("Export hints didn't specify "
+ NuxeoConnectorConstants.NXSERVICE + ", going to use "
+ NuxeoConnectorConstants.DEFAULT_NXSERVICE_VALUE);
}
context.put(NuxeoConnectorConstants.NXSERVICE, nxservice);
}
/**
* {@inheritDoc}
......@@ -108,7 +130,28 @@ public class NuxeoConnector extends
return "org.objectweb.fractal.bf.connectors.nuxeo.NuxeoStub";
}
/**
* {@inheritDoc}
*
* @see org.objectweb.fractal.bf.connectors.common.AbstractConnector#
* initStubAdlContext(org.objectweb.fractal.bf.BindHints, java.util.Map)
*/
@Override
protected void initStubAdlContext(NuxeoBindHints bindHints,
Map<String, Object> context)
{
log.info("initStubAdlContext");
String nxservice = bindHints.getNxservice();
if (nxservice == null)
{
nxservice = NuxeoConnectorConstants.DEFAULT_NXSERVICE_VALUE;
log.warning("Bind hints didn't specify "
+ NuxeoConnectorConstants.NXSERVICE + ", going to use "
+ NuxeoConnectorConstants.DEFAULT_NXSERVICE_VALUE);
}
context.put(NuxeoConnectorConstants.NXSERVICE, nxservice);
generateStubContentClass(NuxeoStubContent.class, context);
}
// ---------------------------------------------------------------------------
// Public methods.
......@@ -131,6 +174,8 @@ public class NuxeoConnector extends
public NuxeoExportHints getExportHints(Map<String, Object> initialHints)
{
NuxeoExportHints nuxeoExportHints = new NuxeoExportHints();
String nxservice = (String) initialHints.get(NuxeoConnectorConstants.NXSERVICE);
nuxeoExportHints.setNxservice(nxservice);
return nuxeoExportHints;
}
......@@ -142,6 +187,8 @@ public class NuxeoConnector extends
public NuxeoBindHints getBindHints(Map<String, Object> initialHints)
{
NuxeoBindHints nuxeoBindHints = new NuxeoBindHints();
String nxservice = (String) initialHints.get(NuxeoConnectorConstants.NXSERVICE);
nuxeoBindHints.setNxservice(nxservice);
return nuxeoBindHints;
}
......@@ -201,28 +248,5 @@ public class NuxeoConnector extends
// {
// log.log(Level.WARNING,e.getMessage(),e);
// }
// }
/* (non-Javadoc)
* @see org.objectweb.fractal.bf.connectors.common.AbstractConnector#initSkeletonAdlContext(org.objectweb.fractal.bf.ExportHints, java.util.Map)
*/
@Override
protected void initSkeletonAdlContext(NuxeoExportHints exportHints,
Map<String, Object> context)
{
log.info("initSkeletonAdlContext");
}
/* (non-Javadoc)
* @see org.objectweb.fractal.bf.connectors.common.AbstractConnector#initStubAdlContext(org.objectweb.fractal.bf.BindHints, java.util.Map)
*/
@Override
protected void initStubAdlContext(NuxeoBindHints bindHints,
Map<String, Object> context)
{
log.info("initStubAdlContext");
generateStubContentClass(NuxeoStubContent.class, context);
}
// }
}
......@@ -31,5 +31,7 @@ package org.objectweb.fractal.bf.connectors.nuxeo;
*/
public interface NuxeoConnectorConstants
{
public static final String NXSERVICE = "nxservice";
public static final String DEFAULT_NXSERVICE_VALUE = "";
}
......@@ -36,6 +36,11 @@ public class NuxeoExportHints implements ExportHints
// ---------------------------------------------------------------------------
// Internal state.
// --------------------------------------------------------------------------
/**
* the name of the component providing the service
*/
private String nxservice;
// ---------------------------------------------------------------------------
......@@ -44,7 +49,28 @@ public class NuxeoExportHints implements ExportHints
// ---------------------------------------------------------------------------
// Public methods.
// --------------------------------------------------------------------------
/**
* Return the nxservice attribute value
* nxservice value is used to identify the component providing the binded service
*
* @return the nxservice attribute value
*/
public String getNxservice()
{
return this.nxservice;
}
/**
* Set the nxservice attribute value
* nxservice value is used to identify the component providing the binded service
*
* @param nxservice
* the nxservice attribute to set
*/
public void setNxservice(String nxservice)
{
this.nxservice = nxservice;
}
/**
* {@inheritDoc}
*
......@@ -53,7 +79,9 @@ public class NuxeoExportHints implements ExportHints
@Override
public String toString()
{
StringBuilder builder = new StringBuilder("NuxeoExportHints {}");
StringBuilder builder = new StringBuilder("NuxeoExportHints {");
builder.append(nxservice != null ? nxservice : "");
builder.append(" }");
return builder.toString();
}
}
......@@ -32,14 +32,9 @@ import org.ow2.frascati.nuxeo.service.bridge.api.ExportedDelegateItf;
import org.ow2.frascati.nuxeo.service.bridge.api.ExportedItf;
import org.ow2.frascati.nuxeo.service.bridge.api.ExportedServiceLoaderItf;
/**
* The content implementation of Nuxeo components.
*/
/**
* @author munilla
*
*/
public class NuxeoSkeletonContent extends AbstractSkeletonContent implements
NuxeoSkeletonContentAttributes, ExportedItf
{
......@@ -48,7 +43,7 @@ public class NuxeoSkeletonContent extends AbstractSkeletonContent implements
// --------------------------------------------------------------------------
/**
* the service object interface class name
* the name of the component providing the service
*/
private String nxservice;
......@@ -63,6 +58,28 @@ public class NuxeoSkeletonContent extends AbstractSkeletonContent implements
// ---------------------------------------------------------------------------
// Public methods.
// ---------------------------------------------------------------------------
/**
* {@inheritDoc}
*
* @see org.objectweb.fractal.bf.connectors.nuxeo.NuxeoSkeletonContentAttributes#
* getNxservice()
*/
public String getNxservice()
{
return this.nxservice;
}
/**
* {@inheritDoc}
*
* @see org.objectweb.fractal.bf.connectors.nuxeo.NuxeoSkeletonContentAttributes#
* setNxservice(java.lang.String)
*/
public void setNxservice(String nxservice)
{
this.nxservice = nxservice;
}
/**
* {@inheritDoc}
......@@ -79,8 +96,9 @@ public class NuxeoSkeletonContent extends AbstractSkeletonContent implements
{
this.exportedDelegate =
((ExportedServiceLoaderItf)Framework.getRuntime().getComponent(
"org.ow2.frascati.nuxeo.service.bridge.ExportedServiceLoader")).createExportedDelegate(
this);
ExportedServiceLoaderItf.EXPORTED_SERVICE_LOADER)
).createExportedDelegate(this);
} catch (Exception e)
{
e.printStackTrace();
......@@ -125,10 +143,10 @@ public class NuxeoSkeletonContent extends AbstractSkeletonContent implements
/**
* {@inheritDoc}
*
* @see org.ow2.frascati.nuxeo.service.bridge.api.ExportedItf#getExportedClass()
* @see org.ow2.frascati.nuxeo.service.bridge.api.ExportedItf#getInterfaceName()
*/
public Class<?> getExportedClass()
public String getInterfaceName()
{
return super.getServiceClass();
return super.getServiceClass().getCanonicalName();
}
}
......@@ -36,5 +36,21 @@ import org.objectweb.fractal.bf.connectors.common.SkeletonContentAttributes;
public interface NuxeoSkeletonContentAttributes extends
SkeletonContentAttributes
{
/**
* Return the nxservice attribute value
* nxservice value is used to identify the component providing the binded service
*
* @return the nxservice attribute value
*/
String getNxservice();
/**
* Set the nxservice attribute value
* nxservice value is used to identify the component providing the binded service
*
* @param nxservice
* the nxservice attribute to set
*/
void setNxservice(String nxservice);
}
......@@ -41,7 +41,12 @@ public class NuxeoStubContent extends AbstractStubContent implements
// ---------------------------------------------------------------------------
// Internal state.
// --------------------------------------------------------------------------
/**
* the name of the component providing the service
*/
private String nxservice;
private Object serviceObject = null;
private BindedDelegateItf bindedDelegate = null;
......@@ -51,7 +56,29 @@ public class NuxeoStubContent extends AbstractStubContent implements
// ---------------------------------------------------------------------------
// Public methods.
// --------------------------------------------------------------------------
/**
* {@inheritDoc}
*
* @see org.objectweb.fractal.bf.connectors.nuxeo.NuxeoSkeletonContentAttributes#
* getNxservice()
*/
public String getNxservice()
{
return this.nxservice;
}
/**
* {@inheritDoc}
*
* @see org.objectweb.fractal.bf.connectors.nuxeo.NuxeoSkeletonContentAttributes#
* setNxservice(java.lang.String)
*/
public void setNxservice(String nxservice)
{
this.nxservice = nxservice;
}
/**
* {@inheritDoc}
*
......@@ -64,8 +91,8 @@ public class NuxeoStubContent extends AbstractStubContent implements
{
this.bindedDelegate =
((ExportedServiceLoaderItf)Framework.getRuntime().getComponent(
"org.ow2.frascati.nuxeo.service.bridge.ExportedServiceLoader")).createBindedDelegate(
this);
ExportedServiceLoaderItf.EXPORTED_SERVICE_LOADER)
).createBindedDelegate(this);
}
if(serviceObject == null)
{
......@@ -115,10 +142,10 @@ public class NuxeoStubContent extends AbstractStubContent implements
/**
* {@inheritDoc}
*
* @see org.ow2.frascati.nuxeo.service.bridge.api.BindedItf#getBindedClass()
* @see org.ow2.frascati.nuxeo.service.bridge.api.BindedItf#getInterfaceName()
*/
public Class<?> getBindedClass()
public String getInterfaceName()
{
return super.getServiceClass();
return super.getServiceClass().getCanonicalName();
}
}
......@@ -37,4 +37,21 @@ public interface NuxeoStubContentAttributes extends StubContentAttributes
* @return
*/
Object getServiceObject();
/**
* Return the nxservice attribute value
* nxservice value is used to identify the component providing the binded service
*
* @return the filter attribute value
*/
String getNxservice();
/**
* Set the nxservice attribute value
* nxservice value is used to identify the component providing the binded service
*
* @param nxservice
* the nxservice attribute to set
*/
void setNxservice(String nxservice);
}
......@@ -21,6 +21,8 @@
extends="org.objectweb.fractal.bf.connectors.common.PrimitiveSkeleton">
<content class="org.objectweb.fractal.bf.connectors.nuxeo.NuxeoSkeletonContent" />
<attributes signature="org.objectweb.fractal.bf.connectors.nuxeo.NuxeoSkeletonContentAttributes"/>
<attributes signature="org.objectweb.fractal.bf.connectors.nuxeo.NuxeoSkeletonContentAttributes">
<attribute name="nxservice" value="${context:nxservice}" />
</attributes>
</definition>
......@@ -20,6 +20,8 @@
<definition name="org.objectweb.fractal.bf.connectors.nuxeo.NuxeoStub"
extends="org.objectweb.fractal.bf.connectors.common.PrimitiveStub">
<attributes signature="org.objectweb.fractal.bf.connectors.nuxeo.NuxeoStubContentAttributes"/>
<attributes signature="org.objectweb.fractal.bf.connectors.nuxeo.NuxeoStubContentAttributes">
<attribute name="nxservice" value="${context:nxservice}" />
</attributes>
</definition>
......@@ -64,7 +64,8 @@ public class FrascatiBindingNuxeoProcessor extends
protected final void initializeBindingHints(NuxeoBinding nuxeoBinding,
Map<String, Object> hints)
{
String nxservice = nuxeoBinding.getNxservice();
hints.put("nxservice", nxservice);
}
// --------------------------------------------------------------------------
......
......@@ -36,7 +36,7 @@ public class NuxeoMetamodelProvider
// Public methods.
// --------------------------------------------------------------------------
/**
/**
* @see org.ow2.frascati.parser.api.MetamodelProvider#getEPackage()
*/
public final NuxeoPackage getEPackage()
......
......@@ -30,7 +30,7 @@
<implementation.java class="org.ow2.frascati.nuxeo.exporting.test.NuxeoExporter"/>
<service name="nuxeo-exporter-service">
<interface.java interface="org.ow2.frascati.nuxeo.exporting.test.NuxeoExporterItf"/>
<nuxeo:binding.nuxeo />
<nuxeo:binding.nuxeo nxservice="first_exported_frascati_service" />
</service>
</component>
......
......@@ -36,5 +36,4 @@ public interface BindedDelegateItf extends ComponentListener {
* Get the service Object which provides the binded service
*/
Object getServiceObject();
}
......@@ -41,7 +41,14 @@ public interface BindedItf
void stopBinded();
/**
* Nuxeo asks FraSCAti for the Interface class of the binded service
* Nuxeo asks FraSCAti for the Interface class of the service
*/
Class<?> getBindedClass();
String getInterfaceName();
/**
* Nuxeo asks FraSCAti for the Component name providing the service or the
* Interface class name of the service
*/
String getNxservice();
}
\ No newline at end of file
......@@ -30,18 +30,23 @@ package org.ow2.frascati.nuxeo.service.bridge.api;
*/
public interface ExportedItf
{
/**
* Get the Interface of the exported service
*/
Class<?> getExportedClass();
/**
* Get the exported service object
*/
Object getExportedObject();
/**
* Ask FraSCAti to stop the service from the Nuxeo context
* Nuxeo asks FraSCAti to stop the service
*/
void stopExported();
/**
* Nuxeo asks FraSCAti for the Interface class of the service
*/
String getInterfaceName();
/**
* Nuxeo asks FraSCAti for the Component name of the exported service
*/
String getNxservice();
}
\ No newline at end of file