Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gravity
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Peter Harrison
gravity
Commits
29be6115
Commit
29be6115
authored
Jan 24, 2016
by
Peter Harrison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modification of MongoDB connection to connect to multiple hosts
parent
3760a029
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
src/main/java/nz/net/orcon/kanban/tools/OcmMapperFactory.java
...main/java/nz/net/orcon/kanban/tools/OcmMapperFactory.java
+12
-4
No files found.
src/main/java/nz/net/orcon/kanban/tools/OcmMapperFactory.java
View file @
29be6115
...
@@ -48,6 +48,7 @@ import org.slf4j.LoggerFactory;
...
@@ -48,6 +48,7 @@ import org.slf4j.LoggerFactory;
import
com.mongodb.DB
;
import
com.mongodb.DB
;
import
com.mongodb.MongoClient
;
import
com.mongodb.MongoClient
;
import
com.mongodb.ServerAddress
;
public
class
OcmMapperFactory
{
public
class
OcmMapperFactory
{
...
@@ -80,10 +81,18 @@ public class OcmMapperFactory {
...
@@ -80,10 +81,18 @@ public class OcmMapperFactory {
if
(
this
.
repository
==
null
){
if
(
this
.
repository
==
null
){
logger
.
info
(
"Creating Repository"
);
logger
.
info
(
"Creating Repository"
);
// MEMORY REPO
// repository = new Jcr(new Oak()).createRepository();
DB
db
=
new
MongoClient
(
host
,
27017
).
getDB
(
"gravity"
);
String
[]
hostArray
=
this
.
getHost
().
split
(
","
);
List
<
String
>
hostList
=
Arrays
.
asList
(
hostArray
);
List
<
ServerAddress
>
serverList
=
new
ArrayList
<
ServerAddress
>();
for
(
String
hostURL
:
hostList
){
ServerAddress
sa
=
new
ServerAddress
(
hostURL
);
serverList
.
add
(
sa
);
}
MongoClient
mc
=
new
MongoClient
(
serverList
);
DB
db
=
mc
.
getDB
(
"gravity"
);
DocumentNodeStore
ns
=
new
DocumentMK
.
Builder
().
DocumentNodeStore
ns
=
new
DocumentMK
.
Builder
().
setMongoDB
(
db
).
getNodeStore
();
setMongoDB
(
db
).
getNodeStore
();
...
@@ -198,5 +207,4 @@ public class OcmMapperFactory {
...
@@ -198,5 +207,4 @@ public class OcmMapperFactory {
public
void
setHost
(
String
host
)
{
public
void
setHost
(
String
host
)
{
this
.
host
=
host
;
this
.
host
=
host
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment