Skip to content

Commit

Permalink
将OSGI扫描集成在华瑞集,
Browse files Browse the repository at this point in the history
扫描插件文档代码 完整来源Refer: :yaoguangluo/ETL_Unicorn#7

20200425 罗瑶光
  • Loading branch information
Lenovo LYG authored and Lenovo LYG committed Apr 24, 2020
1 parent 40d1a9b commit cf27329
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 39 deletions.
130 changes: 91 additions & 39 deletions neroTheme/org/LYG/GUI/extOSGI/OSGI_rigester.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package org.LYG.GUI.extOSGI;
import java.awt.FileDialog;
import java.awt.Frame;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;

import javax.swing.JTextPane;
import org.LYG.GUI.OSGI.*;
Expand Down Expand Up @@ -51,6 +56,9 @@
import org.LYG.node.sound.lygSlaveFilter.lygSlaveFilterInterface;
import org.LYG.node.sound.wavePlay.wavePlayNodeInterface;
import org.LYG.node.suggest.read.ReadNodeInterface;
import org.LYG.sets.stable.StableData;

import comp.filenameFilter.TXTFilter;

public class OSGI_rigester{
JTextPane text;
Expand All @@ -59,111 +67,156 @@ public OSGI_rigester(Object[][] tableData_old, JTextPane text){
this.text= text;
this.tableData_old= tableData_old;
}
@SuppressWarnings("resource")
public NodeOSGI Rigester(NodeOSGI first, LinkOSGI link) throws IOException{
String jarCategoryLink= "";
FileDialog filedialog= new FileDialog(new Frame(), StableData.ATTENSION_LOAD_PLUGIN
, FileDialog.LOAD);
filedialog.setFilenameFilter(new TXTFilter(StableData.FILE_FORMAT_ETL));
filedialog.setVisible(true);
jarCategoryLink= filedialog.getDirectory();
//System.out.println(jarCategoryLink);
if(null== jarCategoryLink|| jarCategoryLink.isEmpty()|| jarCategoryLink.contains
(StableData.FILE_FORMAT_JAR)) {
System.out.println(StableData.ATTENSION_RECHOICE);
return first;
}
File file= new File(jarCategoryLink);
if(file.isFile()) {
System.out.println(StableData.ATTENSION_FILE_CHOICE);
return first;
}
File[] files= file.listFiles();
for(int i= 0; i< files.length; i++) {
@SuppressWarnings("deprecation")
URLClassLoader loader= new URLClassLoader(new URL[]{ files[i].toURL() });
String filename= files[i].getName().replace(StableData.FILE_FORMAT_JAR
, StableData.STRING_EMPTY);
String[] columns= filename.split("\\.");
Class<?> myclass= null;
try {
myclass = loader.loadClass(filename+ "."+ columns[columns.length- 1]
+ StableData.NODE_NODE_INTERFACE);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Object myobject= null;
try {
myobject = myclass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ObjectInterface objectInterface= (ObjectInterface) myobject;
first= link.addNode(first, objectInterface);
}
//×¢²á
ObjectInterface XlsReadernode = new XlsReaderNodeInterface();
first = link.addNode(first, XlsReadernode);

ObjectInterface arffTransferNode = new arffTransferNodeInterface();
first = link.addNode(first, arffTransferNode);

ObjectInterface WekaPilot2DNode = new WekaPilot2DNodeInterface();
first = link.addNode(first, WekaPilot2DNode);

ObjectInterface imageReadNode = new imageReadNodeInterface();
first = link.addNode(first, imageReadNode);

ObjectInterface imageStrechNode = new imageStrechNodeInterface();
first = link.addNode(first, imageStrechNode);

ObjectInterface MedianImageNode = new MedianImageNodeInterface();
first = link.addNode(first, MedianImageNode);

ObjectInterface GrayFilterNode = new GrayFilterNodeInterface();
first = link.addNode(first, GrayFilterNode);

ObjectInterface GuassianFilterNode = new GuassianFilterInterface();
first = link.addNode(first, GuassianFilterNode);

ObjectInterface FindColorRNode = new FindColorRInterface();
first = link.addNode(first, FindColorRNode);

ObjectInterface FindColorGNode = new FindColorGInterface();
first = link.addNode(first, FindColorGNode);

ObjectInterface FindColorBNode = new FindColorBInterface();
first = link.addNode(first, FindColorBNode);

ObjectInterface SobelFilterNode = new SobelFilterNodeInterface();
first = link.addNode(first, SobelFilterNode);

ObjectInterface EmbossFilterNode = new EmbossFilterInterface();
first = link.addNode(first, EmbossFilterNode);

ObjectInterface LaplacianFilterNode = new LaplacianFilterInterface();
first = link.addNode(first, LaplacianFilterNode);

ObjectInterface HoughTransformNode = new HoughTransformInterface();
first = link.addNode(first, HoughTransformNode);

ObjectInterface WavReadNode = new WavReadNodeInterface();
first = link.addNode(first, WavReadNode);

ObjectInterface MedianFilterNode = new MedianFilterNodeInterface();
first = link.addNode(first, MedianFilterNode);

ObjectInterface ButterworthFilterNode = new ButterworthFilterNodeInterface();
first = link.addNode(first, ButterworthFilterNode);

ObjectInterface LaplacianWaveFilterNode = new LaplacianFilterNodeInterface();
first = link.addNode(first, LaplacianWaveFilterNode);

ObjectInterface HoughWavFilterNode = new HoughWavFilterNodeInterface();
first = link.addNode(first, HoughWavFilterNode);

ObjectInterface GuassianWav2DFilterNode = new GuassianWav2DFilterNodeInterface();
first = link.addNode(first, GuassianWav2DFilterNode);

ObjectInterface MaxMiniFilterNode = new MaxMiniFilterNodeInterface();
first = link.addNode(first, MaxMiniFilterNode);

ObjectInterface wavePlayNode = new wavePlayNodeInterface();
first = link.addNode(first, wavePlayNode);

ObjectInterface Show3DNode = new Show3DInterface();
first = link.addNode(first, Show3DNode);

ObjectInterface MorphologyFilter = new MorphologyFilterInterface();
first = link.addNode(first, MorphologyFilter);

ObjectInterface LYGReadNode = new LYGReadNodeInterface();
first = link.addNode(first, LYGReadNode);

ObjectInterface LYGWriteNode = new LYGWriteNodeInterface();
first = link.addNode(first, LYGWriteNode);

ObjectInterface MovieTransferNode = new MovieTransferNodeInterface();
first = link.addNode(first, MovieTransferNode);

ObjectInterface AVItoImagesNode = new AVItoLYGNodeInterface();
first = link.addNode(first, AVItoImagesNode);

ObjectInterface LYGPlayerNode = new LYGPlayerNodeInterface();
first = link.addNode(first, LYGPlayerNode);

ObjectInterface FFTFilterNode = new FFTFilterNodeInterface();
first = link.addNode(first, FFTFilterNode);

ObjectInterface freqCountNode = new freqCountNodeInterface();
first = link.addNode(first, freqCountNode);

ObjectInterface lygFilterNode = new lygFilterNodeInterface();
first = link.addNode(first, lygFilterNode);

ObjectInterface lygFilterComp = new ft2DFilterInterface();
first = link.addNode(first, lygFilterComp);

ObjectInterface lygSlave = new lygSlaveFilterInterface();
first = link.addNode(first, lygSlave);

ObjectInterface logFFT = new logFFTInterface();
first = link.addNode(first, logFFT);

Expand All @@ -172,39 +225,38 @@ public NodeOSGI Rigester(NodeOSGI first, LinkOSGI link) throws IOException{

ObjectInterface editPanelReader = new EditPanelReaderInterface(this.text);
first = link.addNode(first, editPanelReader);

ObjectInterface editPanelReaderH= new EditPanelReaderHInterface(this.text);
first = link.addNode(first, editPanelReaderH);

ObjectInterface addChuFangAttributeH= new AddChuFangAttributeHInterface(this.tableData_old
, this.text);
first = link.addNode(first,addChuFangAttributeH);

ObjectInterface filterChuFangJinJiAttributeH=
new filterChuFangJinJiAttributeHInterface(this.tableData_old, this.text);
first = link.addNode(first, filterChuFangJinJiAttributeH);

ObjectInterface chuFangWuXingShowHInterface=
new ChuFangWuXingShowHInterface(this.tableData_old, this.text);
first = link.addNode(first,chuFangWuXingShowHInterface);
//ɨÃèjar¡¢¡¢Ìí¼Ójar

ObjectInterface filterChuFangXingWeiKeyWordsAttributeH=
new filterChuFangXingWeiKeyWordsAttributeHInterface(this.tableData_old, this.text);
first = link.addNode(first, filterChuFangXingWeiKeyWordsAttributeH);

ObjectInterface filterChuFangJinJiKeyWordsAttributeH=
new filterChuFangJinJiKeyWordsAttributeHInterface(this.tableData_old, this.text);
first = link.addNode(first, filterChuFangJinJiKeyWordsAttributeH);

ObjectInterface updateToEditPane=
new updateToEditPaneInterface(this.tableData_old, this.text);
first = link.addNode(first, updateToEditPane);

ObjectInterface readNodeInterface=
new ReadNodeInterface(this.tableData_old, this.text);
first = link.addNode(first, readNodeInterface);

return first;
}

}
5 changes: 5 additions & 0 deletions neroTheme/org/LYG/sets/stable/StableData.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public interface StableData {
public static final String ATTENSION_DELETE= "亲,当前ETL流删除的干干净净~";
public static final String ATTENSION_LOAD_ENSURE= "再次确认要导入吗?当前已经保存?";
public static final String ATTENSION_LOAD_HISTORY= "选择历史档案";
public static final String ATTENSION_LOAD_PLUGIN= "选择节点插件资源包";
public static final String FILE_FORMAT_ETL= ".etl";
public static final String NODE_ADD_ERROR= "节点添加失败~请重试。";
public static final String NODE_UPDATE_ERROR= "节点配置失败~请重试。";
Expand Down Expand Up @@ -50,4 +51,8 @@ public interface StableData {
public static final String yinShiBuJie= "痢疾 腹痛 肠颤 吐泻 便溏";
public static final String tiaoShiPianShe= "便秘 腹胀 屁多 腹泻 ";
//......
public static final String ATTENSION_FILE_CHOICE= "您选择的不是文件夹,请重新选择。";
public static final String FILE_FORMAT_JAR= ".jar";
public static final String NODE_NODE_INTERFACE= "NodeInterface";
public static final String STRING_EMPTY= "";
}

0 comments on commit cf27329

Please sign in to comment.