Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding configuration for PostgreSQL and generic JDBC databases #986

Merged
merged 1 commit into from Feb 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -31,6 +31,10 @@
fetch-state="true"
read-only="false"
purge="false">
<!-- JDNI datasource:
<jdbc:data-source jndi-url="jndi:jdbc/ispn"/>
-->
<!-- custom database connection pool -->
<jdbc:connection-pool connection-url="jdbc:mysql://${fcrepo.ispn.mysql.host:localhost}:${fcrepo.ispn.mysql.port:3306}/ispn?createDatabaseIfNotExist=true"
driver="com.mysql.jdbc.Driver"
username="${fcrepo.ispn.mysql.username}"
Expand Down
@@ -0,0 +1,56 @@
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:infinispan:config:7.2"
xmlns:jdbc="urn:infinispan:config:store:jdbc:7.2"
xsi:schemaLocation="urn:infinispan:config:7.2 http://www.infinispan.org/schemas/infinispan-config-7.2.xsd urn:infinispan:config:store:jdbc:7.2 http://infinispan.org/schemas/infinispan-cachestore-jdbc-config-7.2.xsd">

<cache-container default-cache="FedoraRepository">

<jmx duplicate-domains="true"/>

<local-cache name="FedoraRepository" statistics="true">

<transaction transaction-manager-lookup="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
mode="NON_XA"
locking="PESSIMISTIC"/>

<eviction max-entries="500" strategy="LIRS" thread-policy="DEFAULT"/>

<!--
Define the cache loaders (i.e., cache stores). Passivation is false because we want *all*
data to be persisted, not just what doesn't fit into memory. Shared is false because there
are no other caches sharing this jdbc store. We set preload to false for lazy loading;
may be improved by preloading and configuring eviction.

We can have multiple cache loaders, which get chained. But we'll define just one.

See: https://docs.jboss.org/infinispan/7.2/configdocs/infinispan-cachestore-jdbc-config-7.2.html
-->
<persistence passivation="false">
<jdbc:string-keyed-jdbc-store shared="false"
preload="false"
fetch-state="true"
read-only="false"
purge="false">
<!-- JDNI datasource:
<jdbc:data-source jndi-url="jndi:jdbc/ispn"/>
-->
<!-- custom database connection pool -->
<jdbc:connection-pool connection-url="jdbc:postgresql://${fcrepo.ispn.postgresql.host:localhost}:${fcrepo.ispn.postgresql.port:5432}/ispn"
driver="org.postgresql.Driver"
username="${fcrepo.ispn.postgresql.username}"
password="${fcrepo.ispn.postgresql.password}"/>
<jdbc:string-keyed-table prefix="ispn_entry"
create-on-start="true"
drop-on-exit="false">
<jdbc:id-column name="id" type="VARCHAR(255)"/>
<jdbc:data-column name="datum" type="BYTEA"/>
<jdbc:timestamp-column name="version" type="BIGINT"/>
</jdbc:string-keyed-table>

</jdbc:string-keyed-jdbc-store>

</persistence>
</local-cache>
</cache-container>

</infinispan>
@@ -0,0 +1,28 @@
{
"name" : "repo",
"jndiName" : "",
"workspaces" : {
"predefined" : ["default"],
"default" : "default",
"allowCreation" : true
},
"storage" : {
"cacheName" : "FedoraRepository",
"cacheConfiguration" : "${fcrepo.ispn.configuration:config/infinispan/jdbc-postgresql/infinispan.xml}",
"binaryStorage" : {
"type" : "file",
"directory" : "${fcrepo.binary.directory:target/binaries}",
"minimumBinarySizeInBytes" : 4096
}
},
"security" : {
"anonymous" : {
"roles" : ["readonly","readwrite","admin"],
"useOnFailedLogin" : false
},
"providers" : [
{ "classname" : "org.fcrepo.auth.common.BypassSecurityServletAuthenticationProvider" }
]
},
"node-types" : ["fedora-node-types.cnd"]
}
7 changes: 6 additions & 1 deletion fcrepo-webapp/pom.xml
Expand Up @@ -129,7 +129,7 @@
<version>1.4.01</version>
</dependency>

<!--MySQL dependencies-->
<!-- JDBC dependencies-->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
Expand All @@ -139,6 +139,11 @@
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-cachestore-jdbc</artifactId>
Expand Down