high level services of athento platform

18
Yerbabuena Software ~ 2013 High-Level Services Athento Platform v.1.3.3 Víctor Sánchez ~ R&D Yerbabuena Software

Upload: athento

Post on 19-Jun-2015

101 views

Category:

Technology


1 download

DESCRIPTION

Servicios de Alto Nivel de Athento Platform.

TRANSCRIPT

Page 1: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

High-Level ServicesAthento Platform v.1.3.3Víctor Sánchez ~ R&DYerbabuena Software

Page 2: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

¿Qué son?✔ Los high-level services de Athento son

servicios de la plataforma capaces de ser accedidos mediante un conector de entrada.

✔ Se definen en la capa de HLS que conecta la capa de Core Service con los conectores de entrada mediante el servicio de interoperabilidad.

Page 3: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Ejemplos✔ Document Manager✔ Workflow: JBPM5 ~ Drools✔ Reporting✔ Monitoring✔ Export and import✔ Sign✔ Popmail✔ Batch✔ Notifier✔ ENI✔ Audit✔ Search✔ Publication ...●

Page 4: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Servicio: ¿Cómo crear uno?✔ Para crear un servicio, siempre un nuevo componente.<implementation class="org.yerbabuena.athento.MyServiceImplementation" />

<service><provide interface="org.yerbabuena.athento.MyServiceInterface" />

</service>

<extension-point name="anExtensionPoint"><object class="org.yerbabuena.athento.YourObjectDescriptor" />

</extension-point>

Page 5: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

¿Cómo acceder al servicio?✔ Sólo necesitamos llamar al método:

Framework.getService(MyServiceInterface.class)

✔ Si el servicio esta correctamente definido, se devolverá una nueva instancia.✔ No es necesario hacer ningún casting, obtendremos el objeto MyServiceInterface.

Page 6: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Servicios y puntos de extensión✔ La implementación de nuestro componente debe extender de la clase DefaultComponent e implementar la interfaz indicada en el XML definido.✔ DefaultComponent provee de:

✔ Un método registerContribution(...)✔ Un método activate(...)

Page 7: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Puntos de extensión✔ Sabemos que para contribuir siempre es necesario un EP.✔ Cada contribución será mapeada con descriptores de objeto.

✔ El mapeo será realizado con XMap.✔ Herramienta para mapear XML a objeto Java. (by Nuxeo)

✔ El método registerContribution(...) será llamado con el descriptor del punto de extensión.

Page 8: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Cómo mapea XMap✔ Archivo XML <persona nombre=”Juan”apellidos=”Español”> <edad>31</edad></persona>

✔ Clase Java@XObject("persona")public class PersonaDescriptor {

@XNode("@nombre")protected String nombre;

@XNode("@apellidos")private String apellidos;

@XNode("edad")private int edad;

// getters and setters...

}

Page 9: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Registrando contribuciones✔ Cada vez que OSGi Runtime encuentra una contribución de un EP, llama al método registerContribution del servicio que lo contiene.✔ En el método, obtenemos el parámetro que será el objeto java descriptor del XML que describe el EP.✔ Podemos gestionarlo a nuestro gusto.

Page 10: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Haciéndolo High-Level Service✔ Para hacer nuestro servicio high-level service de Athento Manager debemos anotar nuestra interfaz de servicio con la anotación @Service.

✔ Como hablamos al principio podemos restringir el acceso a los servicios de Athento Manager a llamadas en modo GET y/o POST. Para ello, usaremos las anotaciones @Get ó @Post a nivel de método de la implementación del servicio.

Page 11: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

High-Level Service: ejemplo@Servicepublic interface DocumentManager {

PlatformFolder createFolder(String name, String destinyPath) throws DocumentException;

DocumentRef copyDocument(String docId, String destinyPath) throws DocumentException;

// More methods...

}

Page 12: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

High-Level Service: ejemplo (2)@AllowedAll@AuthorizationRequiredpublic class DocumentManagerImpl extends AthentoHighLevelService

implements DocumentManager {

@GetPlatformFolder createFolder(String name, String

destinyPath) throws DocumentException {...}

@PostDocumentRef copyDocument(String docId, String

destinyPath) throws DocumentException {..}

// More methods...

}

Page 13: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Anotando parámetros✔ Cuando queremos asociar el nombre a un parámetro de un método de un servicio para poder asociarlo en una llamada a conector de entrada usaremos la anotación @ParamName.

@Get@PostPlatformFolder createFolder(

@ParamName(“nombre”) String name, @ParamName(“destino”) String destinyPath)

throws DocumentException;

Page 14: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Seguridad y acceso✔ Es posible aplicar control de acceso mediante conectores a los high-level services de Athento Manager:

✔ Podemos permitir acceso.<services allowedAll="true">

<allowed>org.yerbabuena.athento.manager.HighLevelServie</allowed></services>

✔ Podemos denegar acceso.<services allowedAll="false">

<denied>org.yerbabuena.athento.manager.HighLevelServie</denied></services>

Page 15: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Representaciones✔ Las representaciones son utilizadas para definir elementos que puedan usarse como elemento interoperable en un HLS.✔ Una representación podrá visualizarse en XML, JSON, JavaObject, etc. (o cualquier mimetype definid por el usuario).✔ Toda representación debe implementar la interfaz Representable, para visualizarse como elemento en una operación resultado, o bien, RepresentationAdapter, para manejarse como argumento a la entrada de una funcionalidad de un HLS.

Page 16: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Representaciones (2)✔ Ejemplos.✔ Documentopublic class PlatformDocument extends PlatformObject implements SingleDocument,

Representable, Serializable

@XmlAccessorType(value = XmlAccessType.PROPERTY)@XmlType(name = "documentRepresentation")@XmlRootElement(name = "document")public class DocumentRepresentation extends CmisObjectRepresentation implements

RepresentationAdapter, Serializable {

Page 17: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Ejercicio

Creando un High-level service.

Page 18: High Level Services of Athento Platform

Yerbabuena Software ~ 2013

Athento Platform

¡Gracias!