You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "Roger Fischer (CW)" <rf...@Brocade.com> on 2017/07/12 23:31:22 UTC

Provide persistence settings inline for Cassandra KeyValuePersistenceSettings?

Hello,

all the examples for the Cassandra integration load the persistence settings from a resource. Here is one such example:

<bean id="cache2_persistence_settings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
    <constructor-arg type="org.springframework.core.io.Resource" value="classpath:org/apache/ignite/tests/persistence/blob/persistence-settings-3.xml" />
</bean>

Is it possible to define the persistence settings inline, ie. in the same file as the cache configuration?

I tried the following:

<bean id="fabricCachePersistenceSettings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
    <persistence keyspace="test_11" table="fabric">
        <keyPersistence class="java.lang.Long" strategy="PRIMITIVE"/>
        <valuePersistence class="com.brocade.poc.icpoc.model.Fabric" strategy="POJO">
            <field name="id"/>  <!-- column is not needed when same as name -->
            <field name="name"/>
            <field name="wwn"/>
        </valuePersistence>
    </persistence>
</bean>

But that resulted in the following error:

class org.apache.ignite.IgniteException: Failed to instantiate Spring XML application context [springUrl=file:/home/ignite/ignite/test-ignite-cassandra/config-server-cassandra.xml, err=Line 48 in XML document from URL [file:/home/ignite/ignite/test-ignite-cassandra/config-server-cassandra.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 48; columnNumber: 56; cvc-complex-type.2.4.a: Invalid content was found starting with element 'persistence'. One of '{"http://www.springframework.org/schema/beans":description, "http://www.springframework.org/schema/beans":meta, "http://www.springframework.org/schema/beans":constructor-arg, "http://www.springframework.org/schema/beans":property, "http://www.springframework.org/schema/beans":qualifier, "http://www.springframework.org/schema/beans":lookup-method, "http://www.springframework.org/schema/beans":replaced-method, WC[##other:"http://www.springframework.org/schema/beans"]}' is expected.]

I understand that in most cases it makes more sense to use a resource. But for some basic ad-hoc testing it would be convenient to define everything in the same file.

Roger



RE: Provide persistence settings inline for Cassandra KeyValuePersistenceSettings?

Posted by "Roger Fischer (CW)" <rf...@Brocade.com>.
Thanks, Evgenii.

A minor addition, the content needs to be CDATA, as the value element is of string type and does not allow nested content.

    <bean id="fabricCachePersistenceSettings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
        <constructor-arg type="java.lang.String">
            <value><![CDATA[
                <persistence keyspace="test_11" table="fabric">
                    <keyPersistence class="java.util.UUID" strategy="PRIMITIVE" column="id"/>
                    <valuePersistence class="com.brocade.poc.icpoc.model.Fabric" strategy="POJO">
                        <field name="id"/>
                        <field name="name"/>
                        <field name="wwn"/>
                    </valuePersistence>
                </persistence>
            ]]></value>
        </constructor-arg>
    </bean>

Roger

-----Original Message-----
From: ezhuravlev [mailto:e.zhuravlev.wk@gmail.com] 
Sent: Thursday, July 13, 2017 9:52 AM
To: user@ignite.apache.org
Subject: Re: Provide persistence settings inline for Cassandra KeyValuePersistenceSettings?

Hi,

It's possible to provide settings with String:

<bean id="primitive_csndra_cache"
class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
        <constructor-arg type="java.lang.String">
            <value>
            </value>
        </constructor-arg>
</bean>

Evgenii



--
View this message in context: https://urldefense.proofpoint.com/v2/url?u=http-3A__apache-2Dignite-2Dusers.70518.x6.nabble.com_Provide-2Dpersistence-2Dsettings-2Dinline-2Dfor-2DCassandra-2DKeyValuePersistenceSettings-2Dtp14724p14802.html&d=DwICAg&c=IL_XqQWOjubgfqINi2jTzg&r=1esZO0r0bYS90lcsaLA6N4AFxuNo6lzauhETGwdJQoQ&m=oFtkRV0l1GX-YlPjnUxPiIxl_HbLMhLdTALzbO-Sjc8&s=u0WEmBkbt-RMyLk-ca_nYzff1H91EdDQt3RG_BrXE6g&e= 
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Provide persistence settings inline for Cassandra KeyValuePersistenceSettings?

Posted by ezhuravlev <e....@gmail.com>.
Hi,

It's possible to provide settings with String:

<bean id="primitive_csndra_cache"
class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
        <constructor-arg type="java.lang.String">
            <value>
            </value>
        </constructor-arg>
</bean>

Evgenii



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Provide-persistence-settings-inline-for-Cassandra-KeyValuePersistenceSettings-tp14724p14802.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.