Configurando Plug-ins Ativados pelo OSGi Usando o Arquivo Descritor XML do ObjectGrid

Nesta tarefa, você inclui serviços OSGi existentes em um arquivo XML descritor de forma que os contêineres do WebSphere eXtreme Scale possam reconhecer e carregar os plug-ins ativados pelo OSGi corretamente.

Antes de Iniciar

Para configurar seus plug-ins, certifique-se de:

Sobre Esta Tarefa

Você criou um serviço OSGi para agrupar seu plug-in. Agora, esses serviços devem ser definidos no arquivo objectgrid.xml de modo que os contêineres do eXtreme Scale possam carregar e configurar o plug-in ou plug-ins com êxito.

Procedimento

  1. Quaisquer plug-ins específicos da grade, tal como TransactionCallback, devem ser especificados sob o elemento objectGrid. Consulte o exemplo a seguir a partir do arquivo objectgrid.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
        xmlns="http://ibm.com/ws/objectgrid/config">
    
        <objectGrids>
            <objectGrid name="MyGrid" txTimeout="60">
                <bean id="myTranCallback" osgiService="myTranCallbackFactory"/>
                ...
            </objectGrid>
            ...
        </objectGrids>
        ...
    /objectGridConfig>
    Importante: O valor de atributo osgiService deve corresponder ao valor de atributo ref que é especificado no arquivo XML blueprint, no qual o serviço foi definido para myTranCallback PluginServiceFactory.
  2. Quaisquer plug-ins específicos do mapa, como carregadores ou serializadores, por exemplo, devem ser especificados no elemento backingMapPluginCollections e referenciados a partir do elemento backingMap. Consulte o exemplo a seguir a partir do arquivo objectgrid.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    
    objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
        xmlns="http://ibm.com/ws/objectgrid/config">
        <objectGrids>
            <objectGrid name="MyGrid" txTimeout="60">
                <backingMap name="MyMap1" lockStrategy="PESSIMISTIC"
                    copyMode="COPY_TO_BYTES" nullValuesSupported="false"
                    pluginCollectionRef="myPluginCollectionRef1"/>
                <backingMap name="MyMap2" lockStrategy="PESSIMISTIC"
                    copyMode="COPY_TO_BYTES" nullValuesSupported="false"
                    pluginCollectionRef="myPluginCollectionRef2"/>
                ...
            </objectGrid>
            ...
        </objectGrids>
        ...
        <backingMapPluginCollections>
            <backingMapPluginCollection id="myPluginCollectionRef1">
                <bean id="MapSerializerPlugin" osgiService="mySerializerFactory"/>
            </backingMapPluginCollection>
            <backingMapPluginCollection id="myPluginCollectionRef2">
                <bean id="MapSerializerPlugin" osgiService="myOtherSerializerFactory"/>
                <bean id="Loader" osgiService="myLoader"/>
            </backingMapPluginCollection>
            ...
        </backingMapPluginCollections>
        ...
    </objectGridConfig>

Resultados

O arquivo objectgrid.xml neste exemplo informa ao eXtreme Scale para criar uma grade denominada MyGrid com dois mapas, MyMap1 e MyMap2. O mapa MyMap1 usa o serializador agrupado pelo serviço OSGi, mySerializerFactory. O mapa MyMap2 usa um serializador do serviço OSGi, myOtherSerializerFactory, e um carregador a partir do serviço OSGi, myLoader.