Package org.pentaho.di.www
Class RegisterPackageServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.pentaho.di.www.BaseHttpServlet
-
- org.pentaho.di.www.BodyHttpServlet
-
- org.pentaho.di.www.BaseJobServlet
-
- org.pentaho.di.www.RegisterPackageServlet
-
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
,CartePluginInterface
,CarteServletInterface
public class RegisterPackageServlet extends BaseJobServlet
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTEXT_PATH
static String
PARAMETER_LOAD
static String
PARAMETER_TYPE
static String
TYPE_JOB
static String
TYPE_TRANS
-
Fields inherited from class org.pentaho.di.www.BaseHttpServlet
detections, jobMap, log, socketRepository, transformationMap
-
-
Constructor Summary
Constructors Constructor Description RegisterPackageServlet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
concat(String basePath, String relativePath)
Combine the two paths with with a separator such as:basePath
+ / +relativePath
.protected void
copyAndClose(InputStream inputStream, OutputStream outputStream)
Copy contents frominputStream
over tooutputStream
and closeoutputStream
.protected String
copyRequestToDirectory(InputStream inputStream, String directory)
Copy contents ofinputStream
todirectory
.protected String
copyRequestToDirectory(javax.servlet.http.HttpServletRequest request, String directory)
Copy file specified inrequest
todirectory
.protected String
createTempDirString()
Create temporary directory with unique random folder at base.protected String
createTempDirString(String baseDirectory)
Create temporary directory with unique random folder at base.protected String
createTempDirString(String baseDirectory, String folderName)
Create temporary directory with unique random folder at base.protected void
deleteArchive(String file)
Remove file.protected String
extract(String zipFilePath)
Decompress zip file.protected void
extract(String zipFilePath, String destinationDirectory)
Decompress zip file.protected Node
getConfigNode(String archiveUrl, String fileName, String xmlTag)
Retrieve config xml,xmlTag
from combined path ofarchiveUrl
andfileName
.String
getContextPath()
protected String
getStartFileUrl(String archiveUrl, String requestLoad)
Determine the start file url for the ktr/kjb.protected static ZipService
getZipService()
protected boolean
isJob(String parameterTypeValue)
Determines ifparameterTypeValue
is kettle job.protected boolean
isJob(javax.servlet.http.HttpServletRequest request)
Determines ifrequest
is kettle job.void
setup(TransformationMap transformationMap, JobMap jobMap, SocketRepository socketRepository, List<SlaveServerDetection> detections)
protected static void
setZipService(ZipService aZipService)
protected boolean
useXML(javax.servlet.http.HttpServletRequest request)
-
Methods inherited from class org.pentaho.di.www.BaseJobServlet
createJob, createTrans
-
Methods inherited from class org.pentaho.di.www.BodyHttpServlet
beginHtml, doGet, endHtml, getService, startXml
-
Methods inherited from class org.pentaho.di.www.BaseHttpServlet
convertContextPath, doDelete, doPost, doPut, getDetections, getJobMap, getSocketRepository, getTransformationMap, isJettyMode, logBasic, logBasic, logDebug, logDetailed, logDetailed, logError, logError, logError, logMinimal, logRowlevel, setJettyMode
-
Methods inherited from class javax.servlet.http.HttpServlet
doHead, doOptions, doTrace, getLastModified, service, service
-
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pentaho.di.www.CartePluginInterface
isJettyMode, setJettyMode
-
-
-
-
Field Detail
-
CONTEXT_PATH
public static final String CONTEXT_PATH
- See Also:
- Constant Field Values
-
PARAMETER_LOAD
public static final String PARAMETER_LOAD
- See Also:
- Constant Field Values
-
PARAMETER_TYPE
public static final String PARAMETER_TYPE
- See Also:
- Constant Field Values
-
TYPE_JOB
public static final String TYPE_JOB
- See Also:
- Constant Field Values
-
TYPE_TRANS
public static final String TYPE_TRANS
- See Also:
- Constant Field Values
-
-
Method Detail
-
setup
public void setup(TransformationMap transformationMap, JobMap jobMap, SocketRepository socketRepository, List<SlaveServerDetection> detections)
- Specified by:
setup
in interfaceCartePluginInterface
- Overrides:
setup
in classBaseHttpServlet
-
getContextPath
public String getContextPath()
-
isJob
protected boolean isJob(javax.servlet.http.HttpServletRequest request)
Determines ifrequest
is kettle job.- Parameters:
request
- http request with parameters.- Returns:
- true if a job, false otherwise.
-
isJob
protected boolean isJob(String parameterTypeValue)
Determines ifparameterTypeValue
is kettle job.- Parameters:
parameterTypeValue
- http parameter type value- Returns:
-
useXML
protected boolean useXML(javax.servlet.http.HttpServletRequest request)
- Overrides:
useXML
in classBodyHttpServlet
-
getStartFileUrl
protected String getStartFileUrl(String archiveUrl, String requestLoad)
Determine the start file url for the ktr/kjb.- Parameters:
archiveUrl
-requestLoad
-- Returns:
- file path.
-
concat
protected String concat(String basePath, String relativePath)
Combine the two paths with with a separator such as:basePath
+ / +relativePath
.- Parameters:
basePath
- full path to root of directory.relativePath
- a non-absolute path.- Returns:
- combined file path.
-
getConfigNode
protected Node getConfigNode(String archiveUrl, String fileName, String xmlTag) throws org.pentaho.di.core.exception.KettleXMLException
Retrieve config xml,xmlTag
from combined path ofarchiveUrl
andfileName
.- Parameters:
archiveUrl
- root file path.fileName
- xml configuration file at root ofarchiveUrl
.xmlTag
- xml root tag.- Returns:
- configuration node.
- Throws:
org.pentaho.di.core.exception.KettleXMLException
-
createTempDirString
protected String createTempDirString()
Create temporary directory with unique random folder at base.- Returns:
- unique temporary directory path.
-
createTempDirString
protected String createTempDirString(String baseDirectory)
Create temporary directory with unique random folder at base.- Parameters:
baseDirectory
- base file path directory.- Returns:
- unique temporary directory path.
-
createTempDirString
protected String createTempDirString(String baseDirectory, String folderName)
Create temporary directory with unique random folder at base.Format :
baseDirectory
+ / +folderName
- Parameters:
baseDirectory
- base file path directory.folderName
-- Returns:
- unique temporary directory path.
-
copyRequestToDirectory
protected String copyRequestToDirectory(javax.servlet.http.HttpServletRequest request, String directory) throws org.pentaho.di.core.exception.KettleException
Copy file specified inrequest
todirectory
.- Parameters:
request
- http request with payload.directory
- local destination directory.- Returns:
- copied file path.
- Throws:
org.pentaho.di.core.exception.KettleException
-
copyRequestToDirectory
protected String copyRequestToDirectory(InputStream inputStream, String directory) throws org.pentaho.di.core.exception.KettleException
Copy contents ofinputStream
todirectory
. Expecting zip file.- Parameters:
inputStream
- zip file input stream.directory
- local destination directory.- Returns:
- copied file path.
- Throws:
org.pentaho.di.core.exception.KettleException
-
copyAndClose
protected void copyAndClose(InputStream inputStream, OutputStream outputStream) throws IOException
Copy contents frominputStream
over tooutputStream
and closeoutputStream
.- Parameters:
inputStream
-outputStream
-- Throws:
IOException
-
extract
protected String extract(String zipFilePath) throws org.pentaho.di.core.exception.KettleException
Decompress zip file.- Parameters:
zipFilePath
- zip file path.- Returns:
- returns path to new directory containing files.
- Throws:
org.pentaho.di.core.exception.KettleException
-
extract
protected void extract(String zipFilePath, String destinationDirectory) throws org.pentaho.di.core.exception.KettleException
Decompress zip file.- Parameters:
zipFilePath
- zip file.destinationDirectory
- destination directory.- Throws:
org.pentaho.di.core.exception.KettleException
-
deleteArchive
protected void deleteArchive(String file)
Remove file.- Parameters:
file
- path to file.
-
setZipService
protected static void setZipService(ZipService aZipService)
-
getZipService
protected static ZipService getZipService()
-
-