-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removes some warnings (about deprecated extensions and unused private
members)
- Loading branch information
1 parent
50f562c
commit 96c9dd1
Showing
30 changed files
with
441 additions
and
508 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 51 additions & 49 deletions
100
irit.gaml.extensions.database/src/irit/gaml/extensions/database/skills/GamaSQLSkill.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,74 @@ | ||
package irit.gaml.extensions.database.skills; | ||
|
||
import org.geotools.data.DataStore; | ||
import msi.gama.precompiler.GamlAnnotations.action; | ||
import msi.gama.precompiler.GamlAnnotations.arg; | ||
import msi.gama.precompiler.GamlAnnotations.doc; | ||
import msi.gama.precompiler.GamlAnnotations.skill; | ||
import msi.gama.database.geosql.GamaSqlConnection; | ||
import msi.gama.precompiler.GamlAnnotations.*; | ||
import msi.gama.runtime.IScope; | ||
import msi.gama.runtime.exceptions.GamaRuntimeException; | ||
import msi.gaml.skills.Skill; | ||
import msi.gaml.types.IType; | ||
import msi.gama.database.geosql.*; | ||
|
||
@skill(name = "GAMASQL") | ||
public class GamaSQLSkill extends Skill { | ||
private static final boolean DEBUG = false; // Change DEBUG = false for release version | ||
|
||
@action(name = "testConnection", | ||
args = { @arg(name = "params",type = IType.MAP, optional = false, doc = @doc("Connection parameters")) }) | ||
public boolean testConnection(final IScope scope) { | ||
// private static final boolean DEBUG = false; // Change DEBUG = false for release version | ||
|
||
GamaSqlConnection gamaSqlConn; | ||
gamaSqlConn = new GamaSqlConnection(scope); | ||
DataStore dataStore; | ||
try { | ||
dataStore = gamaSqlConn.Connect(scope); | ||
} catch (Exception e) { | ||
return false; | ||
} | ||
gamaSqlConn.setDataStore(dataStore); | ||
gamaSqlConn.close(); | ||
return true; | ||
@action(name = "testConnection", | ||
args = { @arg(name = "params", type = IType.MAP, optional = false, doc = @doc("Connection parameters") ) }) | ||
public boolean testConnection(final IScope scope) { | ||
|
||
GamaSqlConnection gamaSqlConn; | ||
gamaSqlConn = new GamaSqlConnection(scope); | ||
DataStore dataStore; | ||
try { | ||
dataStore = gamaSqlConn.Connect(scope); | ||
} catch (Exception e) { | ||
return false; | ||
} | ||
|
||
@action(name = "read", args = { | ||
@arg(name = "params", type = IType.MAP, optional = false, doc = @doc("Connection parameters")), | ||
@arg(name = "table", type = IType.STRING, optional = false, doc = @doc("select string with question marks")), | ||
gamaSqlConn.setDataStore(dataStore); | ||
gamaSqlConn.close(); | ||
return true; | ||
} | ||
|
||
@action(name = "read", | ||
args = { @arg(name = "params", type = IType.MAP, optional = false, doc = @doc("Connection parameters") ), | ||
@arg(name = "table", | ||
type = IType.STRING, | ||
optional = false, | ||
doc = @doc("select string with question marks") ), | ||
@arg(name = "filter", | ||
type = IType.LIST, | ||
optional = true, | ||
doc = @doc("List of values that are used to replace question marks")) | ||
doc = @doc("List of values that are used to replace question marks") ) | ||
// ,@arg(name = "transform", type = IType.BOOL, optional = true, doc = | ||
// @doc("if transform = true then geometry will be tranformed from absolute to gis otherways it will be not transformed. Default value is false ")) | ||
|
||
}) | ||
public void read(final IScope scope) throws GamaRuntimeException { | ||
GamaSqlConnection gamaSqlConn; | ||
gamaSqlConn = new GamaSqlConnection(scope); | ||
DataStore dataStore; | ||
try { | ||
dataStore = gamaSqlConn.Connect(scope); | ||
gamaSqlConn.setDataStore(dataStore); | ||
gamaSqlConn.read(scope); | ||
} catch (Exception e) { | ||
throw GamaRuntimeException.error("GamaSqlConnection.fillBuffer; geometry could not be read"); | ||
} | ||
gamaSqlConn.close(); | ||
}) | ||
public void read(final IScope scope) throws GamaRuntimeException { | ||
GamaSqlConnection gamaSqlConn; | ||
gamaSqlConn = new GamaSqlConnection(scope); | ||
DataStore dataStore; | ||
try { | ||
dataStore = gamaSqlConn.Connect(scope); | ||
gamaSqlConn.setDataStore(dataStore); | ||
gamaSqlConn.read(scope); | ||
} catch (Exception e) { | ||
throw GamaRuntimeException.error("GamaSqlConnection.fillBuffer; geometry could not be read"); | ||
} | ||
gamaSqlConn.close(); | ||
|
||
} | ||
|
||
@action(name = "SqlObject", args = { | ||
@arg(name = "params", type = IType.MAP, optional = false, doc = @doc("Connection parameters")), | ||
@arg(name = "table", type = IType.STRING, optional = false, doc = @doc("select string with question marks")), | ||
@arg(name = "filter",type = IType.STRING,optional = true, doc = @doc("Filter for select")) | ||
}) | ||
public GamaSqlConnection SqlObject(final IScope scope) throws GamaRuntimeException { | ||
GamaSqlConnection gamaSqlConn; | ||
gamaSqlConn = new GamaSqlConnection(scope); | ||
return gamaSqlConn; | ||
@action(name = "SqlObject", | ||
args = { @arg(name = "params", type = IType.MAP, optional = false, doc = @doc("Connection parameters") ), | ||
@arg(name = "table", | ||
type = IType.STRING, | ||
optional = false, | ||
doc = @doc("select string with question marks") ), | ||
@arg(name = "filter", type = IType.STRING, optional = true, doc = @doc("Filter for select") ) }) | ||
public GamaSqlConnection SqlObject(final IScope scope) throws GamaRuntimeException { | ||
GamaSqlConnection gamaSqlConn; | ||
gamaSqlConn = new GamaSqlConnection(scope); | ||
return gamaSqlConn; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.