Package org.pentaho.di.shared
Class SharedObjects
- java.lang.Object
-
- org.pentaho.di.shared.SharedObjects
-
public class SharedObjects extends Object
Based on a piece of XML, this factory will give back a list of objects. In other words, it does XML de-serialisation- Author:
- Matt
-
-
Constructor Summary
Constructors Constructor Description SharedObjects()
SharedObjects(String sharedObjectsFile)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
createFilename(String sharedObjectsFile)
String
getFilename()
Map<org.pentaho.di.shared.SharedObjects.SharedEntry,org.pentaho.di.shared.SharedObjectInterface>
getObjectsMap()
org.pentaho.di.core.database.DatabaseMeta
getSharedDatabase(String name)
Get the shared database with the specified nameorg.pentaho.di.shared.SharedObjectInterface
getSharedObject(Class<org.pentaho.di.shared.SharedObjectInterface> clazz, String objectName)
Return the shared object with the given class and nameorg.pentaho.di.shared.SharedObjectInterface
getSharedObject(String className, String objectName)
Return the shared object with the given class name and object nameprotected OutputStream
initOutputStreamUsingKettleVFS(org.apache.commons.vfs2.FileObject fileObject)
void
removeObject(org.pentaho.di.shared.SharedObjectInterface sharedObject)
Remove the sharedObject from the object map.protected void
restoreFileFromBackup(String backupFileName)
CallcopyFile(String, String)
method to restore file from backupvoid
saveToFile()
void
setFilename(String filename)
void
setObjectsMap(Map<org.pentaho.di.shared.SharedObjects.SharedEntry,org.pentaho.di.shared.SharedObjectInterface> objects)
void
storeObject(org.pentaho.di.shared.SharedObjectInterface sharedObject)
Store the sharedObject in the object map.String
toString()
protected void
writeToFile(org.apache.commons.vfs2.FileObject fileObject, String backupFileName)
Write sharedObjects to file.
-
-
-
Constructor Detail
-
SharedObjects
public SharedObjects(String sharedObjectsFile) throws org.pentaho.di.core.exception.KettleXMLException
- Throws:
org.pentaho.di.core.exception.KettleXMLException
-
SharedObjects
public SharedObjects() throws org.pentaho.di.core.exception.KettleXMLException
- Throws:
org.pentaho.di.core.exception.KettleXMLException
-
-
Method Detail
-
getObjectsMap
public Map<org.pentaho.di.shared.SharedObjects.SharedEntry,org.pentaho.di.shared.SharedObjectInterface> getObjectsMap()
-
setObjectsMap
public void setObjectsMap(Map<org.pentaho.di.shared.SharedObjects.SharedEntry,org.pentaho.di.shared.SharedObjectInterface> objects)
-
storeObject
public void storeObject(org.pentaho.di.shared.SharedObjectInterface sharedObject)
Store the sharedObject in the object map. It is possible to have 2 different types of shared object with the same name. They will be stored separately.- Parameters:
sharedObject
-
-
removeObject
public void removeObject(org.pentaho.di.shared.SharedObjectInterface sharedObject)
Remove the sharedObject from the object map.- Parameters:
sharedObject
-
-
saveToFile
public void saveToFile() throws IOException, org.pentaho.di.core.exception.KettleException
- Throws:
IOException
org.pentaho.di.core.exception.KettleException
-
getSharedObject
public org.pentaho.di.shared.SharedObjectInterface getSharedObject(Class<org.pentaho.di.shared.SharedObjectInterface> clazz, String objectName)
Return the shared object with the given class and name- Parameters:
clazz
- The class of the shared objectobjectName
- the name of the object- Returns:
- The shared object or null if none was found.
-
getSharedObject
public org.pentaho.di.shared.SharedObjectInterface getSharedObject(String className, String objectName)
Return the shared object with the given class name and object name- Parameters:
className
- The class name of the shared objectobjectName
- the name of the object- Returns:
- The shared object or null if none was found.
-
getSharedDatabase
public org.pentaho.di.core.database.DatabaseMeta getSharedDatabase(String name)
Get the shared database with the specified name- Parameters:
name
- The name of the shared database- Returns:
- The database or null if nothing was found.
-
getFilename
public String getFilename()
- Returns:
- the filename
-
setFilename
public void setFilename(String filename)
- Parameters:
filename
- the filename to set
-
writeToFile
protected void writeToFile(org.apache.commons.vfs2.FileObject fileObject, String backupFileName) throws IOException, org.pentaho.di.core.exception.KettleException
Write sharedObjects to file. In case of an exception are caught save backup file instead of new one.- Parameters:
fileObject
- is file for writingbackupFileName
- is backup file name- Throws:
IOException
org.pentaho.di.core.exception.KettleException
-
initOutputStreamUsingKettleVFS
protected OutputStream initOutputStreamUsingKettleVFS(org.apache.commons.vfs2.FileObject fileObject) throws IOException
- Throws:
IOException
-
restoreFileFromBackup
protected void restoreFileFromBackup(String backupFileName) throws IOException, org.pentaho.di.core.exception.KettleFileException
CallcopyFile(String, String)
method to restore file from backup- Parameters:
backupFileName
-- Throws:
IOException
org.pentaho.di.core.exception.KettleFileException
-
-