本文整理匯總了Java中org.pentaho.di.core.xml.XMLHandler.getXMLHeader方法的典型用法代碼示例。如果您正苦於以下問題:Java XMLHandler.getXMLHeader方法的具體用法?Java XMLHandler.getXMLHeader怎麽用?Java XMLHandler.getXMLHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.pentaho.di.core.xml.XMLHandler
的用法示例。
在下文中一共展示了XMLHandler.getXMLHeader方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: copyJobEntries
import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public void copyJobEntries(JobMeta jobMeta, JobEntryCopy jec[])
{
if (jec == null || jec.length == 0)
return;
String xml = XMLHandler.getXMLHeader();
xml += XMLHandler.openTag(Spoon.XML_TAG_JOB_JOB_ENTRIES) + Const.CR; //$NON-NLS-1$
for (int i = 0; i < jec.length; i++)
{
if (jec[i]==null)
continue;
xml += jec[i].getXML();
}
xml += " " + XMLHandler.closeTag(Spoon.XML_TAG_JOB_JOB_ENTRIES) + Const.CR; //$NON-NLS-1$
spoon.toClipboard(xml);
}
示例2: copyJobEntries
import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public void copyJobEntries(JobMeta jobMeta, List<JobEntryCopy> jec)
{
if (jec == null || jec.size() == 0)
return;
String xml = XMLHandler.getXMLHeader();
xml += XMLHandler.openTag(Spoon.XML_TAG_JOB_JOB_ENTRIES) + Const.CR;
for (int i = 0; i < jec.size(); i++)
{
xml += jec.get(i).getXML();
}
xml += " " + XMLHandler.closeTag(Spoon.XML_TAG_JOB_JOB_ENTRIES) + Const.CR; //$NON-NLS-1$
spoon.toClipboard(xml);
}
示例3: saveTrans
import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
@Override
public void saveTrans(TransMeta transMeta, String name, String directoryPath, Repository repository, IMetaStore metaStore, VariableSpace variableSpace) throws KettleException {
String xml = XMLHandler.getXMLHeader() + transMeta.getXML();
DataOutputStream dos = new DataOutputStream(KettleVFS.getOutputStream(name, false));
try {
dos.write(xml.getBytes(Const.XML_ENCODING));
dos.close();
} catch (IOException e) {
throw new KettleException(e);
}
}
示例4: saveMeta
import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public boolean saveMeta(EngineMetaInterface meta, String fname) {
meta.setFilename(fname);
if (Const.isEmpty(meta.getName()) || delegates.jobs.isDefaultJobName(meta.getName())) {
meta.nameFromFilename();
}
boolean saved = false;
try {
String xml = XMLHandler.getXMLHeader() + meta.getXML();
DataOutputStream dos = new DataOutputStream(KettleVFS.getOutputStream(fname, false));
dos.write(xml.getBytes(Const.XML_ENCODING));
dos.close();
saved = true;
// Handle last opened files...
props.addLastFile(meta.getFileType(), fname, null, false, null); //$NON-NLS-1$
saveSettings();
addMenuLast();
if (log.isDebug())
log.logDebug(toString(), Messages.getString("Spoon.Log.FileWritten") + " [" + fname + "]"); // "File
// written
// to
meta.setFilename(fname);
meta.clearChanged();
setShellText();
} catch (Exception e) {
if (log.isDebug())
log.logDebug(toString(), Messages.getString("Spoon.Log.ErrorOpeningFileForWriting") + e.toString());// "Error opening file for writing! --> "
new ErrorDialog(shell, Messages.getString("Spoon.Dialog.ErrorSavingFile.Title"), Messages.getString("Spoon.Dialog.ErrorSavingFile.Message") + Const.CR + e.toString(), e);
}
return saved;
}
示例5: saveMeta
import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public boolean saveMeta(EngineMetaInterface meta, String fname) {
meta.setFilename(fname);
if (Const.isEmpty(meta.getName()) || delegates.jobs.isDefaultJobName(meta.getName()) || delegates.trans.isDefaultTransformationName(meta.getName())) {
meta.nameFromFilename();
}
boolean saved = false;
try {
String xml = XMLHandler.getXMLHeader() + meta.getXML();
DataOutputStream dos = new DataOutputStream(KettleVFS.getOutputStream(fname, false));
dos.write(xml.getBytes(Const.XML_ENCODING));
dos.close();
saved = true;
// Handle last opened files...
props.addLastFile(meta.getFileType(), fname, null, false, null); //$NON-NLS-1$
saveSettings();
addMenuLast();
if (log.isDebug())
log.logDebug(BaseMessages.getString(PKG, "Spoon.Log.FileWritten") + " [" + fname + "]"); // "File
// written
// to
meta.setFilename(fname);
meta.clearChanged();
setShellText();
} catch (Exception e) {
if (log.isDebug())
log.logDebug(BaseMessages.getString(PKG, "Spoon.Log.ErrorOpeningFileForWriting") + e.toString());// "Error opening file for writing! --> "
new ErrorDialog(shell, BaseMessages.getString(PKG, "Spoon.Dialog.ErrorSavingFile.Title"), BaseMessages.getString(
PKG, "Spoon.Dialog.ErrorSavingFile.Message")
+ Const.CR + e.toString(), e);
}
return saved;
}
示例6: generateJarFile
import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public static final void generateJarFile(TransMeta transMeta)
{
KettleDependencies deps = new KettleDependencies(transMeta);
File kar = new File("kar");
if (kar.exists())
{
log.logBasic("Jar generator", "Removing directory: "+kar.getPath());
deleteDirectory(kar);
}
kar.mkdir();
String filename = "kettle-engine-3.0.jar";
if (!Const.isEmpty(transMeta.getFilename()))
{
filename = Const.replace(transMeta.getFilename(), " ", "_").toLowerCase()+".kar";
}
File karFile = new File(filename);
try
{
// The manifest file
String strManifest = "";
strManifest += "Manifest-Version: 1.0"+Const.CR;
strManifest += "Created-By: Kettle version "+Const.VERSION+Const.CR;
strManifest += Attributes.Name.MAIN_CLASS.toString()+": " + (JarPan.class.getName()) + Const.CR;
// Create a new manifest file in the root.
File manifestFile = new File(kar.getPath()+"/"+"manifest.mf");
FileOutputStream fos = new FileOutputStream(manifestFile);
fos.write(strManifest.getBytes());
fos.close();
log.logBasic("Jar generator", "Wrote manifest file: "+manifestFile.getPath());
// The transformation, also in the kar directory...
String strTrans = XMLHandler.getXMLHeader(Const.XML_ENCODING) + transMeta.getXML();
File transFile = new File(kar.getPath()+"/"+TRANSFORMATION_FILENAME);
fos = new FileOutputStream(transFile);
fos.write(strTrans.getBytes(Const.XML_ENCODING));
fos.close();
log.logBasic("Jar generator", "Wrote transformation file: "+transFile.getPath());
// Execute the jar command...
executeJarCommand
(
kar,
karFile,
new File("manifest.mf"),
new File(TRANSFORMATION_FILENAME),
deps.getLibraryFiles()
);
}
catch (Exception e)
{
log.logError(JarfileGenerator.class.getName(), "Error zipping files into archive [" + karFile.getPath() + "] : " + e.toString());
log.logError(JarfileGenerator.class.getName(), Const.getStackTracker(e));
}
}
示例7: clipConnection
import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public void clipConnection(DatabaseMeta databaseMeta)
{
String xml = XMLHandler.getXMLHeader() + databaseMeta.getXML();
GUIResource.getInstance().toClipboard(xml);
}
示例8: copySelected
import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public void copySelected(TransMeta transMeta, StepMeta stepMeta[], NotePadMeta notePadMeta[]) {
if (stepMeta == null || stepMeta.length == 0)
return;
String xml = XMLHandler.getXMLHeader();
try {
xml += XMLHandler.openTag(Spoon.XML_TAG_TRANSFORMATION_STEPS) + Const.CR;
xml += " <steps>" + Const.CR;
for (int i = 0; i < stepMeta.length; i++) {
xml += stepMeta[i].getXML();
}
xml += " </steps>" + Const.CR;
//
// Also check for the hops in between the selected steps...
//
xml += "<order>" + Const.CR;
if (stepMeta != null)
for (int i = 0; i < stepMeta.length; i++) {
for (int j = 0; j < stepMeta.length; j++) {
if (i != j) {
TransHopMeta hop = transMeta.findTransHop(stepMeta[i], stepMeta[j], true);
if (hop != null) // Ok, we found one...
{
xml += hop.getXML() + Const.CR;
}
}
}
}
xml += " </order>" + Const.CR;
xml += " <notepads>" + Const.CR;
if (notePadMeta != null)
for (int i = 0; i < notePadMeta.length; i++) {
xml += notePadMeta[i].getXML();
}
xml += " </notepads>" + Const.CR;
xml += " " + XMLHandler.closeTag(Spoon.XML_TAG_TRANSFORMATION_STEPS) + Const.CR;
toClipboard(xml);
} catch (Exception ex) {
new ErrorDialog(getShell(), "Error", "Error encoding to XML", ex);
}
}
示例9: generateJarFile
import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public static final void generateJarFile(TransMeta transMeta)
{
log = new LogChannel("Jar file generator");
KettleDependencies deps = new KettleDependencies(transMeta);
File kar = new File("kar");
if (kar.exists())
{
log.logBasic("Jar generator", "Removing directory: "+kar.getPath());
deleteDirectory(kar);
}
kar.mkdir();
String filename = "kettle-engine-3.0.jar";
if (!Const.isEmpty(transMeta.getFilename()))
{
filename = Const.replace(transMeta.getFilename(), " ", "_").toLowerCase()+".kar";
}
File karFile = new File(filename);
try
{
// The manifest file
String strManifest = "";
strManifest += "Manifest-Version: 1.0"+Const.CR;
strManifest += "Created-By: Kettle version "+Const.VERSION+Const.CR;
strManifest += Attributes.Name.MAIN_CLASS.toString()+": " + (JarPan.class.getName()) + Const.CR;
// Create a new manifest file in the root.
File manifestFile = new File(kar.getPath()+"/"+"manifest.mf");
FileOutputStream fos = new FileOutputStream(manifestFile);
fos.write(strManifest.getBytes());
fos.close();
log.logBasic("Jar generator", "Wrote manifest file: "+manifestFile.getPath());
// The transformation, also in the kar directory...
String strTrans = XMLHandler.getXMLHeader(Const.XML_ENCODING) + transMeta.getXML();
File transFile = new File(kar.getPath()+"/"+TRANSFORMATION_FILENAME);
fos = new FileOutputStream(transFile);
fos.write(strTrans.getBytes(Const.XML_ENCODING));
fos.close();
log.logBasic("Jar generator", "Wrote transformation file: "+transFile.getPath());
// Execute the jar command...
executeJarCommand
(
kar,
karFile,
new File("manifest.mf"),
new File(TRANSFORMATION_FILENAME),
deps.getLibraryFiles()
);
}
catch (Exception e)
{
log.logError(JarfileGenerator.class.getName(), "Error zipping files into archive [" + karFile.getPath() + "] : " + e.toString());
log.logError(JarfileGenerator.class.getName(), Const.getStackTracker(e));
}
}
示例10: copySelected
import org.pentaho.di.core.xml.XMLHandler; //導入方法依賴的package包/類
public void copySelected(TransMeta transMeta, List<StepMeta> steps, List<NotePadMeta> notes) {
if (steps == null || steps.size() == 0)
return;
String xml = XMLHandler.getXMLHeader();
try {
xml += XMLHandler.openTag(Spoon.XML_TAG_TRANSFORMATION_STEPS) + Const.CR;
xml += " <steps>" + Const.CR;
for (int i = 0; i < steps.size(); i++) {
xml += steps.get(i).getXML();
}
xml += " </steps>" + Const.CR;
//
// Also check for the hops in between the selected steps...
//
xml += "<order>" + Const.CR;
if (steps != null)
for (int i = 0; i < steps.size(); i++) {
for (int j = 0; j < steps.size(); j++) {
if (i != j) {
TransHopMeta hop = transMeta.findTransHop(steps.get(i), steps.get(j), true);
if (hop != null) // Ok, we found one...
{
xml += hop.getXML() + Const.CR;
}
}
}
}
xml += " </order>" + Const.CR;
xml += " <notepads>" + Const.CR;
if (notes != null)
for (int i = 0; i < notes.size(); i++) {
xml += notes.get(i).getXML();
}
xml += " </notepads>" + Const.CR;
xml += " " + XMLHandler.closeTag(Spoon.XML_TAG_TRANSFORMATION_STEPS) + Const.CR;
toClipboard(xml);
} catch (Exception ex) {
new ErrorDialog(getShell(), "Error", "Error encoding to XML", ex);
}
}