Skip to content
Permalink
Browse files

cleaned code in geoserver algs

  • Loading branch information
volaya committed Nov 5, 2012
1 parent 983535f commit d53f1238fb9cbe53f8406ec008f4ed3bf8152bf3
@@ -92,7 +92,7 @@ def saveAlgorithm(self):

if self.filename:
if not self.filename.endswith(".rsx"):
self.filename += ".rsx"
self.filename += ".rsx"
text = str(self.text.toPlainText())
if self.alg is not None:
self.alg.script = text
@@ -16,27 +16,22 @@
* *
***************************************************************************
"""
from sextante.servertools.GeoServerToolsAlgorithm import GeoServerToolsAlgorithm

__author__ = 'Victor Olaya'
__date__ = 'October 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from qgis.core import *
from PyQt4 import QtGui
from sextante.parameters.ParameterString import ParameterString
from sextante.servertools.GeoServerToolsAlgorithm import GeoServerToolsAlgorithm

class DeleteDatastore(GeoServerToolsAlgorithm):

DATASTORE = "DATASTORE"
WORKSPACE = "WORKSPACE"

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/../images/geoserver.png")

def processAlgorithm(self, progress):
self.createCatalog()
datastoreName = self.getParameterValue(self.DATASTORE)
@@ -24,18 +24,13 @@
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from qgis.core import *
from PyQt4 import QtGui
from sextante.parameters.ParameterString import ParameterString

class DeleteWorkspace(GeoServerToolsAlgorithm):

WORKSPACE = "WORKSPACE"

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/../images/geoserver.png")

def processAlgorithm(self, progress):
self.createCatalog()
workspaceName = self.getParameterValue(self.WORKSPACE)
@@ -16,28 +16,31 @@
* *
***************************************************************************
"""
from sextante.servertools.CreateWorkspace import CreateWorkspace
from sextante.servertools.ImportVectorIntoGeoServer import ImportVectorIntoGeoServer
from sextante.servertools.ImportRasterIntoGeoServer import ImportRasterIntoGeoServer
from sextante.servertools.DeleteWorkspace import DeleteWorkspace
from sextante.servertools.DeleteDatastore import DeleteDatastore

__author__ = 'Victor Olaya'
__date__ = 'October 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'


import os
from sextante.servertools.CreateWorkspace import CreateWorkspace
from sextante.servertools.ImportVectorIntoGeoServer import ImportVectorIntoGeoServer
from sextante.servertools.ImportRasterIntoGeoServer import ImportRasterIntoGeoServer
from sextante.servertools.DeleteWorkspace import DeleteWorkspace
from sextante.servertools.DeleteDatastore import DeleteDatastore
from sextante.servertools.StyleGeoServerLayer import StyleGeoServerLayer
from sextante.core.AlgorithmProvider import AlgorithmProvider
from PyQt4 import QtGui
import os

class GeoServerToolsAlgorithmProvider(AlgorithmProvider):

def __init__(self):
AlgorithmProvider.__init__(self)
self.alglist = [ImportVectorIntoGeoServer(), ImportRasterIntoGeoServer(),
CreateWorkspace(), DeleteWorkspace(), DeleteDatastore()]#, CreateMosaicGeoserver(), StyleGeoserverLayer(), TruncateSeedGWC()]
CreateWorkspace(), DeleteWorkspace(), DeleteDatastore(),
StyleGeoServerLayer()]#, TruncateSeedGWC()]

def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)
@@ -16,10 +16,6 @@
* *
***************************************************************************
"""
from sextante.core.LayerExporter import LayerExporter
from sextante.parameters.ParameterString import ParameterString
from sextante.servertools.GeoServerToolsAlgorithm import GeoServerToolsAlgorithm
from sextante.parameters.ParameterRaster import ParameterRaster

__author__ = 'Victor Olaya'
__date__ = 'October 2012'
@@ -28,18 +24,20 @@
__revision__ = '$Format:%H$'

from qgis.core import *
from sextante.parameters.ParameterString import ParameterString
from sextante.servertools.GeoServerToolsAlgorithm import GeoServerToolsAlgorithm
from sextante.parameters.ParameterRaster import ParameterRaster


class ImportRasterIntoGeoServer(GeoServerToolsAlgorithm):

INPUT = "INPUT"
WORKSPACE = "WORKSPACE"
NAME = "NAME"


def exportRasterLayer(self, inputFilename):
return inputFilename


def processAlgorithm(self, progress):
self.createCatalog()
inputFilename = self.getParameterValue(self.INPUT)
@@ -16,20 +16,20 @@
* *
***************************************************************************
"""
from sextante.core.LayerExporter import LayerExporter
from sextante.parameters.ParameterString import ParameterString
from sextante.servertools.GeoServerToolsAlgorithm import GeoServerToolsAlgorithm

__author__ = 'Victor Olaya'
__date__ = 'October 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

import os
from qgis.core import *
from sextante.parameters.ParameterVector import ParameterVector
from sextante.core.QGisLayers import QGisLayers
import os
from sextante.core.LayerExporter import LayerExporter
from sextante.parameters.ParameterString import ParameterString
from sextante.servertools.GeoServerToolsAlgorithm import GeoServerToolsAlgorithm

class ImportVectorIntoGeoServer(GeoServerToolsAlgorithm):

@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
DeleteDatastore.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'October 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from qgis.core import *
from sextante.parameters.ParameterString import ParameterString
from sextante.servertools.GeoServerToolsAlgorithm import GeoServerToolsAlgorithm
from sextante.parameters.ParameterFile import ParameterFile
from sextante.parameters.ParameterBoolean import ParameterBoolean


class StyleGeoServerLayer(GeoServerToolsAlgorithm):

STYLE = "STYLE"
OVERWRITE = "OVERWRITE"
NAME = "NAME"

def processAlgorithm(self, progress):
self.createCatalog()
stylefile = self.getParameterValue(self.STYLE)
overwrite = self.getParameterValue(self.OVERWRITE)
name = self.getParameterValue(self.NAME)
self.catalog.create_style(name, stylefile, overwrite)


def defineCharacteristics(self):
self.addBaseParameters()
self.name = "Add style"
self.group = "GeoServer management tools"
self.addParameter(ParameterString(self.NAME, "Style name"))
self.addParameter(ParameterFile(self.STYLE, "Style SLD file"))
self.addParameter(ParameterBoolean(self.OVERWRITE, "Overwrite"))



0 comments on commit d53f123

Please sign in to comment.
You can’t perform that action at this time.