/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package de.bitocean.mm;
import de.bitocean.mm.sniplibtool.SnipLibConnector;
import de.bitocean.mm.sniplibtool.Snippet;
import de.bitocean.mm.sniplibtool.SnippetConsumer;
import visualtools.connectors.CMConnectorImpl;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.Properties;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rtextarea.RTextScrollPane;
import visualtools.connectors.ClusterGateway;
import visualtools.connectors.FlumeTool;
import visualtools.connectors.SOLRTool;
import static visualtools.connectors.SOLRTool.projectContext;
/**
*
* @author kamir
*/
public class MorphMinerTool extends javax.swing.JFrame
implements SnippetConsumer {
CMConnectorImpl cmcon = new CMConnectorImpl();
/**
* Creates new form SemanticFigureEditor
*/
public MorphMinerTool() throws IOException {
String ML_Folder = "./morphline-projects";
initComponents();
initModel(".", new LocalMorphlineStore(ML_Folder));
initEditor();
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
this.setSize(d);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jPanel6 = new javax.swing.JPanel();
manageTabs = new javax.swing.JTabbedPane();
projectLocation = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jtEBF = new javax.swing.JTextField();
jButton13 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jtEIF = new javax.swing.JTextField();
jButton5 = new javax.swing.JButton();
jButton12 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jPanel16 = new javax.swing.JPanel();
jtfGW = new javax.swing.JTextField();
jtfU = new javax.swing.JTextField();
jtfPW = new javax.swing.JTextField();
jButton20 = new javax.swing.JButton();
jLabel12 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
dataflowDescriptors = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jPanel3 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jaL = new javax.swing.JTextArea();
jPanel18 = new javax.swing.JPanel();
jPanel17 = new javax.swing.JPanel();
jButton23 = new javax.swing.JButton();
jScrollPane4 = new javax.swing.JScrollPane();
jTextPane1 = new javax.swing.JTextPane();
jPanel19 = new javax.swing.JPanel();
jPanel14 = new javax.swing.JPanel();
editorTabs = new javax.swing.JTabbedPane();
jpImage2 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jPanel9 = new javax.swing.JPanel();
jButton15 = new javax.swing.JButton();
jButton16 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton14 = new javax.swing.JButton();
jPanel4 = new javax.swing.JPanel();
jrbLoadLines = new javax.swing.JRadioButton();
jrbLoadFile = new javax.swing.JRadioButton();
jLabel7 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
latexEditorPane = new javax.swing.JPanel();
jPanel11 = new javax.swing.JPanel();
jButton3 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jButton10 = new javax.swing.JButton();
jButton11 = new javax.swing.JButton();
ttlEditorPane = new javax.swing.JPanel();
jPanel12 = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
jtfZK = new javax.swing.JTextField();
jButton24 = new javax.swing.JButton();
jLabel10 = new javax.swing.JLabel();
jtfCollection = new javax.swing.JTextField();
jButton9 = new javax.swing.JButton();
jButton17 = new javax.swing.JButton();
jButton19 = new javax.swing.JButton();
flumeEditorPane = new javax.swing.JPanel();
jPanel13 = new javax.swing.JPanel();
jLabel13 = new javax.swing.JLabel();
jtfFlumeCFGFileName = new javax.swing.JTextField();
jButton22 = new javax.swing.JButton();
jLabel14 = new javax.swing.JLabel();
jtfAgent = new javax.swing.JTextField();
jLabel16 = new javax.swing.JLabel();
jtfFlumeGW = new javax.swing.JTextField();
jButton18 = new javax.swing.JButton();
jLabel15 = new javax.swing.JLabel();
jlPID = new javax.swing.JLabel();
jButton21 = new javax.swing.JButton();
jPanel15 = new javax.swing.JPanel();
jpImage3 = new javax.swing.JPanel();
Morphes = new javax.swing.JPanel();
jTabbedPane2 = new javax.swing.JTabbedPane();
jPanel7 = new javax.swing.JPanel();
jPanel8 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jaI = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("MorphMiner ");
manageTabs.setBackground(new java.awt.Color(255, 255, 255));
manageTabs.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
manageTabs.setPreferredSize(new java.awt.Dimension(1200, 600));
projectLocation.setBackground(new java.awt.Color(255, 255, 255));
projectLocation.setBorder(javax.swing.BorderFactory.createTitledBorder("Project Location"));
projectLocation.setRequestFocusEnabled(false);
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel1.setText("Base folder :");
jtEBF.setText("./morphline-projects");
jtEBF.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtEBFActionPerformed(evt);
}
});
jButton13.setText("open in Finder");
jButton13.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton13ActionPerformed(evt);
}
});
jLabel2.setText("Project Folder :");
jtEIF.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtEIFActionPerformed(evt);
}
});
jButton5.setText("open");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jButton12.setText("new");
jButton12.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton12ActionPerformed(evt);
}
});
jButton6.setText("reload");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});
jButton4.setText("save");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
javax.swing.GroupLayout projectLocationLayout = new javax.swing.GroupLayout(projectLocation);
projectLocation.setLayout(projectLocationLayout);
projectLocationLayout.setHorizontalGroup(
projectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(projectLocationLayout.createSequentialGroup()
.addContainerGap()
.addGroup(projectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(33, 33, 33)
.addGroup(projectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(projectLocationLayout.createSequentialGroup()
.addComponent(jButton12, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(30, 30, 30)
.addComponent(jButton13, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jtEIF)
.addComponent(jtEBF))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
projectLocationLayout.setVerticalGroup(
projectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(projectLocationLayout.createSequentialGroup()
.addContainerGap()
.addGroup(projectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jtEBF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(projectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jtEIF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(projectLocationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton5)
.addComponent(jButton12)
.addComponent(jButton6)
.addComponent(jButton4)
.addComponent(jButton13))
.addContainerGap(421, Short.MAX_VALUE))
);
manageTabs.addTab("Project", projectLocation);
jtfGW.setText("127.0.0.1");
jtfU.setText("cloudera");
jtfPW.setText("cloudera");
jtfPW.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtfPWActionPerformed(evt);
}
});
jButton20.setText("test connection");
jButton20.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton20ActionPerformed(evt);
}
});
jLabel12.setText("Password :");
jLabel11.setText("User :");
jLabel9.setText("Gateway Node :");
javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
jPanel16.setLayout(jPanel16Layout);
jPanel16Layout.setHorizontalGroup(
jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel16Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton20)
.addGroup(jPanel16Layout.createSequentialGroup()
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel12)
.addComponent(jLabel11)
.addComponent(jLabel9))
.addGap(33, 33, 33)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jtfPW, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jtfU, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jtfGW, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel16Layout.setVerticalGroup(
jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel16Layout.createSequentialGroup()
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(jtfGW, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel16Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jLabel11))
.addGroup(jPanel16Layout.createSequentialGroup()
.addComponent(jtfU, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtfPW, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12))))
.addGap(12, 12, 12)
.addComponent(jButton20)
.addGap(0, 411, Short.MAX_VALUE))
);
manageTabs.addTab("Cluster Gateway", jPanel16);
dataflowDescriptors.setBackground(new java.awt.Color(255, 255, 255));
dataflowDescriptors.setBorder(javax.swing.BorderFactory.createTitledBorder("Data Flow Descriptors"));
jLabel3.setText("Solr-Schema :");
jTextField3.setText("./config/schema.xml");
jTextField3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3ActionPerformed(evt);
}
});
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel5.setText("Flume Configuration :");
jTextField2.setText("./flume.conf");
jTextField2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField2ActionPerformed(evt);
}
});
javax.swing.GroupLayout dataflowDescriptorsLayout = new javax.swing.GroupLayout(dataflowDescriptors);
dataflowDescriptors.setLayout(dataflowDescriptorsLayout);
dataflowDescriptorsLayout.setHorizontalGroup(
dataflowDescriptorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(dataflowDescriptorsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(dataflowDescriptorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGap(18, 18, 18)
.addGroup(dataflowDescriptorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 301, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 301, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
dataflowDescriptorsLayout.setVerticalGroup(
dataflowDescriptorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(dataflowDescriptorsLayout.createSequentialGroup()
.addGroup(dataflowDescriptorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(dataflowDescriptorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 454, Short.MAX_VALUE))
);
manageTabs.addTab("Data Flow", dataflowDescriptors);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Log"));
jPanel3.setLayout(new java.awt.BorderLayout());
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
jaL.setBackground(new java.awt.Color(0, 0, 0));
jaL.setColumns(20);
jaL.setFont(new java.awt.Font("Zapf Dingbats", 0, 12)); // NOI18N
jaL.setForeground(new java.awt.Color(204, 255, 204));
jaL.setLineWrap(true);
jaL.setRows(5);
jaL.setToolTipText("Entry is shown in the list of figures.");
jaL.setWrapStyleWord(true);
jaL.setCaretColor(new java.awt.Color(255, 255, 102));
jaL.setSelectedTextColor(new java.awt.Color(204, 204, 255));
jaL.setSelectionColor(new java.awt.Color(153, 153, 153));
jScrollPane1.setViewportView(jaL);
jPanel3.add(jScrollPane1, java.awt.BorderLayout.CENTER);
manageTabs.addTab("Log", jPanel3);
jPanel18.setLayout(new java.awt.BorderLayout());
jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder("Snip Lib Tool"));
jButton23.setText("select snippet");
jButton23.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton23ActionPerformed(evt);
}
});
jTextPane1.setBackground(new java.awt.Color(0, 153, 153));
jTextPane1.setFont(new java.awt.Font("Lucida Grande", 0, 14)); // NOI18N
jTextPane1.setForeground(new java.awt.Color(255, 153, 0));
jScrollPane4.setViewportView(jTextPane1);
javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17);
jPanel17.setLayout(jPanel17Layout);
jPanel17Layout.setHorizontalGroup(
jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel17Layout.createSequentialGroup()
.addComponent(jButton23)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 1023, Short.MAX_VALUE)
.addContainerGap())
);
jPanel17Layout.setVerticalGroup(
jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel17Layout.createSequentialGroup()
.addComponent(jButton23)
.addGap(0, 501, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel17Layout.createSequentialGroup()
.addComponent(jScrollPane4)
.addContainerGap())
);
jPanel18.add(jPanel17, java.awt.BorderLayout.CENTER);
manageTabs.addTab("Snippets", jPanel18);
jPanel19.setLayout(new java.awt.BorderLayout());
jPanel14.setLayout(new java.awt.BorderLayout());
editorTabs.setTabPlacement(javax.swing.JTabbedPane.LEFT);
editorTabs.setMaximumSize(new java.awt.Dimension(480, 246));
editorTabs.setMinimumSize(new java.awt.Dimension(480, 246));
jpImage2.setBackground(new java.awt.Color(255, 255, 255));
jpImage2.setLayout(new java.awt.BorderLayout());
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Messages"
}
));
jScrollPane3.setViewportView(jTable1);
jpImage2.add(jScrollPane3, java.awt.BorderLayout.CENTER);
jPanel9.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
jButton15.setText("clear");
jButton15.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton15ActionPerformed(evt);
}
});
jPanel9.add(jButton15);
jButton16.setText("add record");
jButton16.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton16ActionPerformed(evt);
}
});
jPanel9.add(jButton16);
jButton2.setText("simple (s p o d) lines");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jPanel9.add(jButton2);
jButton14.setText("load test data");
jButton14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton14ActionPerformed(evt);
}
});
jPanel9.add(jButton14);
jpImage2.add(jPanel9, java.awt.BorderLayout.SOUTH);
jPanel4.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
buttonGroup1.add(jrbLoadLines);
jrbLoadLines.setSelected(true);
jrbLoadLines.setText("load lines from file");
jPanel4.add(jrbLoadLines);
buttonGroup1.add(jrbLoadFile);
jrbLoadFile.setText("load full file");
jPanel4.add(jrbLoadFile);
jLabel7.setText(" ");
jPanel4.add(jLabel7);
jButton1.setText("select File");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel4.add(jButton1);
jLabel4.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
jLabel4.setText(" selected file : ");
jPanel4.add(jLabel4);
jLabel6.setBackground(new java.awt.Color(204, 255, 204));
jLabel6.setForeground(new java.awt.Color(0, 153, 153));
jLabel6.setText("...");
jLabel6.setMaximumSize(new java.awt.Dimension(300, 16));
jLabel6.setMinimumSize(new java.awt.Dimension(300, 16));
jPanel4.add(jLabel6);
jpImage2.add(jPanel4, java.awt.BorderLayout.PAGE_START);
editorTabs.addTab("Dataset", jpImage2);
jPanel5.setLayout(new java.awt.BorderLayout());
latexEditorPane.setBackground(new java.awt.Color(255, 255, 255));
latexEditorPane.setBounds(new java.awt.Rectangle(0, 0, 100, 100));
latexEditorPane.setMaximumSize(new java.awt.Dimension(600, 400));
latexEditorPane.setMinimumSize(new java.awt.Dimension(600, 400));
latexEditorPane.setLayout(new java.awt.BorderLayout());
jPanel11.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
jButton3.setText("replace editor content with template");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jPanel11.add(jButton3);
jButton7.setText("edit selection");
jButton7.setEnabled(false);
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});
jPanel11.add(jButton7);
jButton8.setText("update selection");
jButton8.setEnabled(false);
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});
jPanel11.add(jButton8);
latexEditorPane.add(jPanel11, java.awt.BorderLayout.PAGE_START);
jPanel5.add(latexEditorPane, java.awt.BorderLayout.CENTER);
jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
jButton10.setText("validate HOCON format");
jButton10.setEnabled(false);
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
}
});
jPanel1.add(jButton10);
jButton11.setText("test full morphline");
jButton11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton11ActionPerformed(evt);
}
});
jPanel1.add(jButton11);
jPanel5.add(jPanel1, java.awt.BorderLayout.SOUTH);
editorTabs.addTab("Morphline", jPanel5);
ttlEditorPane.setBackground(new java.awt.Color(255, 255, 255));
ttlEditorPane.setMaximumSize(new java.awt.Dimension(600, 200));
ttlEditorPane.setMinimumSize(new java.awt.Dimension(600, 200));
ttlEditorPane.setLayout(new java.awt.BorderLayout());
jLabel8.setText("ZK : ");
jPanel12.add(jLabel8);
jtfZK.setBackground(new java.awt.Color(255, 255, 204));
jtfZK.setText("127.0.0.1:2181/solr");
jtfZK.setPreferredSize(new java.awt.Dimension(292, 28));
jPanel12.add(jtfZK);
jButton24.setText("list instancedir");
jButton24.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton24ActionPerformed(evt);
}
});
jPanel12.add(jButton24);
jLabel10.setText("Collection:");
jPanel12.add(jLabel10);
jtfCollection.setPreferredSize(new java.awt.Dimension(217, 28));
jtfCollection.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtfCollectionActionPerformed(evt);
}
});
jPanel12.add(jtfCollection);
jButton9.setText("create instancedir");
jButton9.setToolTipText("The instancedir and the collection are created on the cluster with a default configuration.");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});
jPanel12.add(jButton9);
jButton17.setText("update config");
jButton17.setToolTipText("Local changes are published to cluster. This overwrites the configuration files on the gateway and in zookeeper. The collection will be reloaded by SOLR.");
jButton17.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton17ActionPerformed(evt);
}
});
jPanel12.add(jButton17);
jButton19.setText("publish new config to cluster");
jButton19.setEnabled(false);
jButton19.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton19ActionPerformed(evt);
}
});
jPanel12.add(jButton19);
ttlEditorPane.add(jPanel12, java.awt.BorderLayout.PAGE_START);
editorTabs.addTab("SOLR schema", ttlEditorPane);
flumeEditorPane.setLayout(new java.awt.BorderLayout());
jPanel13.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
jLabel13.setText("flume configuration : ");
jPanel13.add(jLabel13);
jtfFlumeCFGFileName.setText(" ");
jtfFlumeCFGFileName.setMinimumSize(new java.awt.Dimension(349, 28));
jtfFlumeCFGFileName.setPreferredSize(new java.awt.Dimension(448, 28));
jtfFlumeCFGFileName.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtfFlumeCFGFileNameActionPerformed(evt);
}
});
jPanel13.add(jtfFlumeCFGFileName);
jButton22.setText("show graph");
jButton22.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton22ActionPerformed(evt);
}
});
jPanel13.add(jButton22);
jLabel14.setText("agent:");
jPanel13.add(jLabel14);
jtfAgent.setMinimumSize(new java.awt.Dimension(84, 28));
jtfAgent.setPreferredSize(new java.awt.Dimension(84, 28));
jPanel13.add(jtfAgent);
jLabel16.setText("gateway:");
jPanel13.add(jLabel16);
jtfFlumeGW.setPreferredSize(new java.awt.Dimension(124, 28));
jtfFlumeGW.setSize(new java.awt.Dimension(124, 28));
jPanel13.add(jtfFlumeGW);
jButton18.setText("start flume agent");
jButton18.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton18ActionPerformed(evt);
}
});
jPanel13.add(jButton18);
jLabel15.setText("PID:");
jPanel13.add(jLabel15);
jlPID.setText("...");
jlPID.setPreferredSize(new java.awt.Dimension(82, 16));
jlPID.setSize(new java.awt.Dimension(83, 16));
jPanel13.add(jlPID);
jButton21.setText("stop flume agent");
jButton21.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton21ActionPerformed(evt);
}
});
jPanel13.add(jButton21);
flumeEditorPane.add(jPanel13, java.awt.BorderLayout.NORTH);
jPanel15.setLayout(new java.awt.BorderLayout());
flumeEditorPane.add(jPanel15, java.awt.BorderLayout.CENTER);
editorTabs.addTab("Flume-Configuration", flumeEditorPane);
javax.swing.GroupLayout jpImage3Layout = new javax.swing.GroupLayout(jpImage3);
jpImage3.setLayout(jpImage3Layout);
jpImage3Layout.setHorizontalGroup(
jpImage3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jpImage3Layout.setVerticalGroup(
jpImage3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 533, Short.MAX_VALUE)
);
editorTabs.addTab("Avro-Schema (*.avsc)", jpImage3);
Morphes.setBorder(javax.swing.BorderFactory.createTitledBorder("Morphes"));
Morphes.setEnabled(false);
Morphes.setLayout(new java.awt.BorderLayout());
jTabbedPane2.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
jPanel7.setLayout(new java.awt.BorderLayout());
jPanel8.setLayout(new java.awt.BorderLayout());
jaI.setColumns(20);
jaI.setLineWrap(true);
jaI.setRows(5);
jaI.setWrapStyleWord(true);
jScrollPane2.setViewportView(jaI);
jPanel8.add(jScrollPane2, java.awt.BorderLayout.CENTER);
jPanel7.add(jPanel8, java.awt.BorderLayout.CENTER);
jTabbedPane2.addTab("step by step", jPanel7);
Morphes.add(jTabbedPane2, java.awt.BorderLayout.CENTER);
editorTabs.addTab("Snippets", Morphes);
jPanel14.add(editorTabs, java.awt.BorderLayout.CENTER);
jPanel19.add(jPanel14, java.awt.BorderLayout.CENTER);
manageTabs.addTab("Editors", jPanel19);
jPanel6.add(manageTabs);
getContentPane().add(jPanel6, java.awt.BorderLayout.CENTER);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jtEBFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtEBFActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jtEBFActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
try {
// TODO add your handling code here:
saveCurrentFiles();
}
catch (Exception ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton4ActionPerformed
private void jtEIFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtEIFActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jtEIFActionPerformed
Properties props = new Properties();
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
FileReader reader = null;
try {
// TODO add your handling code here:
JFileChooser jfc = new JFileChooser();
jfc.setCurrentDirectory(new File(this.jtEBF.getText()));
jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
jfc.showOpenDialog(this);
String n = jfc.getSelectedFile().getName();
selectFolderByName( n );
jtfCollection.setText( n );
SOLRTool.setProjectContext( jfc.getSelectedFile() );
File f = new File( projectContext + "/pc.properties" );
reader = new FileReader( f );
props.load( reader );
try{
jtfGW.setText( props.getProperty( "gateway" ) );
}
catch( Exception ex ){
}
try{
jtfU.setText( props.getProperty( "user" ) );
}
catch( Exception ex ){
}
}
catch (FileNotFoundException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
} finally {
try {
reader.close();
} catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
private void selectFolderByName(String n) {
modelI.setImageFolder(n);
this.jtEIF.setText(n);
jButton6ActionPerformed(new java.awt.event.ActionEvent(this, 1, n));
}//GEN-LAST:event_jButton5ActionPerformed
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
try {
// TODO add your handling code here:
modelI.load();
String fn = modelI.getMorphlineFileName();
this.jtfFlumeCFGFileName.setText(fn);
}
catch (Exception ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton6ActionPerformed
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
// TODO add your handling code here:
String cap = modelI.getSelection();
this.jaI.setText(cap);
}//GEN-LAST:event_jButton7ActionPerformed
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
String cap = getCodeFromSnippetEditor();
modelI.replaceSelection(cap);
}//GEN-LAST:event_jButton8ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
InputStream ins = this.getClass().getResourceAsStream("templates/morphline_step1_json.template");
BufferedReader br = new BufferedReader(new InputStreamReader(ins));
StringBuffer sb = new StringBuffer();
try {
while (br.ready()) {
sb.append(br.readLine() + "\n");
}
modelI.initTemplate(sb.toString());
} catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
// TODO add your handling code here:
String fn = javax.swing.JOptionPane.showInputDialog("Folder:");
File f = new File(modelI.store.folder + "/" + fn);
if (!f.exists()) {
f.mkdir();
}
selectFolderByName(f.getName());
}//GEN-LAST:event_jButton12ActionPerformed
private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField2ActionPerformed
private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3ActionPerformed
private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
String l = "open " + modelI.store.folder;
System.out.println("Open now: " + l);
try {
Runtime.getRuntime().exec(l);
} catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton13ActionPerformed
/**
* Run the full morphline test with testdata from jTable1
*
* @param evt
*/
private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
if (jrbLoadFile.isSelected()) {
try {
Vector<byte[]> rawmessages = new Vector<byte[]>();
File f = new File( this.jLabel6.getText() );
Path p = Paths.get( f.getAbsolutePath() );
byte[] a = Files.readAllBytes(p);
System.out.println( "Input-size: " + a.length + " bytes" );
rawmessages.add(a);
this.modelI.setTestDataBytes(rawmessages);
}
catch (FileNotFoundException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}
else {
Vector<String> messages = new Vector<String>();
TableModel dtm = this.jTable1.getModel();
int offset = 0;
int i = 0;
while (i < dtm.getRowCount()) {
String m = (String) dtm.getValueAt(offset + i, 0);
messages.add(m);
i++;
}
this.modelI.setTestData(messages);
}
try {
this.modelI.runFullMorphlineTest();
this.manageTabs.setSelectedIndex(3);
} catch (Exception ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton11ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
Vector<String> messages = new Vector<String>();
messages.add("S1 P1 O1 D1");
messages.add("S2 P2 O2 D2");
TableModel dtm = this.jTable1.getModel();
int offset = 0;
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
int i = 0;
for (String m : messages) {
Vector row = new Vector();
row.add(m);
model.addRow(row);
// dtm.setValueAt(m, offset+i, 0);
// i++;
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
// TODO add your handling code here:
Vector<String> messages = null;
try {
messages = this.modelI.getTestDataFromFile();
TableModel dtm = this.jTable1.getModel();
int offset = 0;
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
int i = 0;
for (String m : messages) {
Vector row = new Vector();
row.add(m);
model.addRow(row);
// dtm.setValueAt(m, offset+i, 0);
// i++;
}
} catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton14ActionPerformed
private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
// TODO add your handling code here:
modelI.validateMorphelineJSON();
}//GEN-LAST:event_jButton10ActionPerformed
/**
* Clear table.
*
* @param evt
*/
private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
clearTestDataTable();
}//GEN-LAST:event_jButton15ActionPerformed
private void clearTestDataTable() {
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
int x = model.getRowCount();
for (int i = 0; i < x; i++) {
model.removeRow(0);
}
}
/**
* Add new test record ...
*
* @param evt
*/
private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton16ActionPerformed
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
String m = JOptionPane.showInputDialog("new record");
Vector row = new Vector();
row.add(m);
model.addRow(row);
}//GEN-LAST:event_jButton16ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
JFileChooser jfc = new JFileChooser();
jfc.setCurrentDirectory(new File(this.jtEBF.getText()));
jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
jfc.showOpenDialog(this);
String n = jfc.getSelectedFile().getAbsolutePath();
selectSampleFileByName(n);
clearTestDataTable();
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
try {
SOLRTool.init(this.jtfGW.getText(), this.jtfU.getText(), this.jtfPW.getText() );
SOLRTool.prepareCollection(this.jtfZK.getText(), this.jtfCollection.getText() );
}
catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton9ActionPerformed
private void jtfCollectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtfCollectionActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jtfCollectionActionPerformed
private void jButton20ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton20ActionPerformed
try {
String h = jtfGW.getText();
String u = jtfU.getText();
String p = jtfPW.getText();
ClusterGateway.init(h, u, p);
boolean isAvailable = ClusterGateway.ping(h,u,p);
if ( isAvailable ) {
this.jtfGW.setForeground(Color.GREEN);
setSOLRZookeeperAdresse( h );
}
else this.jtfGW.setForeground(Color.RED);
}
catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton20ActionPerformed
// PUBLISH FULL
private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton19ActionPerformed
try {
// TODO add your handling code here:
SOLRTool.init(this.jtfGW.getText(), this.jtfU.getText(), this.jtfPW.getText() );
SOLRTool.uploadAndPublish( this.jtfCollection.getText() );
} catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton19ActionPerformed
// UPDATE
private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton17ActionPerformed
try {
saveCurrentFiles();
manageTabs.setSelectedIndex(3);
SOLRTool.init(this.jtfGW.getText(), this.jtfU.getText(), this.jtfPW.getText() );
SOLRTool.uploadAndPublish( this.jtfCollection.getText() );
// SOLRTool.flushDebugScript();
SOLRTool.closeDebugScript();
} catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton17ActionPerformed
private void jtfFlumeCFGFileNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtfFlumeCFGFileNameActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jtfFlumeCFGFileNameActionPerformed
// starte den Flume agent ...
private void jButton18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton18ActionPerformed
try {
// TODO add your handling code here:
FlumeTool.init(this.jtfGW.getText(), this.jtfU.getText(), this.jtfPW.getText() );
String agent = this.jtfAgent.getText();
String localCFG = "/Users/kamir/etosha/p1/flume.conf";
String remoteCFG = "/home/etosha/p1/flume.conf";
System.out.println( ">>> use real paths !!! " );
FlumeTool.updateConfiguration(localCFG, remoteCFG);
FlumeTool.runAgentWithConfiguration(remoteCFG, agent);
System.out.println( ">>> find PID on Gateway ... " );
String pid = "123";
this.jlPID.setText(pid);
} catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton18ActionPerformed
private void jtfPWActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtfPWActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jtfPWActionPerformed
private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton21ActionPerformed
String PID = this.jlPID.getText();
String agent = this.jtfAgent.getText();
String gw = jtfFlumeGW.getText();
FlumeTool.killAgent( agent, gw, PID );
}//GEN-LAST:event_jButton21ActionPerformed
private void jButton22ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton22ActionPerformed
try {
saveCurrentFiles();
File f = modelI.store.getFlumeCFGFilename( jtEIF.getText() );
System.out.println("Show Flume-Configuration file: " + f.getAbsolutePath() );
FlumeCFGModel fp3 = new FlumeCFGModel( f );
fp3.show( f.getAbsolutePath() );
}
catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton22ActionPerformed
Snippet currentSnippet = null;
private void jButton23ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton23ActionPerformed
// Select a snippet vie SnipLibCOnnector
SnipLibConnector slc = SnipLibConnector.getSnipLibConnector();
slc.show( "Select a Snippet ..." , this);
// callback via SnippetConsumer.setSelectedSnippet ....
}//GEN-LAST:event_jButton23ActionPerformed
private void jButton24ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton24ActionPerformed
// TODO add your handling code here:
try {
SOLRTool.init(this.jtfGW.getText(), this.jtfU.getText(), this.jtfPW.getText() );
SOLRTool.listCollection( );
}
catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton24ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MorphMinerTool.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MorphMinerTool.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MorphMinerTool.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MorphMinerTool.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try {
new MorphMinerTool().setVisible(true);
} catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel Morphes;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JPanel dataflowDescriptors;
private javax.swing.JTabbedPane editorTabs;
private javax.swing.JPanel flumeEditorPane;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton10;
private javax.swing.JButton jButton11;
private javax.swing.JButton jButton12;
private javax.swing.JButton jButton13;
private javax.swing.JButton jButton14;
private javax.swing.JButton jButton15;
private javax.swing.JButton jButton16;
private javax.swing.JButton jButton17;
private javax.swing.JButton jButton18;
private javax.swing.JButton jButton19;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton20;
private javax.swing.JButton jButton21;
private javax.swing.JButton jButton22;
private javax.swing.JButton jButton23;
private javax.swing.JButton jButton24;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel15;
private javax.swing.JPanel jPanel16;
private javax.swing.JPanel jPanel17;
private javax.swing.JPanel jPanel18;
private javax.swing.JPanel jPanel19;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JTabbedPane jTabbedPane2;
private javax.swing.JTable jTable1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextPane jTextPane1;
private javax.swing.JTextArea jaI;
private javax.swing.JTextArea jaL;
private javax.swing.JLabel jlPID;
private javax.swing.JPanel jpImage2;
private javax.swing.JPanel jpImage3;
private javax.swing.JRadioButton jrbLoadFile;
private javax.swing.JRadioButton jrbLoadLines;
private javax.swing.JTextField jtEBF;
private javax.swing.JTextField jtEIF;
private javax.swing.JTextField jtfAgent;
private javax.swing.JTextField jtfCollection;
private javax.swing.JTextField jtfFlumeCFGFileName;
private javax.swing.JTextField jtfFlumeGW;
private javax.swing.JTextField jtfGW;
private javax.swing.JTextField jtfPW;
private javax.swing.JTextField jtfU;
private javax.swing.JTextField jtfZK;
private javax.swing.JPanel latexEditorPane;
private javax.swing.JTabbedPane manageTabs;
private javax.swing.JPanel projectLocation;
private javax.swing.JPanel ttlEditorPane;
// End of variables declaration//GEN-END:variables
RSyntaxTextArea textArea = null;
RSyntaxTextArea textArea2 = null;
RSyntaxTextArea textArea3 = null;
private void initEditor() {
// Morphline JSON
textArea = new RSyntaxTextArea(480, 300);
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JSON);
textArea.setCodeFoldingEnabled(true);
RTextScrollPane sp = new RTextScrollPane(textArea);
latexEditorPane.add(sp, BorderLayout.CENTER);
modelI.editorMorphline = textArea;
// SOLR Schema
textArea2 = new RSyntaxTextArea(480, 200);
textArea2.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_XML);
textArea2.setCodeFoldingEnabled(true);
RTextScrollPane sp2 = new RTextScrollPane(textArea2);
ttlEditorPane.add(sp2, BorderLayout.CENTER);
modelI._editorSOLRSchema = textArea2;
// FLUME
textArea3 = new RSyntaxTextArea(480, 200);
textArea3.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PROPERTIES_FILE);
textArea3.setCodeFoldingEnabled(true);
RTextScrollPane sp3 = new RTextScrollPane(textArea3);
jPanel15.add(sp3, BorderLayout.CENTER);
modelI._editorFlumeCFG = textArea3;
jtEBF.setText(modelI.store.folder);
jtEIF.setText(modelI.basesFolder);
modelI.jaLog = this.jaL;
System.setOut(new PrintStream(new TextAreaAsOutputStream(this.jaL, "> ")));
System.setErr(new PrintStream(new TextAreaAsOutputStream(this.jaL, "[System.err] ")));
}
MLPModelWrapper modelI = null;
private void initModel(String basesFolder, LocalMorphlineStore localFileStore) throws IOException {
modelI = new MLPModelWrapper(localFileStore);
modelI.basesFolder = basesFolder;
}
private String getCodeFromSnippetEditor() {
String cap = "";
cap = cap.concat(jaI.getText());
System.out.println(cap);
return cap;
}
private void selectSampleFileByName(String n) {
this.jrbLoadFile.setSelected(true);
this.jLabel6.setText(n);
System.out.println("SELECTED file: " + n);
this.modelI.setTestData(null);
}
private void saveCurrentFiles() {
try {
System.out.println( ">>> Saved all editors content. " );
modelI.store();
}
catch (IOException ex) {
Logger.getLogger(MorphMinerTool.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void setSelectedSnippet(Snippet s) {
// place snippet in "Zwischenablage" ...
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(
new StringSelection( s.snip ) , null
);
this.jTextPane1.setText( s.snip );
this.currentSnippet = s;
String snip = currentSnippet.snip;
String src = currentSnippet.src;
System.out.println( "> Selected the snippet " + snip + " from " + "{" + src + "}");
System.out.println( "> Snippet is now in BUFFER ... use [CTRL+V]" );
}
private void setSOLRZookeeperAdresse(String h) {
String end = jtfZK.getText().split(":")[1];
jtfZK.setText( h + ":" + end );
}
}