├── mongodb-for-geoevent.png
├── CONTRIBUTING.md
├── mongodb-transport
├── src
│ └── main
│ │ ├── resources
│ │ ├── OSGI-INF
│ │ │ └── blueprint
│ │ │ │ └── config.xml
│ │ ├── com
│ │ │ └── esri
│ │ │ │ └── geoevent
│ │ │ │ └── transport
│ │ │ │ └── mongodb-transport.properties
│ │ └── outboundtransport-definition.xml
│ │ └── java
│ │ └── com
│ │ └── esri
│ │ └── geoevent
│ │ └── transport
│ │ └── mongodb
│ │ ├── MongoDBOutboundTransportService.java
│ │ └── MongoDBOutboundTransport.java
├── Mongo_Connector.xml
└── pom.xml
├── pom.xml
├── README.md
├── .gitignore
└── license.txt
/mongodb-for-geoevent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/mongodb-for-geoevent/HEAD/mongodb-for-geoevent.png
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing).
--------------------------------------------------------------------------------
/mongodb-transport/src/main/resources/OSGI-INF/blueprint/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/mongodb-transport/src/main/java/com/esri/geoevent/transport/mongodb/MongoDBOutboundTransportService.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 1995-2013 Esri
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 |
16 | For additional information, contact:
17 | Environmental Systems Research Institute, Inc.
18 | Attn: Contracts Dept
19 | 380 New York Street
20 | Redlands, California, USA 92373
21 |
22 | email: contracts@esri.com
23 | */
24 |
25 | package com.esri.geoevent.transport.mongodb;
26 |
27 | import com.esri.ges.core.component.ComponentException;
28 | import com.esri.ges.transport.Transport;
29 | import com.esri.ges.transport.TransportServiceBase;
30 | import com.esri.ges.transport.util.XmlTransportDefinition;
31 |
32 | public class MongoDBOutboundTransportService extends TransportServiceBase
33 | {
34 | public MongoDBOutboundTransportService()
35 | {
36 | definition = new XmlTransportDefinition(getResourceAsStream("outboundtransport-definition.xml"));
37 | }
38 |
39 | @Override
40 | public Transport createTransport() throws ComponentException
41 | {
42 | return new MongoDBOutboundTransport(definition);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | com.esri.geoevent.parent
6 | mongodb
7 | 10.4.0
8 | pom
9 |
10 | Esri :: GeoEvent :: MongoDB
11 | http://www.esri.com
12 |
13 |
14 | geoevent@esri.com
15 | UTF-8
16 | 2.3.6
17 | 4.8.1
18 |
19 |
20 |
21 | mongodb-transport
22 |
23 |
24 |
25 |
26 | com.esri.geoevent.sdk
27 | geoevent-sdk
28 | 10.4.0
29 | provided
30 |
31 |
32 | junit
33 | junit
34 | ${junit.version}
35 | test
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | org.apache.felix
44 | maven-bundle-plugin
45 | true
46 | ${maven.bundle.plugin.version}
47 |
48 |
49 | org.apache.maven.plugins
50 | maven-compiler-plugin
51 | 2.5.1
52 |
53 | 1.7
54 | 1.7
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/mongodb-transport/Mongo_Connector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | mongodb-json-out
8 | ${com.esri.geoevent.transport.mongodb-transport.CONNECTOR_DESC}
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/mongodb-transport/src/main/resources/com/esri/geoevent/transport/mongodb-transport.properties:
--------------------------------------------------------------------------------
1 | # Outbound Adapter Definition
2 | TRANSPORT_OUT_LABEL=MongoDB Outbound Transport
3 | TRANSPORT_OUT_DESC=MongoDB Outbound Transport Writer
4 | TRANSPORT_OUT_HOSTNAME_LBL=Host Name
5 | TRANSPORT_OUT_HOSTNAME_DESC=The name of the machine where the Mongo database is located
6 | TRANSPORT_OUT_PORT_LBL=Port
7 | TRANSPORT_OUT_PORT_DESC=The port where the Mongo database is listening for connections.
8 | TRANSPORT_OUT_DB_NAME_LBL=Database Name
9 | TRANSPORT_OUT_DB_NAME_DESC=The name of the database where you want to store the data
10 | TRANSPORT_OUT_USERNAME_LBL=Authentication User Name
11 | TRANSPORT_OUT_USERNAME_DESC=If authentication is required to write to this database, enter the user name here.
12 | TRANSPORT_OUT_PASSWORD_LBL=Authentication Password
13 | TRANSPORT_OUT_PASSWORD_DESC=If authentication is required to write to this database, enter the password here.
14 | TRANSPORT_OUT_COLLECTION_NAME_LBL=Collection Name
15 | TRANSPORT_OUT_COLLECTION_NAME_DESC=The name of the collection where the data will be written
16 | TRANSPORT_OUT_WRITE_CONCERN_LBL=Write Concern
17 | TRANSPORT_OUT_WRITE_CONCERN_DESC=The method that is used to write data to the Mongo Database. For details, consult the Mongo DB Documentation on different write concern modes. Errors encountered will be logged, but will not stop the processing of future GeoEvents.
18 |
19 | # Connector Definition
20 | CONNECTOR_LABEL=Write JSON documents to MongoDB
21 | CONNECTOR_DESC=Writes a JSON document representation of each GeoEvent observed to a MongoDB document store.
22 | CONNECTOR_USERNAME_LBL=Authentication User Name
23 | CONNECTOR_PASSWORD_LBL=Authentication Password
24 | CONNECTOR_PJSON_LBL=Formatted JSON
25 | CONNECTOR_WRITE_CONCERN_LBL=Write Concern
26 | CONNECTOR_MIME_TYPE_LBL=MIME Type
27 | CONNECTOR_HOSTNAME_LBL=Host Name
28 | CONNECTOR_PORT_LBL=Port
29 | CONNECTOR_DB_NAME_LBL=Database Name
30 | CONNECTOR_COLLECTION_NAME_LBL=Collection Name
31 |
32 | # Log Messages
33 | AUTHENTICATION_ERROR=Failed to authenticate to the Mongo Database Server at "{0}" using the name "{1}" and the configured password.
34 | RECEIVE_ERROR=An unexpected error has occurred while receiving messages. Error: {0}.
35 | DECODE_ERROR=An unexpected error has occurred while decoding the incoming buffer. Error: {0}.
36 | START_ERROR=An unexpected error has occurred while starting the MongoDB output transport. Error: {0}.
--------------------------------------------------------------------------------
/mongodb-transport/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | com.esri.geoevent.parent
6 | mongodb
7 | 10.4.0
8 |
9 | com.esri.geoevent.transport
10 | mongodb-transport
11 | Esri :: GeoEvent :: Transport :: MongoDB
12 | bundle
13 |
14 |
15 |
16 | org.mongodb
17 | mongo-java-driver
18 | 2.11.1
19 |
20 |
21 |
22 |
23 |
24 |
25 | org.apache.maven.plugins
26 | maven-dependency-plugin
27 |
28 |
29 | copy-mongo-client-driver
30 | prepare-package
31 |
32 | copy
33 |
34 |
35 |
36 |
37 | org.mongodb
38 | mongo-java-driver
39 | jar
40 | false
41 |
42 |
43 | ${project.build.directory}
44 | false
45 | false
46 | true
47 |
48 |
49 |
50 |
51 |
52 | org.apache.felix
53 | maven-bundle-plugin
54 | true
55 |
56 |
57 | ${project.groupId}.${project.artifactId}
58 | ${contact.address}
59 | ${project.version}
60 |
61 | com.esri.geoevent.transport.mongodb
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # mongodb-for-geoevent
2 | **This item has been deprecated. Please consider contributing an idea to the [Esri Community](https://community.esri.com/t5/arcgis-geoevent-server-ideas/idb-p/arcgis-geoevent-server-ideas) if you need similar functionality.**
3 |
4 | ArcGIS 10.4 GeoEvent Extension for Server sample MongoDB Ouptut Connector for sending GeoEvents to MongoDB.
5 |
6 | 
7 |
8 | ## Features
9 | * MongoDB Outbound Transport
10 |
11 | ## Instructions
12 |
13 | Building the source code:
14 |
15 | 1. Make sure Maven and ArcGIS GeoEvent Extension SDK are installed on your machine.
16 | 2. Run 'mvn install -Dcontact.address=[YourContactEmailAddress]'
17 |
18 | Installing the transport and connector:
19 |
20 | 1. Copy the *.jar files under the 'target' sub-folder(s) into the [ArcGIS-GeoEvent-Extension-Install-Directory]/deploy folder.
21 | 2. Open GeoEvent Manager, go to the 'Site -> Configuration Store' page and import the Mongo_Connector.xml file.
22 |
23 | ## Requirements
24 |
25 | * ArcGIS GeoEvent Extension for Server.
26 | * ArcGIS GeoEvent Extension SDK.
27 | * Java JDK 1.7 or greater.
28 | * Maven.
29 |
30 | ## Resources
31 |
32 | * [Download the connector's tutorial](http://www.arcgis.com/home/item.html?id=0f246f7e9f074b3f80b24724b460e82f) from the ArcGIS GeoEvent Extension Gallery
33 | * [ArcGIS GeoEvent Extension for Server Resources](http://links.esri.com/geoevent)
34 | * [ArcGIS Blog](http://blogs.esri.com/esri/arcgis/)
35 | * [twitter@esri](http://twitter.com/esri)
36 |
37 | ## Issues
38 |
39 | Find a bug or want to request a new feature? Please let us know by submitting an issue.
40 |
41 | ## Contributing
42 |
43 | Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing).
44 |
45 | ## Licensing
46 | Copyright 2013 Esri
47 |
48 | Licensed under the Apache License, Version 2.0 (the "License");
49 | you may not use this file except in compliance with the License.
50 | You may obtain a copy of the License at
51 |
52 | http://www.apache.org/licenses/LICENSE-2.0
53 |
54 | Unless required by applicable law or agreed to in writing, software
55 | distributed under the License is distributed on an "AS IS" BASIS,
56 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
57 | See the License for the specific language governing permissions and
58 | limitations under the License.
59 |
60 | A copy of the license is available in the repository's [license.txt](license.txt?raw=true) file.
61 |
--------------------------------------------------------------------------------
/mongodb-transport/src/main/resources/outboundtransport-definition.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | ${com.esri.geoevent.transport.mongodb-transport.TRANSPORT_OUT_DESC}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | ERRORS_IGNOREDACKNOWLEDGEDUNACKNOWLEDGEDJOURNALEDREPLICA_ACKNOWLEDGED
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #################
2 | ## Eclipse
3 | #################
4 |
5 | *.pydevproject
6 | .project
7 | .metadata
8 | bin/
9 | tmp/
10 | *.tmp
11 | *.bak
12 | *.swp
13 | *~.nib
14 | local.properties
15 | .classpath
16 | .settings/
17 | .loadpath
18 | target
19 |
20 | # External tool builders
21 | .externalToolBuilders/
22 |
23 | # Locally stored "Eclipse launch configurations"
24 | *.launch
25 |
26 | # CDT-specific
27 | .cproject
28 |
29 | # PDT-specific
30 | .buildpath
31 |
32 |
33 | #################
34 | ## Visual Studio
35 | #################
36 |
37 | ## Ignore Visual Studio temporary files, build results, and
38 | ## files generated by popular Visual Studio add-ons.
39 |
40 | # User-specific files
41 | *.suo
42 | *.user
43 | *.sln.docstates
44 |
45 | # Build results
46 |
47 | [Dd]ebug/
48 | [Rr]elease/
49 | x64/
50 | build/
51 | [Bb]in/
52 | [Oo]bj/
53 |
54 | # MSTest test Results
55 | [Tt]est[Rr]esult*/
56 | [Bb]uild[Ll]og.*
57 |
58 | *_i.c
59 | *_p.c
60 | *.ilk
61 | *.meta
62 | *.obj
63 | *.pch
64 | *.pdb
65 | *.pgc
66 | *.pgd
67 | *.rsp
68 | *.sbr
69 | *.tlb
70 | *.tli
71 | *.tlh
72 | *.tmp
73 | *.tmp_proj
74 | *.log
75 | *.vspscc
76 | *.vssscc
77 | .builds
78 | *.pidb
79 | *.log
80 | *.scc
81 |
82 | # Visual C++ cache files
83 | ipch/
84 | *.aps
85 | *.ncb
86 | *.opensdf
87 | *.sdf
88 | *.cachefile
89 |
90 | # Visual Studio profiler
91 | *.psess
92 | *.vsp
93 | *.vspx
94 |
95 | # Guidance Automation Toolkit
96 | *.gpState
97 |
98 | # ReSharper is a .NET coding add-in
99 | _ReSharper*/
100 | *.[Rr]e[Ss]harper
101 |
102 | # TeamCity is a build add-in
103 | _TeamCity*
104 |
105 | # DotCover is a Code Coverage Tool
106 | *.dotCover
107 |
108 | # NCrunch
109 | *.ncrunch*
110 | .*crunch*.local.xml
111 |
112 | # Installshield output folder
113 | [Ee]xpress/
114 |
115 | # DocProject is a documentation generator add-in
116 | DocProject/buildhelp/
117 | DocProject/Help/*.HxT
118 | DocProject/Help/*.HxC
119 | DocProject/Help/*.hhc
120 | DocProject/Help/*.hhk
121 | DocProject/Help/*.hhp
122 | DocProject/Help/Html2
123 | DocProject/Help/html
124 |
125 | # Click-Once directory
126 | publish/
127 |
128 | # Publish Web Output
129 | *.Publish.xml
130 | *.pubxml
131 |
132 | # NuGet Packages Directory
133 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
134 | #packages/
135 |
136 | # Windows Azure Build Output
137 | csx
138 | *.build.csdef
139 |
140 | # Windows Store app package directory
141 | AppPackages/
142 |
143 | # Others
144 | sql/
145 | *.Cache
146 | ClientBin/
147 | [Ss]tyle[Cc]op.*
148 | ~$*
149 | *~
150 | *.dbmdl
151 | *.[Pp]ublish.xml
152 | *.pfx
153 | *.publishsettings
154 |
155 | # RIA/Silverlight projects
156 | Generated_Code/
157 |
158 | # Backup & report files from converting an old project file to a newer
159 | # Visual Studio version. Backup files are not needed, because we have git ;-)
160 | _UpgradeReport_Files/
161 | Backup*/
162 | UpgradeLog*.XML
163 | UpgradeLog*.htm
164 |
165 | # SQL Server files
166 | App_Data/*.mdf
167 | App_Data/*.ldf
168 |
169 | #############
170 | ## Windows detritus
171 | #############
172 |
173 | # Windows image file caches
174 | Thumbs.db
175 | ehthumbs.db
176 |
177 | # Folder config file
178 | Desktop.ini
179 |
180 | # Recycle Bin used on file shares
181 | $RECYCLE.BIN/
182 |
183 | # Mac crap
184 | .DS_Store
185 |
186 |
187 | #############
188 | ## Python
189 | #############
190 |
191 | *.py[co]
192 |
193 | # Packages
194 | *.egg
195 | *.egg-info
196 | dist/
197 | build/
198 | eggs/
199 | parts/
200 | var/
201 | sdist/
202 | develop-eggs/
203 | .installed.cfg
204 |
205 | # Installer logs
206 | pip-log.txt
207 |
208 | # Unit test / coverage reports
209 | .coverage
210 | .tox
211 |
212 | #Translations
213 | *.mo
214 |
215 | #Mr Developer
216 | .mr.developer.cfg
217 |
--------------------------------------------------------------------------------
/mongodb-transport/src/main/java/com/esri/geoevent/transport/mongodb/MongoDBOutboundTransport.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 1995-2013 Esri
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 |
16 | For additional information, contact:
17 | Environmental Systems Research Institute, Inc.
18 | Attn: Contracts Dept
19 | 380 New York Street
20 | Redlands, California, USA 92373
21 |
22 | email: contracts@esri.com
23 | */
24 |
25 | package com.esri.geoevent.transport.mongodb;
26 |
27 | import java.io.IOException;
28 | import java.nio.ByteBuffer;
29 | import java.nio.CharBuffer;
30 | import java.nio.charset.CharacterCodingException;
31 | import java.nio.charset.CharsetDecoder;
32 |
33 | import com.esri.ges.core.ConfigurationException;
34 | import com.esri.ges.core.component.ComponentException;
35 | import com.esri.ges.core.component.RunningState;
36 | import com.esri.ges.framework.i18n.BundleLogger;
37 | import com.esri.ges.framework.i18n.BundleLoggerFactory;
38 | import com.esri.ges.transport.OutboundTransportBase;
39 | import com.esri.ges.transport.TransportDefinition;
40 | import com.mongodb.DB;
41 | import com.mongodb.DBCollection;
42 | import com.mongodb.DBObject;
43 | import com.mongodb.MongoClient;
44 | import com.mongodb.WriteConcern;
45 |
46 | public class MongoDBOutboundTransport extends OutboundTransportBase
47 | {
48 | private static final BundleLogger LOGGER = BundleLoggerFactory.getLogger(MongoDBOutboundTransport.class);
49 |
50 | private static final String HOST_NAME_PROPERTY = "outputHostName";
51 | private static final String PORT_PROPERTY = "outputPort";
52 | private static final String DATABASE_NAME_PROPERTY = "outputDatabaseName";
53 | private static final String USER_NAME_PROPERTY = "outputUserName";
54 | private static final String PASSWORD_PROPERTY = "outputPassword";
55 | private static final String COLLECTION_NAME_PROPERTY = "outputCollectionName";
56 | private static final String WRITE_CONCERN_PROPERTY = "outputWriteConcern";
57 |
58 | private String host = "localhost";
59 | private int port = 27017;
60 | private String databaseName = "db";
61 | private String userName = "";
62 | private String password = "";
63 | private String collectionName = "test";
64 | private WriteConcern writeConcern;
65 | private String errorMessage;
66 | private MongoClient mongoClient;
67 | private DB db;
68 |
69 | private DBCollection collection;
70 |
71 | public MongoDBOutboundTransport(TransportDefinition definition) throws ComponentException
72 | {
73 | super(definition);
74 | }
75 |
76 | protected void readProperties() throws ConfigurationException
77 | {
78 | if (hasProperty(HOST_NAME_PROPERTY))
79 | host = getProperty(HOST_NAME_PROPERTY).getValueAsString();
80 | else
81 | host = "localhost";
82 |
83 | if (hasProperty(PORT_PROPERTY))
84 | port = ((Integer) getProperty(PORT_PROPERTY).getValue());
85 | else
86 | port = 27017;
87 |
88 | if (hasProperty(DATABASE_NAME_PROPERTY))
89 | databaseName = getProperty(DATABASE_NAME_PROPERTY).getValueAsString();
90 | else
91 | databaseName = "db";
92 |
93 | if (hasProperty(USER_NAME_PROPERTY))
94 | userName = getProperty(USER_NAME_PROPERTY).getValueAsString();
95 | else
96 | userName = "";
97 |
98 | if (hasProperty(PASSWORD_PROPERTY))
99 | password = getProperty(PASSWORD_PROPERTY).getValueAsString();
100 | else
101 | password = "";
102 |
103 | if (hasProperty(COLLECTION_NAME_PROPERTY))
104 | collectionName = getProperty(COLLECTION_NAME_PROPERTY).getValueAsString();
105 | else
106 | collectionName = "GeoEvents";
107 |
108 | if (hasProperty(WRITE_CONCERN_PROPERTY))
109 | {
110 | String writeConcernString = getProperty(WRITE_CONCERN_PROPERTY).getValueAsString();
111 | writeConcern = WriteConcern.valueOf(writeConcernString);
112 | }
113 | }
114 |
115 | private void applyProperties() throws IOException
116 | {
117 | mongoClient = new MongoClient(host, port);
118 | mongoClient.setWriteConcern(writeConcern);
119 | db = mongoClient.getDB(databaseName);
120 |
121 | boolean auth = true;
122 | if (userName != null && userName.length() > 0 && password != null && password.length() > 0)
123 | {
124 | auth = db.authenticate(userName, password.toCharArray());
125 | }
126 | if (!auth)
127 | {
128 | throw new IOException(LOGGER.translate("AUTHENTICATION_ERROR", host, userName));
129 | }
130 |
131 | collection = db.getCollection(collectionName);
132 | }
133 |
134 | @Override
135 | public void afterPropertiesSet()
136 | {
137 | try
138 | {
139 | readProperties();
140 | if (getRunningState() == RunningState.STARTED)
141 | {
142 | cleanup();
143 | applyProperties();
144 | }
145 | }
146 | catch (Exception error)
147 | {
148 | errorMessage = error.getMessage();
149 | LOGGER.error(errorMessage, error);
150 | setRunningState(RunningState.ERROR);
151 | }
152 | }
153 |
154 | @Override
155 | public void receive(ByteBuffer buffer, String channelId)
156 | {
157 | if (this.getRunningState() == RunningState.STARTED)
158 | {
159 | try
160 | {
161 | String json = convertToString(buffer);
162 | DBObject dbObj = (DBObject) com.mongodb.util.JSON.parse(json);
163 | collection.insert(dbObj);
164 | }
165 | catch (Exception error)
166 | {
167 | LOGGER.error("RECEIVE_ERROR", error.getMessage());
168 | LOGGER.info(error.getMessage(), error);
169 | }
170 | }
171 | }
172 |
173 | private String convertToString(ByteBuffer buffer)
174 | {
175 | try
176 | {
177 | CharsetDecoder decoder = getCharsetDecoder();
178 | CharBuffer charBuffer = decoder.decode(buffer);
179 | String decodedBuffer = charBuffer.toString();
180 | return decodedBuffer;
181 | }
182 | catch (CharacterCodingException error)
183 | {
184 | LOGGER.error("DECODE_ERROR", error.getMessage());
185 | LOGGER.info(error.getMessage(), error);
186 | buffer.clear();
187 | return null;
188 | }
189 | }
190 |
191 | private void cleanup()
192 | {
193 | errorMessage = "";
194 | if (mongoClient != null)
195 | {
196 | mongoClient.close();
197 | mongoClient = null;
198 | }
199 | }
200 |
201 | @Override
202 | public synchronized void start()
203 | {
204 | if (isRunning())
205 | return;
206 | try
207 | {
208 | this.setRunningState(RunningState.STARTING);
209 | applyProperties();
210 | this.setRunningState(RunningState.STARTED);
211 | }
212 | catch (IOException error)
213 | {
214 | String errorMsg = LOGGER.translate("START_ERROR", error.getMessage());
215 | LOGGER.error(errorMsg);
216 | LOGGER.info(error.getMessage(), error);
217 | errorMessage = error.getMessage();
218 | this.setRunningState(RunningState.ERROR);
219 | }
220 | }
221 |
222 | @Override
223 | public synchronized void stop()
224 | {
225 | this.setRunningState(RunningState.STOPPING);
226 | cleanup();
227 | this.setRunningState(RunningState.STOPPED);
228 | }
229 |
230 | @Override
231 | public String getStatusDetails()
232 | {
233 | return errorMessage;
234 | }
235 |
236 | public enum CollectionNameMethod
237 | {
238 | Static, ByField;
239 | }
240 | }
241 |
--------------------------------------------------------------------------------
/license.txt:
--------------------------------------------------------------------------------
1 | Apache License - 2.0
2 |
3 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
4 |
5 | 1. Definitions.
6 |
7 | "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
8 |
9 | "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
10 |
11 | "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control
12 | with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management
13 | of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial
14 | ownership of such entity.
15 |
16 | "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
17 |
18 | "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source,
19 | and configuration files.
20 |
21 | "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to
22 | compiled object code, generated documentation, and conversions to other media types.
23 |
24 | "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice
25 | that is included in or attached to the work (an example is provided in the Appendix below).
26 |
27 | "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the
28 | editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes
29 | of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of,
30 | the Work and Derivative Works thereof.
31 |
32 | "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work
33 | or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual
34 | or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of
35 | electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on
36 | electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for
37 | the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing
38 | by the copyright owner as "Not a Contribution."
39 |
40 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and
41 | subsequently incorporated within the Work.
42 |
43 | 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual,
44 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display,
45 | publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
46 |
47 | 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide,
48 | non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell,
49 | sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are
50 | necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was
51 | submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work
52 | or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You
53 | under this License for that Work shall terminate as of the date such litigation is filed.
54 |
55 | 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications,
56 | and in Source or Object form, provided that You meet the following conditions:
57 |
58 | 1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
59 |
60 | 2. You must cause any modified files to carry prominent notices stating that You changed the files; and
61 |
62 | 3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices
63 | from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
64 |
65 | 4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a
66 | readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the
67 | Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the
68 | Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever
69 | such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License.
70 | You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work,
71 | provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to
72 | Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your
73 | modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with
74 | the conditions stated in this License.
75 |
76 | 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You
77 | to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above,
78 | nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
79 |
80 | 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except
81 | as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
82 |
83 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides
84 | its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation,
85 | any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
86 | determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under
87 | this License.
88 |
89 | 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required
90 | by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages,
91 | including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the
92 | use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or
93 | any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
94 |
95 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a
96 | fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting
97 | such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree
98 | to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your
99 | accepting any such warranty or additional liability.
100 |
101 | END OF TERMS AND CONDITIONS
--------------------------------------------------------------------------------