diff --git a/.classpath b/.classpath index 2d6a00b..a7f3144 100644 --- a/.classpath +++ b/.classpath @@ -1,8 +1,8 @@ - + - + diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs index 408b507..4973d34 100644 --- a/.settings/org.eclipse.buildship.core.prefs +++ b/.settings/org.eclipse.buildship.core.prefs @@ -1,2 +1,13 @@ +arguments= +auto.sync=false +build.scans.enabled=false +connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(4.10.3)) connection.project.dir= eclipse.preferences.version=1 +gradle.user.home= +java.home= +jvm.arguments= +offline.mode=false +override.workspace.settings=true +show.console.view=true +show.executions.view=true diff --git a/README.md b/README.md index bad31c6..3260e32 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # 基于VPCS的桌面运维ETL 系统,满足对deta cache的可视化运维管理 基于VPCS思想的 进行2.0项目版本实践。 +##### 已经完成任务:采用ETL最新资源包。已测试调通可运行。罗瑶光。20190211 +##### 已经完成任务:已修改运维logo,已创造第一个运维节点 名称为获取缓存服务器信息。罗瑶光。20190212 + ##### 任务:vpcs 独有成份进行布局正在做。 -##### 任务:调通 etl 软件在这个工程中。 ##### 任务:第一个节点《缓存服务器链接节点》设计,从容易开始 ##### 任务:第一个节点《缓存服务器链接节点》无版权图案片做logo 直接在互联网上搜无版权的修改下,新巧就可以了 ##### 任务:第一个节点 通过 ip + 端口 + 安全认证 + 简单的字符串口号 链接一台或者缓存服务器,形成一个list box 树。 @@ -43,6 +45,7 @@ ##### 任务: ##### 任务: ##### 任务: +![实例](https://github.com/yaoguangluo/Deta_Cache_Devops_App/blob/master/testconnection.png) diff --git a/UI/GUIBuild/GUIsample3.java b/UI/GUIBuild/GUIsample3.java index f30fce5..0918ef7 100644 --- a/UI/GUIBuild/GUIsample3.java +++ b/UI/GUIBuild/GUIsample3.java @@ -46,23 +46,23 @@ import org.LYG.GUI.nodeView.cacuString; import org.LYG.GUI.nodeView.nodeShow; import org.LYG.GUI.platForm.unicornJSplitPane; -public class GUIsample3 extends JApplet implements MouseMotionListener, MouseListener,ItemListener,ActionListener,Runnable{ +public class GUIsample3 extends JApplet implements MouseMotionListener, MouseListener +, ItemListener, ActionListener, Runnable{ private static final long serialVersionUID = 5270675501794340912L; public GUIsample3() { - //getContentPane().setBackground(new Color(218,112,214)); getContentPane().setBackground(new Color(255,255,255)); } - public int w,h; - int flash=0; - int count=0; + public int w, h; + int flash = 0; + int count = 0; String currentNodeName; int currentNodeID; LinkList thislist; LinkNode first; - int currentx,currenty; - int choose=0; - int oldx,oldy; - int newx,newy; + int currentx, currenty; + int choose = 0; + int oldx, oldy; + int newx, newy; int isOperation = 0; String treeNodeName; nodeShow nodeview; @@ -76,19 +76,19 @@ public GUIsample3() { JScrollPane rightdownscrollPane; JScrollPane rightrightscrollPane; thisCanvas canvas; - PopupMenu popupMenu1,nodeMenu,itemMenu; + PopupMenu popupMenu1, nodeMenu, itemMenu; MenuItem menuItem1; - MenuItem configre,run,show,dnode,dline; - Thread thread,thread1; + MenuItem configre, run, show, dnode, dline; + Thread thread, thread1; public void run() { try { Thread.sleep(100); } catch (InterruptedException e1) { e1.printStackTrace(); } - nodeproject.setBounds(0, 0,leftsplitPane.getWidth(),leftsplitPane.getDividerLocation()); + nodeproject.setBounds(0, 0, leftsplitPane.getWidth(), leftsplitPane.getDividerLocation()); nodeproject.jPanel.newimg = nodeproject.img.getScaledInstance(nodeproject.getWidth() - ,nodeproject.getHeight(),java.awt.Image.SCALE_SMOOTH ); + , nodeproject.getHeight(), java.awt.Image.SCALE_SMOOTH); nodeproject.jPanel.update(getGraphics()); nodeproject.validate(); while(true){ @@ -105,6 +105,7 @@ public void start(){ thread.start(); } } + public void stop() { } @@ -122,6 +123,7 @@ public void propertyChange(java.beans.PropertyChangeEvent evt) { } } }); + mainsplitPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { if (evt.getPropertyName().equals(JSplitPane.DIVIDER_LOCATION_PROPERTY)) { @@ -134,6 +136,7 @@ public void propertyChange(java.beans.PropertyChangeEvent evt) { } } }); + righttopscrollPane.addComponentListener(new ComponentListener(){ public void componentHidden(ComponentEvent arg0) {} public void componentMoved(ComponentEvent arg0) {} @@ -142,14 +145,11 @@ public void componentResized(ComponentEvent arg0) { } public void componentShown(ComponentEvent arg0) {} }); + getContentPane().addComponentListener(new ComponentListener(){ - public void componentHidden(ComponentEvent arg0) {} - public void componentMoved(ComponentEvent arg0) {} - public void componentResized(ComponentEvent arg0) { - // TODO Auto-generated method stub w=getContentPane().getWidth(); h=getContentPane().getHeight(); mainsplitPane.setBounds(10, 50, w-20, h-80); @@ -165,7 +165,7 @@ public void componentResized(ComponentEvent arg0) { nodeproject.validate(); mainsplitPane.validate(); - System.out.println(w+"<>"+h); + System.out.println(w + "<>" + h); } public void componentShown(ComponentEvent arg0) { @@ -221,11 +221,11 @@ public void actionPerformed(ActionEvent e) { e1.printStackTrace(); } node.thisface.thispanel.setLocation(node.x, node.y); - node.thisface.thispanel.setSize(300, 300);//setBounds(0, 0, node.x+300,node.y+200); + node.thisface.thispanel.setSize(600, 480);//setBounds(0, 0, node.x+300,node.y+200); node.thisface.thispanel.setResizable(true); node.thisface.thispanel.setClosable(true); - node.thisface.thispanel.jsp.setBounds(0, 0, node.thisface.thispanel.getWidth()-10 - , node.thisface.thispanel.getHeight()-45); + node.thisface.thispanel.jsp.setBounds(0, 0, node.thisface.thispanel.getWidth() - 10 + , node.thisface.thispanel.getHeight() - 45); node.thisface.thispanel.jp.setPreferredSize(new Dimension(800,600)); canvas.add(node.thisface.thispanel); node.thisface.thispanel.setVisible(true); @@ -233,15 +233,15 @@ public void actionPerformed(ActionEvent e) { new OSGI_chansfer(node,first); } while(node.next != null){ - node=node.next; - if(node.name.equals(currentNodeName)&&node.ID==currentNodeID){ + node = node.next; + if(node.name.equals(currentNodeName)&&node.ID == currentNodeID){ try { node.thisface.config(); } catch (IOException e1) { e1.printStackTrace(); } node.thisface.thispanel.setLocation(node.x, node.y); - node.thisface.thispanel.setSize(300, 300);//setBounds(0, 0, node.x+300,node.y+200); + node.thisface.thispanel.setSize(600, 480);//setBounds(0, 0, node.x+300,node.y+200); node.thisface.thispanel.setResizable(true); node.thisface.thispanel.setClosable(true);node.thisface.thispanel.jsp.setBounds(0, 0 , node.thisface.thispanel.getWidth()-10, node.thisface.thispanel.getHeight()-45); @@ -273,9 +273,8 @@ public void actionPerformed(ActionEvent e) { } catch (InterruptedException e3) { e3.printStackTrace(); } - } - while(node.next!=null){ + while(null != node.next){ node=node.next; if(node.name.equals(currentNodeName)&&node.ID==currentNodeID){ try { @@ -441,27 +440,27 @@ public void mouseEntered(MouseEvent arg0) {} public void mouseExited(MouseEvent arg0) {} public void mousePressed(MouseEvent arg0) { - isOperation = 1; - //System.out.println(arg0.getX()+"|"+arg0.getY()); + isOperation=1; + System.out.println(arg0.getX()+"|"+arg0.getY()); oldx = arg0.getX(); oldy = arg0.getY(); - currentx = arg0.getX(); - currenty = arg0.getY(); - currentNodeName = new ChooseCheck().chooseCheckname(first,arg0); - currentNodeID = new ChooseCheck().chooseCheckid(first,arg0); + currentx=arg0.getX(); + currenty=arg0.getY(); + currentNodeName=new ChooseCheck().chooseCheckname(first,arg0); + currentNodeID=new ChooseCheck().chooseCheckid(first,arg0); } public void mouseReleased(MouseEvent arg0){ - isOperation = 0; - currentx = arg0.getX(); - currenty = arg0.getY(); - first = new Sort().sort(first); - LinkNode node = new LinkNode(); - node = first; - if(node != null){ - if(node.rightchoose && !node.leftchoose){ - if(oldx == arg0.getX() && oldy == arg0.getY()){ + isOperation=0; + currentx=arg0.getX(); + currenty=arg0.getY(); + first=new Sort().sort(first); + LinkNode node=new LinkNode(); + node=first; + if(node!=null){ + if(node.rightchoose&&!node.leftchoose){ + if(oldx==arg0.getX()&&oldy==arg0.getY()){ nodeMenu.show(this, arg0.getX(), arg0.getY()); } else{ @@ -469,11 +468,11 @@ public void mouseReleased(MouseEvent arg0){ } } node.setchoose(false); - node.rightchoose = false; - while(node.next != null){ - node = node.next; - if(node.rightchoose && !node.leftchoose){ - if(oldx == arg0.getX()&&oldy==arg0.getY()){ + node.rightchoose=false; + while(node.next!=null){ + node=node.next; + if(node.rightchoose&&!node.leftchoose){ + if(oldx==arg0.getX()&&oldy==arg0.getY()){ nodeMenu.show(this, arg0.getX(), arg0.getY()); } else{ @@ -496,23 +495,23 @@ public void mouseDragged(MouseEvent e) { currentx=e.getX(); currenty=e.getY(); LinkNode node=new LinkNode(); - first=new Sort().sort(first); - node=first; + first = new Sort().sort(first); + node = first; Graphics g = getGraphics(); Graphics2D g2 = (Graphics2D)g; g2.setColor(Color.black); - if(node!=null){ - if(node.leftchoose&&!node.rightchoose){ + if(node != null){ + if(node.leftchoose && !node.rightchoose){ node.setxy(e.getX(),e.getY()); new DynamicLineUpdater().exec(first,node); this.update(); } - if(!node.leftchoose&&node.rightchoose){ + if(!node.leftchoose && node.rightchoose){ new DrawArrow(g2,oldx, oldy, e.getX(), e.getY()); this.update(g); } - while(node.next!=null){ - node=node.next; + while(node.next != null){ + node = node.next; if(node.leftchoose&&!node.rightchoose){ node.setxy(e.getX(),e.getY()); new DynamicLineUpdater().exec(first,node); @@ -674,7 +673,7 @@ public void init(){ this.resize(w,h); } private void CreatMap() throws IOException { - w=1420; + w=1400; h=800; getContentPane().setLayout(null); UIManager.put("SplitPaneUI","org.LYG.GUI.platForm.unicornSplitPaneUI"); diff --git a/UI/org/LYG/GUI/Flash/GUIsample3.java b/UI/org/LYG/GUI/Flash/GUIsample3.java index 07a3014..9ad9252 100644 --- a/UI/org/LYG/GUI/Flash/GUIsample3.java +++ b/UI/org/LYG/GUI/Flash/GUIsample3.java @@ -46,23 +46,23 @@ import org.LYG.GUI.nodeView.cacuString; import org.LYG.GUI.nodeView.nodeShow; import org.LYG.GUI.platForm.unicornJSplitPane; -public class GUIsample3 extends JApplet implements MouseMotionListener, MouseListener,ItemListener,ActionListener,Runnable{ +public class GUIsample3 extends JApplet implements MouseMotionListener, MouseListener, ItemListener, ActionListener, Runnable{ private static final long serialVersionUID = 5270675501794340912L; public GUIsample3() { //getContentPane().setBackground(new Color(218,112,214)); getContentPane().setBackground(new Color(255,255,255)); } - public int w,h; - int flash=0; - int count=0; + public int w, h; + int flash = 0; + int count = 0; String currentNodeName; int currentNodeID; LinkList thislist; LinkNode first; int currentx,currenty; - int choose=0; - int oldx,oldy; - int newx,newy; + int choose = 0; + int oldx, oldy; + int newx, newy; String treeNodeName; nodeShow nodeview; nodeProject nodeproject; @@ -86,8 +86,9 @@ public void run() { } catch (InterruptedException e1) { e1.printStackTrace(); } - nodeproject.setBounds(0, 0,leftsplitPane.getWidth(),leftsplitPane.getDividerLocation()); - nodeproject.jPanel.newimg = nodeproject.img.getScaledInstance(nodeproject.getWidth(),nodeproject.getHeight(),java.awt.Image.SCALE_SMOOTH ); + nodeproject.setBounds(0, 0, leftsplitPane.getWidth(), leftsplitPane.getDividerLocation()); + nodeproject.jPanel.newimg = nodeproject.img.getScaledInstance(nodeproject.getWidth() + , nodeproject.getHeight(),java.awt.Image.SCALE_SMOOTH ); nodeproject.jPanel.update(getGraphics()); nodeproject.validate(); while(true) { @@ -114,10 +115,10 @@ public void propertyChange(java.beans.PropertyChangeEvent evt) { if (evt.getPropertyName().equals(JSplitPane.DIVIDER_LOCATION_PROPERTY)) { //action code nodeproject.setBounds(0, 0,leftsplitPane.getWidth(),leftsplitPane.getDividerLocation()); - nodeproject.jPanel.newimg = nodeproject.img.getScaledInstance(nodeproject.getWidth(),nodeproject.getHeight(),java.awt.Image.SCALE_SMOOTH ); + nodeproject.jPanel.newimg = nodeproject.img.getScaledInstance(nodeproject.getWidth() + , nodeproject.getHeight(),java.awt.Image.SCALE_SMOOTH); nodeproject.jPanel.repaint(); nodeproject.validate(); - } } }); @@ -126,7 +127,8 @@ public void propertyChange(java.beans.PropertyChangeEvent evt) { if (evt.getPropertyName().equals(JSplitPane.DIVIDER_LOCATION_PROPERTY)) { //action code nodeproject.setBounds(0, 0,mainsplitPane.getDividerLocation(),leftsplitPane.getDividerLocation()); - nodeproject.jPanel.newimg = nodeproject.img.getScaledInstance(nodeproject.getWidth(),nodeproject.getHeight(),java.awt.Image.SCALE_SMOOTH ); + nodeproject.jPanel.newimg = nodeproject.img.getScaledInstance(nodeproject.getWidth() + , nodeproject.getHeight(),java.awt.Image.SCALE_SMOOTH ); nodeproject.jPanel.repaint(); nodeproject.validate(); } @@ -152,7 +154,8 @@ public void componentResized(ComponentEvent arg0) { rightsplitPane.setDividerLocation(0.85); righttopsplitPane.setDividerLocation(0.9); nodeproject.setBounds(0, 0,mainsplitPane.getDividerLocation(),leftsplitPane.getDividerLocation()); - nodeproject.jPanel.newimg = nodeproject.img.getScaledInstance(nodeproject.getWidth(),nodeproject.getHeight(),java.awt.Image.SCALE_SMOOTH ); + nodeproject.jPanel.newimg = nodeproject.img.getScaledInstance(nodeproject.getWidth() + , nodeproject.getHeight(),java.awt.Image.SCALE_SMOOTH ); nodeproject.jPanel.repaint(); nodeproject.validate(); mainsplitPane.validate(); @@ -232,7 +235,8 @@ public void actionPerformed(ActionEvent e) { node.thisface.thispanel.setLocation(node.x, node.y); node.thisface.thispanel.setSize(300, 300);//setBounds(0, 0, node.x+300,node.y+200); node.thisface.thispanel.setResizable(true); - node.thisface.thispanel.setClosable(true);node.thisface.thispanel.jsp.setBounds(0, 0, node.thisface.thispanel.getWidth()-10, node.thisface.thispanel.getHeight()-45); + node.thisface.thispanel.setClosable(true);node.thisface.thispanel.jsp.setBounds(0, 0 + , node.thisface.thispanel.getWidth()-10, node.thisface.thispanel.getHeight()-45); node.thisface.thispanel.jp.setPreferredSize(new Dimension(800,600)); canvas.add(node.thisface.thispanel); node.thisface.thispanel.setVisible(true); @@ -297,7 +301,8 @@ public void actionPerformed(ActionEvent e) { node.thisface.thisview.setLocation(node.x, node.y); node.thisface.thisview.setSize(300, 300);//setBounds(0, 0, node.x+300,node.y+200); node.thisface.thisview.setResizable(true); - node.thisface.thisview.setClosable(true);node.thisface.thisview.jsp.setBounds(0, 0, node.thisface.thispanel.getWidth()-10, node.thisface.thispanel.getHeight()-45); + node.thisface.thisview.setClosable(true);node.thisface.thisview.jsp.setBounds(0, 0 + , node.thisface.thispanel.getWidth()-10, node.thisface.thispanel.getHeight()-45); node.thisface.thisview.jp.setPreferredSize(new Dimension(800,600)); canvas.add(node.thisface.thisview); node.thisface.thisview.setVisible(true); @@ -319,7 +324,8 @@ public void actionPerformed(ActionEvent e) { node.thisface.thisview.setLocation(node.x, node.y); node.thisface.thisview.setSize(300, 300);//setBounds(0, 0, node.x+300,node.y+200); node.thisface.thisview.setResizable(true); - node.thisface.thisview.setClosable(true);node.thisface.thisview.jsp.setBounds(0, 0, node.thisface.thispanel.getWidth()-10, node.thisface.thispanel.getHeight()-45); + node.thisface.thisview.setClosable(true);node.thisface.thisview.jsp.setBounds(0, 0 + , node.thisface.thispanel.getWidth()-10, node.thisface.thispanel.getHeight()-45); node.thisface.thisview.jp.setPreferredSize(new Dimension(800,600)); canvas.add(node.thisface.thisview); node.thisface.thisview.setVisible(true); @@ -502,7 +508,6 @@ public void mouseDragged(MouseEvent e) { } } public void mouseMoved(MouseEvent arg0) { - // TODO Auto-generated method stub } public void update(){ Graphics g=getGraphics(); @@ -631,7 +636,6 @@ public void init(){ try { CreatMap(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } Registrar(); diff --git a/UI/org/LYG/GUI/OSGI/objectInterface.java b/UI/org/LYG/GUI/OSGI/objectInterface.java index 303e86c..281a73d 100644 --- a/UI/org/LYG/GUI/OSGI/objectInterface.java +++ b/UI/org/LYG/GUI/OSGI/objectInterface.java @@ -2,7 +2,6 @@ import java.awt.Image; import java.io.FileNotFoundException; import java.io.IOException; - import javax.sound.sampled.UnsupportedAudioFileException; import javax.swing.ImageIcon; public class objectInterface implements Cloneable{ diff --git a/UI/org/LYG/GUI/extOSGI/OSGI_chansfer.java b/UI/org/LYG/GUI/extOSGI/OSGI_chansfer.java index 5c31107..a386282 100644 --- a/UI/org/LYG/GUI/extOSGI/OSGI_chansfer.java +++ b/UI/org/LYG/GUI/extOSGI/OSGI_chansfer.java @@ -3,40 +3,40 @@ import org.LYG.GUI.nodeEdit.LinkNode; public class OSGI_chansfer { public OSGI_chansfer(LinkNode node, LinkNode first){ - first=new Sort().sort(first); - LinkNode node1=new LinkNode(); - node1=first; - if(node1!=null){ - if(node.tbeconnect&&node.tbeconnectID==node1.ID&&node.tbeconnetName.equals(node1.name)){ - node.thisface.thisrun.toptablein=node1.thisface.thisview.tableout; - node.thisface.thisrun.topgin=node1.thisface.thisview.gout; + first = new Sort().sort(first); + LinkNode node1 = new LinkNode(); + node1 = first; + if(null != node1){ + if(node.tbeconnect&&node.tbeconnectID == node1.ID&&node.tbeconnetName.equals(node1.name)){ + node.thisface.thisrun.toptablein = node1.thisface.thisview.tableout; + node.thisface.thisrun.topgin = node1.thisface.thisview.gout; return; } - if(node.mbeconnect&&node.mbeconnectID==node1.ID&&node.mbeconnetName.equals(node1.name)){ - node.thisface.thisrun.midtablein=node1.thisface.thisview.tableout; - node.thisface.thisrun.midgin=node1.thisface.thisview.gout; + if(node.mbeconnect&&node.mbeconnectID == node1.ID&&node.mbeconnetName.equals(node1.name)){ + node.thisface.thisrun.midtablein = node1.thisface.thisview.tableout; + node.thisface.thisrun.midgin = node1.thisface.thisview.gout; return; } - if(node.dbeconnect&&node.dbeconnectID==node1.ID&&node.dbeconnetName.equals(node1.name)){ - node.thisface.thisrun.downtablein=node1.thisface.thisview.tableout; - node.thisface.thisrun.downgin=node1.thisface.thisview.gout; + if(node.dbeconnect&&node.dbeconnectID == node1.ID&&node.dbeconnetName.equals(node1.name)){ + node.thisface.thisrun.downtablein = node1.thisface.thisview.tableout; + node.thisface.thisrun.downgin = node1.thisface.thisview.gout; return; } - while(node1.next!=null){ + while(null != node1.next){ node1=node1.next; - if(node.tbeconnect&&node.tbeconnectID==node1.ID&&node.tbeconnetName.equals(node1.name)){ - node.thisface.thisrun.toptablein=node1.thisface.thisview.tableout; - node.thisface.thisrun.topgin=node1.thisface.thisview.gout; + if(node.tbeconnect&&node.tbeconnectID == node1.ID&&node.tbeconnetName.equals(node1.name)){ + node.thisface.thisrun.toptablein = node1.thisface.thisview.tableout; + node.thisface.thisrun.topgin = node1.thisface.thisview.gout; return; } - if(node.mbeconnect&&node.mbeconnectID==node1.ID&&node.mbeconnetName.equals(node1.name)){ - node.thisface.thisrun.midtablein=node1.thisface.thisview.tableout; - node.thisface.thisrun.midgin=node1.thisface.thisview.gout; + if(node.mbeconnect&&node.mbeconnectID == node1.ID&&node.mbeconnetName.equals(node1.name)){ + node.thisface.thisrun.midtablein = node1.thisface.thisview.tableout; + node.thisface.thisrun.midgin = node1.thisface.thisview.gout; return; } - if(node.dbeconnect&&node.dbeconnectID==node1.ID&&node.dbeconnetName.equals(node1.name)){ - node.thisface.thisrun.downtablein=node1.thisface.thisview.tableout; - node.thisface.thisrun.downgin=node1.thisface.thisview.gout; + if(node.dbeconnect&&node.dbeconnectID == node1.ID&&node.dbeconnetName.equals(node1.name)){ + node.thisface.thisrun.downtablein = node1.thisface.thisview.tableout; + node.thisface.thisrun.downgin = node1.thisface.thisview.gout; return; } } diff --git a/UI/org/LYG/GUI/extOSGI/OSGI_rigester.java b/UI/org/LYG/GUI/extOSGI/OSGI_rigester.java index c2fa1b5..8b2d43e 100644 --- a/UI/org/LYG/GUI/extOSGI/OSGI_rigester.java +++ b/UI/org/LYG/GUI/extOSGI/OSGI_rigester.java @@ -1,20 +1,19 @@ package org.LYG.GUI.extOSGI; import java.io.IOException; - import org.LYG.GUI.OSGI.*; -import org.LYG.node.ai.arffTransfer.arffTransferNodeInterface; - +import org.cache.devops.getCacheInfo.CacheInfoNodeInterface; public class OSGI_rigester{ public OSGI_rigester(){ } public nodeOSGI Rigester(nodeOSGI first, linkOSGI link) throws IOException{ //ע - // - objectInterface arffTransferNode = new arffTransferNodeInterface(); - first = link.addNode(first,arffTransferNode); +// objectInterface arffTransferNode = new arffTransferNodeInterface(); +// first = link.addNode(first, arffTransferNode); + + objectInterface cacheInfoNode = new CacheInfoNodeInterface(); + first = link.addNode(first, cacheInfoNode); return first; } - } \ No newline at end of file diff --git a/UI/org/LYG/GUI/nodeEdit/ChooseCheck.java b/UI/org/LYG/GUI/nodeEdit/ChooseCheck.java index 9219d86..5195b08 100644 --- a/UI/org/LYG/GUI/nodeEdit/ChooseCheck.java +++ b/UI/org/LYG/GUI/nodeEdit/ChooseCheck.java @@ -1,36 +1,34 @@ package org.LYG.GUI.nodeEdit; - import java.awt.event.MouseEvent; - public class ChooseCheck{ public ChooseCheck() {} - public int chooseCheckid(LinkNode first,MouseEvent arg0) { + public int chooseCheckid(LinkNode first, MouseEvent arg0) { LinkNode node=new LinkNode(); first=new Sort().sort(first);; node=first; int x,y; - x=arg0.getX(); - y=arg0.getY(); - if(node!=null){ + x = arg0.getX(); + y = arg0.getY(); + if(node != null){ //x -= node.x; //y -= node.y; //x=Math.abs(x); //y=Math.abs(y); - if((x>node.x)&&(xnode.y)&&(y node.x) && (x < node.x + 50) && (y > node.y) && (y < node.y + 50)){ + if(arg0.getButton() == 1){ + node.leftchoose = true; } - if(arg0.getButton()==3){ - node.rightchoose=true; + if(arg0.getButton() == 3){ + node.rightchoose = true; } return node.ID; } - while(node.next!=null){ - x=arg0.getX(); - y=arg0.getY(); - node=node.next; - if((x>node.x)&&(xnode.y)&&(y node.x) && (x < node.x + 50) && (y > node.y) && (y < node.y + 50)){ if(arg0.getButton()==1){ node.leftchoose=true; } @@ -44,32 +42,32 @@ public int chooseCheckid(LinkNode first,MouseEvent arg0) { return 0; } public String chooseCheckname(LinkNode first,MouseEvent arg0) { - LinkNode node=new LinkNode(); - first=new Sort().sort(first); - node=first; + LinkNode node = new LinkNode(); + first = new Sort().sort(first); + node = first; int x,y; - x=arg0.getX(); - y=arg0.getY(); - if(node!=null){ - if((x>node.x)&&(xnode.y)&&(y node.x) && (x < node.x + 50) && (y > node.y) && (y < node.y + 50)){ + if(arg0.getButton() == 1){ node.leftchoose=true; } - if(arg0.getButton()==3){ - node.rightchoose=true; + if(arg0.getButton() == 3){ + node.rightchoose = true; } return node.name; } - while(node.next!=null){ - x=arg0.getX(); - y=arg0.getY(); - node=node.next; - if((x>node.x)&&(xnode.y)&&(y node.x) && (x < node.x + 50) && (y>node.y) && (y < node.y + 50)){ + if(arg0.getButton() == 1){ + node.leftchoose = true; } - if(arg0.getButton()==3){ - node.rightchoose=true; + if(arg0.getButton() == 3){ + node.rightchoose = true; } return node.name; } diff --git a/UI/org/LYG/GUI/nodeEdit/DrawArrow.java b/UI/org/LYG/GUI/nodeEdit/DrawArrow.java index 4d3f1cf..74037e1 100644 --- a/UI/org/LYG/GUI/nodeEdit/DrawArrow.java +++ b/UI/org/LYG/GUI/nodeEdit/DrawArrow.java @@ -2,11 +2,14 @@ import java.awt.*; public class DrawArrow{ public DrawArrow(Graphics2D g2, int x, int y, int connectx, int connecty) { + x += 10; + connectx -= 10; g2.setStroke(new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND)); - g2.drawLine(x,y,connectx,connecty); - g2.drawPolygon(getArrow(x, y, connectx, connecty, 18, 0,0.5)); - g2.fillPolygon(getArrow(x, y, connectx, connecty, 18, 0,0.5)); + g2.drawLine(x, y, connectx, connecty); + g2.drawPolygon(getArrow(x, y, connectx, connecty, 10, 0,0.5)); + g2.fillPolygon(getArrow(x, y, connectx, connecty, 10, 0,0.5)); } + public Polygon getArrow(int x1, int y1, int x2, int y2, int headsize, int difference, double factor){ int[] crosslinebase = getArrowHeadLine(x1, y1, x2, y2, headsize); int[] headbase = getArrowHeadLine(x1, y1, x2, y2, headsize - difference); @@ -20,6 +23,7 @@ public Polygon getArrow(int x1, int y1, int x2, int y2, int headsize, int differ head.addPoint(x1, y1); return head; } + private int[] getArrowHeadCrossLine(int x1, int x2, int b1, int b2, double factor){ int [] crossline = new int[4]; int xdest = (int) (((b1 - x1)*factor) + x1); @@ -30,6 +34,7 @@ private int[] getArrowHeadCrossLine(int x1, int x2, int b1, int b2, double facto crossline[3] = crossline[1] + (x2-crossline[1])*2; return crossline; } + private int[] getArrowHeadLine(int xsource,int ysource,int xdest,int ydest, int distance){ int[] arrowhead = new int[2]; int headsize = distance; diff --git a/UI/org/LYG/GUI/nodeEdit/LinkList.java b/UI/org/LYG/GUI/nodeEdit/LinkList.java index 8dcfffe..54a6a60 100644 --- a/UI/org/LYG/GUI/nodeEdit/LinkList.java +++ b/UI/org/LYG/GUI/nodeEdit/LinkList.java @@ -26,7 +26,8 @@ public boolean search(LinkNode first2,String key){ } return false; } - public LinkNode addNode(LinkNode first2, String treeNodeName,int x,int y,nodeOSGI nOSGI ) throws CloneNotSupportedException, InstantiationException, IllegalAccessException, IOException { + public LinkNode addNode(LinkNode first2, String treeNodeName,int x,int y,nodeOSGI nOSGI ) + throws CloneNotSupportedException, InstantiationException, IllegalAccessException, IOException { nodeOSGI currentOSGI=nOSGI; while(currentOSGI!=null&¤tOSGI.pre!=null){ currentOSGI=currentOSGI.pre; diff --git a/UI/org/LYG/GUI/nodeProject/china.gif b/UI/org/LYG/GUI/nodeProject/china.gif new file mode 100644 index 0000000..b87edb5 Binary files /dev/null and b/UI/org/LYG/GUI/nodeProject/china.gif differ diff --git a/UI/org/LYG/GUI/nodeProject/logo.jpg b/UI/org/LYG/GUI/nodeProject/logo.jpg new file mode 100644 index 0000000..34342bd Binary files /dev/null and b/UI/org/LYG/GUI/nodeProject/logo.jpg differ diff --git a/UI/org/LYG/GUI/nodeProject/logo.png b/UI/org/LYG/GUI/nodeProject/logo.png deleted file mode 100644 index 95075dc..0000000 Binary files a/UI/org/LYG/GUI/nodeProject/logo.png and /dev/null differ diff --git a/UI/org/LYG/GUI/nodeProject/nodeProject.java b/UI/org/LYG/GUI/nodeProject/nodeProject.java index 2282d75..d1f6481 100644 --- a/UI/org/LYG/GUI/nodeProject/nodeProject.java +++ b/UI/org/LYG/GUI/nodeProject/nodeProject.java @@ -12,13 +12,12 @@ public class nodeProject extends JScrollPane { public MyPanel jPanel; public Image img; public nodeProject() { - //images =new ImageIcon(this.getClass().getResource("LUO.jpg")); - images =new ImageIcon(this.getClass().getResource("logo.png"));//ûѡãԺỻ - img = images.getImage(); - jPanel=new MyPanel(); - jPanel.repaint(); + images =new ImageIcon(this.getClass().getResource("logo.jpg")); + img = images.getImage(); + jPanel=new MyPanel(); + jPanel.repaint(); // jPanel.setPreferredSize(new Dimension(200,200)); - this.setViewportView(jPanel); + this.setViewportView(jPanel); } public class MyPanel extends JPanel { /** @@ -31,7 +30,7 @@ public MyPanel(){ //newimg= img.getScaledInstance(200,100,java.awt.Image.SCALE_SMOOTH ); } public void paint(Graphics g) { - ((Graphics2D) g).drawImage(newimg, 0, 0, this); - } - } + ((Graphics2D) g).drawImage(newimg, 0, 0, this); + } + } } \ No newline at end of file diff --git a/UI/org/LYG/GUI/nodeView/cacuString.java b/UI/org/LYG/GUI/nodeView/cacuString.java index 237b620..8fcd141 100644 --- a/UI/org/LYG/GUI/nodeView/cacuString.java +++ b/UI/org/LYG/GUI/nodeView/cacuString.java @@ -3,17 +3,14 @@ public class cacuString { public String cauString(String tr){ String currentstr=new String(""); - if(tr.equals("Node")) - {return null;} + if(tr.equals("Node")){return null;} char[] a = new char[tr.length()]; for(int i=0;i 65535) { + throw new IllegalArgumentException("Invalid port " + port); + } + System.out.println("Export service " + service.getClass().getName() + " on port " + port); + ServerSocket server = new ServerSocket(port); + for(;;) { + try { + final Socket socket = server.accept(); + new Thread(new Runnable() { + @Override + public void run() { + try { + try { + ObjectInputStream input = new ObjectInputStream(socket.getInputStream()); + try { + String methodName = input.readUTF(); + Class[] parameterTypes = (Class[])input.readObject(); + Object[] arguments = (Object[])input.readObject(); + ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream()); + try { + Method method = service.getClass().getMethod(methodName, parameterTypes); + Object result = method.invoke(service, arguments); + output.writeObject(result); + } catch (Throwable t) { + output.writeObject(t); + } finally { + output.close(); + } + } finally { + input.close(); + } + } finally { + socket.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + }).start(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + /** + * 引用服务 + * + * @param 接口泛型 + * @param interfaceClass 接口类型 + * @param host 服务器主机名 + * @param port 服务器端口 + * @return 远程服务 + * @throws Exception + */ + @SuppressWarnings("unchecked") + public static T refer(final Class interfaceClass, final String host, final int port) throws Exception { + if (interfaceClass == null) { + throw new IllegalArgumentException("Interface class == null"); + } + if (! interfaceClass.isInterface()) { + throw new IllegalArgumentException("The " + interfaceClass.getName() + " must be interface class!"); + } + if (host == null || host.length() == 0) { + throw new IllegalArgumentException("Host == null!"); + } + if (port <= 0 || port > 65535) { + throw new IllegalArgumentException("Invalid port " + port); + } + System.out.println("Get remote service " + interfaceClass.getName() + " from server " + host + ":" + port); + return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class[] {interfaceClass}, new InvocationHandler() { + @Override + public Object invoke(Object proxy, Method method, Object[] arguments) throws Throwable { + Socket socket = new Socket(host, port); + try { + ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream()); + try { + output.writeUTF(method.getName()); + output.writeObject(method.getParameterTypes()); + output.writeObject(arguments); + ObjectInputStream input = new ObjectInputStream(socket.getInputStream()); + try { + Object result = input.readObject(); + if (result instanceof Throwable) { + throw (Throwable) result; + } + return result; + } finally { + input.close(); + } + } finally { + output.close(); + } + } finally { + socket.close(); + } + } + }); + } +} + +interface HelloService { + + String hello(String name); + +} + +class HelloServiceImpl implements HelloService { + + @Override + public String hello(String name) { + return "Hello " + name; + } + +} + + class RpcProvider { + + public static void main(String[] args) throws Exception { + HelloService service = new HelloServiceImpl(); + RpcFrameHandler.export(service, 6378); + } + +} + + class RpcConsumer { + + public static void main(String[] args) throws Exception { + HelloService service = RpcFrameHandler.refer(HelloService.class, "127.0.0.1", 6378); + for (int i = 0; i < Integer.MAX_VALUE; i ++) { + String hello = service.hello("World " + i); + System.out.println(hello); + Thread.sleep(1000); + } + } + +} + + diff --git a/plugin/org/cache/devops/utils/SniperSecurity.java b/plugin/org/cache/devops/utils/SniperSecurity.java new file mode 100644 index 0000000..a4e1c95 --- /dev/null +++ b/plugin/org/cache/devops/utils/SniperSecurity.java @@ -0,0 +1,92 @@ +package org.cache.devops.utils; + +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +import javax.crypto.Cipher; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.security.Key; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.SecureRandom; + +public class SniperSecurity { + + private static int KEYSIZE=1024; + + public static void main(String[] args) throws Exception { + + generateKeyPair(); + String source = "sofiabert";//要加密的字符串 + + String cryptograph = encrypt(source);//生成的密文 + System.out.println("encrypt code--->"+cryptograph); + + String target = decrypt(cryptograph);//解密密文 + System.out.println("decrypt code--->"+target); + + + } + + private static void generateKeyPair() throws Exception{ + /** RSA算法要求有一个可信任的随机数源 */ + SecureRandom sr = new SecureRandom(); + /** 为RSA算法创建一个KeyPairGenerator对象 */ + KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); + /** 利用上面的随机数据源初始化这个KeyPairGenerator对象 */ + kpg.initialize(KEYSIZE, sr); + /** 生成密匙对 */ + KeyPair kp = kpg.generateKeyPair(); + /** 得到公钥 */ + Key publicKey = kp.getPublic(); + /** 得到私钥 */ + Key privateKey = kp.getPrivate(); + /** 用对象流将生成的密钥写入文件 */ + ObjectOutputStream oos1 = new ObjectOutputStream(new FileOutputStream("publickey.keystore")); + ObjectOutputStream oos2 = new ObjectOutputStream(new FileOutputStream("privatekey.keystore")); + oos1.writeObject(publicKey); + oos2.writeObject(privateKey); + /** 清空缓存,关闭文件输出流 */ + oos1.close(); + oos2.close(); + } + + public static String encrypt(String source) throws Exception{ + + /** 将文件中的公钥对象读出 */ + ObjectInputStream ois = new ObjectInputStream(new FileInputStream("publickey.keystore")); + Key key = (Key) ois.readObject(); + ois.close(); + /** 得到Cipher对象来实现对源数据的RSA加密 */ + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.ENCRYPT_MODE, key); + byte[] b = source.getBytes(); + /** 执行加密操作 */ + byte[] b1 = cipher.doFinal(b); + BASE64Encoder encoder = new BASE64Encoder(); + return encoder.encode(b1); + } + + public static String decrypt(String cryptograph) throws Exception{ + /** 将文件中的私钥对象读出 */ + ObjectInputStream ois = new ObjectInputStream(new FileInputStream("privatekey.keystore")); + Key key = (Key) ois.readObject(); + /** 得到Cipher对象对已用公钥加密的数据进行RSA解密 */ + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.DECRYPT_MODE, key); + BASE64Decoder decoder = new BASE64Decoder(); + byte[] b1 = decoder.decodeBuffer(cryptograph); + /** 执行解密操作 */ + byte[] b = cipher.doFinal(b1); + return new String(b); + } + + + + + + +} diff --git a/plugin/org/cache/devops/utils/SocketRequestHandler.java b/plugin/org/cache/devops/utils/SocketRequestHandler.java new file mode 100644 index 0000000..6645979 --- /dev/null +++ b/plugin/org/cache/devops/utils/SocketRequestHandler.java @@ -0,0 +1,82 @@ +package org.cache.devops.utils; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.URLEncoder; + + +public class SocketRequestHandler { + + private int port=6379; + private String host="127.0.0.1"; + private Socket socket; + private BufferedReader bufferedReader; + private BufferedWriter bufferedWriter; + + + public void sendGet(String path) throws IOException + { +// String path = "/devopsCache"; + SocketAddress dest = new InetSocketAddress(this.host, this.port); + socket.connect(dest); + OutputStreamWriter streamWriter = new OutputStreamWriter(socket.getOutputStream()); + bufferedWriter = new BufferedWriter(streamWriter); + + bufferedWriter.write("GET " + path + " HTTP/1.1\r\n"); + bufferedWriter.write("Host: " + this.host + "\r\n"); + bufferedWriter.write("\r\n"); + bufferedWriter.flush(); + + BufferedInputStream streamReader = new BufferedInputStream(socket.getInputStream()); + bufferedReader = new BufferedReader(new InputStreamReader(streamReader, "utf-8")); + String line = null; + while((line = bufferedReader.readLine())!= null) + { + System.out.println(line); + } + bufferedReader.close(); + bufferedWriter.close(); + socket.close(); + } + + public void sendPost(String path,String ip, String port,String email, String password) throws IOException + { +// String path = "/put"; + String data = URLEncoder.encode(email, "utf-8") + "=" + URLEncoder.encode(password, "utf-8") + "&" + + URLEncoder.encode(ip, "utf-8") + "=" + URLEncoder.encode(port, "utf-8"); + // String data = "name=zhigang_jia"; + SocketAddress dest = new InetSocketAddress(this.host, this.port); + socket.connect(dest); + OutputStreamWriter streamWriter = new OutputStreamWriter(socket.getOutputStream(), "utf-8"); + bufferedWriter = new BufferedWriter(streamWriter); + + bufferedWriter.write("POST " + path + " HTTP/1.1\r\n"); + bufferedWriter.write("Host: " + this.host + "\r\n"); + bufferedWriter.write("Content-Length: " + data.length() + "\r\n"); + bufferedWriter.write("Content-Type: application/x-www-form-urlencoded\r\n"); + bufferedWriter.write("\r\n"); + bufferedWriter.write(data); + bufferedWriter.flush(); + bufferedWriter.write("\r\n"); + bufferedWriter.flush(); + + BufferedInputStream streamReader = new BufferedInputStream(socket.getInputStream()); + bufferedReader = new BufferedReader(new InputStreamReader(streamReader, "utf-8")); + String line = null; + while((line = bufferedReader.readLine())!= null) + { + System.out.println(line); + } + bufferedReader.close(); + bufferedWriter.close(); + socket.close(); + } + +} diff --git a/src/org/vpcs/boot/App.java b/src/org/vpcs/boot/App.java deleted file mode 100644 index 9a9fd93..0000000 --- a/src/org/vpcs/boot/App.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.vpcs.boot; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import javax.swing.JApplet; -public class App extends JApplet implements MouseListener, KeyListener{ - private static final long serialVersionUID = 1L; - public void init(){ - } - - @Override - public void keyPressed(KeyEvent arg0) { - } - @Override - public void keyReleased(KeyEvent arg0) { - - } - @Override - public void keyTyped(KeyEvent arg0) { - - } - @Override - public void mouseClicked(MouseEvent e) { - - } - @Override - public void mouseEntered(MouseEvent e) { - - } - @Override - public void mouseExited(MouseEvent e) { - - } - @Override - public void mousePressed(MouseEvent e) { - - } - @Override - public void mouseReleased(MouseEvent e) { - - } -} diff --git a/src/org/vpcs/boot/Application.java b/src/org/vpcs/boot/Application.java index 615a5df..dfe6d15 100644 --- a/src/org/vpcs/boot/Application.java +++ b/src/org/vpcs/boot/Application.java @@ -5,7 +5,7 @@ import GUIBuild.GUIsample3; public class Application{ public static GUIsample3 NE; - @SuppressWarnings({"deprecation", "resource", "unused"}) + @SuppressWarnings({"deprecation"}) public static void main(String args[]) throws Exception{ NE = new GUIsample3(); JFrame frame = new JFrame("VPCS Դάܹ"); diff --git a/testconnection.png b/testconnection.png new file mode 100644 index 0000000..7735526 Binary files /dev/null and b/testconnection.png differ