Revision: 14641
http://gate.svn.sourceforge.net/gate/?rev=14641&view=rev
Author: valyt
Date: 2011-12-02 11:27:52 +0000 (Fri, 02 Dec 2011)
Log Message:
-----------
- made all parameters run-time
- lazily create the mimir connector (to support all params being run-time)
Modified Paths:
--------------
mimir/branches/3.4/mimir-client/src/gate/mimir/index/MimirIndexingPR.java
Modified:
mimir/branches/3.4/mimir-client/src/gate/mimir/index/MimirIndexingPR.java
===================================================================
--- mimir/branches/3.4/mimir-client/src/gate/mimir/index/MimirIndexingPR.java
2011-12-02 11:13:25 UTC (rev 14640)
+++ mimir/branches/3.4/mimir-client/src/gate/mimir/index/MimirIndexingPR.java
2011-12-02 11:27:52 UTC (rev 14641)
@@ -50,6 +50,7 @@
}
@CreoleParameter (comment="The Index URL, as obtained from the Mímir
Server.")
+ @RunTime
public void setMimirIndexUrl(URL mimirIndexUrl) {
this.mimirIndexUrl = mimirIndexUrl;
}
@@ -60,8 +61,11 @@
@CreoleParameter(comment="Username for authenticating to the Mímir server.
Leave empty if no authentication is required.")
@Optional
+ @RunTime
public void setMimirUsername(String mimirUsername) {
this.mimirUsername = mimirUsername;
+ // invalidate the connector
+ this.mimirConnector = null;
}
public String getMimirPassword() {
@@ -70,8 +74,11 @@
@CreoleParameter(comment="Password for authenticating to the Mímir server.
Leave empty if no authentication is required.")
@Optional
+ @RunTime
public void setMimirPassword(String mimirPassword) {
this.mimirPassword = mimirPassword;
+ // invalidate the connector
+ this.mimirConnector = null;
}
@Override
@@ -80,22 +87,22 @@
}
@Override
- public Resource init() throws ResourceInstantiationException {
- super.init();
- WebUtils webUtils = null;
- if(mimirUsername != null && mimirUsername.length() > 0) {
- webUtils = new WebUtils(mimirUsername, mimirPassword);
- }
- mimirConnector = webUtils == null ? new MimirConnector() : new
MimirConnector(webUtils);
- return this;
- }
-
- @Override
public void execute() throws ExecutionException {
try {
+ if(mimirConnector == null) {
+ // first run or config has changed: [re-]create
+ if(mimirUsername != null && mimirUsername.length() > 0) {
+ mimirConnector = new MimirConnector(
+ new WebUtils(mimirUsername, mimirPassword));
+ } else {
+ mimirConnector = new MimirConnector();
+ }
+ }
+
mimirConnector.sendToMimir(getDocument(), null, mimirIndexUrl);
} catch(IOException e) {
- throw new ExecutionException("Error communicating with the Mímir
server", e);
+ throw new ExecutionException(
+ "Error communicating with the Mímir server", e);
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs