软件著作权-代码

上传人:jiups****uk12 文档编号:48510433 上传时间:2018-07-16 格式:DOC 页数:54 大小:537.50KB
返回 下载 相关 举报
软件著作权-代码_第1页
第1页 / 共54页
软件著作权-代码_第2页
第2页 / 共54页
软件著作权-代码_第3页
第3页 / 共54页
软件著作权-代码_第4页
第4页 / 共54页
软件著作权-代码_第5页
第5页 / 共54页
点击查看更多>>
资源描述

《软件著作权-代码》由会员分享,可在线阅读,更多相关《软件著作权-代码(54页珍藏版)》请在金锄头文库上搜索。

1、Option.java package mon; public class Option private String name; private String id; private String description; private OptionGroup group; public Option(String id, String name, String description,OptionGroup group) this.id = id; this.name = name; this.description = description; this.group = group;

2、public String getName() return name; public String getId() return id; public String getDescription() return description.replaceAll(“t“, “).trim(); public OptionGroup getGroup() return this.group; OptionGroup.java package mon;import java.util.ArrayList; import java.util.List;import cn.edu.uestc.ablat

3、or.ui.util.XmlParser; /* 选项组* author Administrator*/ public class OptionGroup private String id; private String name; private List optionList;public OptionGroup(String id, String name) this.id = id; this.name = name; this.optionList = new ArrayList(); public void addOption(Option o) if(optionList!=n

4、ull) optionList.add(o); public String getGroupPlaceHolder() return XmlParser.getInstance().getGroupPlaceholder(id); public String getName() return this.name; public List getOptionList() return this.optionList; ProjectType.java package mon;/* 工程类型枚举* author Administrator*/ public enum ProjectType /*

5、普通工程*/ COMMOMAPPLICATION(“commonApplication“),/* 解决方案*/ SOLUTION(“solution“),/* 模块程序*/ MODULE(“module“),/* 原子库*/ ATOM(“atom“);private String name;ProjectType(String name) this.name = name; public String getName() return this.name; Activator.java package cn.edu.uestc.ablator.ui;import org.eclipse.ui.

6、plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext;/* The activator class controls the plug-in life cycle*/ public class Activator extends AbstractUIPlugin / The plug-in ID public static final String PLUGIN_ID = “cn.edu.uestc.ablator.ui“;/ The shared instance private static Activator p

7、lugin;/* The constructor*/ public Activator() /* (non-Javadoc)* see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)*/ public void start(BundleContext context) throws Exception super.start(context); plugin = this; /* (non-Javadoc)* see org.eclipse.ui.plugin.AbstractUIPl

8、ugin#stop(org.osgi.framework.BundleContext)*/ public void stop(BundleContext context) throws Exception plugin = null; super.stop(context); /* Returns the shared instance* return the shared instance*/ public static Activator getDefault() return plugin; ClientSocket.java package working;import java.io

9、.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import .Socket; import .SocketTimeoutException; import .UnknownHostException;import org.apache.log4j.Logger;import cn.edu.uestc.ablator.ui.util.

10、MessageConfig;class ClientSocket private Logger logger = Logger.getLogger(MessageConfig.LOGGER_NAME);private String ip;private int port;private Socket socket;private ObjectOutputStream outputStream;private ObjectInputStream inputStream;public ClientSocket(String ip, int port) this.ip = ip;this.port

11、= port;/* 连接服务器* return 连接成功返回 true 否则返回 false* throws IOException * throws UnknownHostException */public boolean connect() throws UnknownHostException, IOException try boolean success = false; socket = new Socket(ip, port); /设置 read 超时 socket.setSoTimeout(NetworkingConfig.TIME_OUT); success = true;

12、 return success; catch(IOException e) throw new IOException(“无法连接服务器,请检查端口和服务器地址“); /* 发送消息到服务器* param message* return 发送成功返回 true 否则返回 false*/public void sendMessage(Message message)throws IOExceptiontry outputStream = new ObjectOutputStream(new BufferedOutputStream(socket.getOutputStream();outputS

13、tream.writeObject(message);outputStream.flush();catch (IOException e) if(outputStream != null)try outputStream.close(); catch (IOException ioe) logger.error(“关闭输出流失败“);throw new IOException(“发送消息:“+message+“ 失败“);/* 从服务器接受消息* return 成功接受返回接受到的消息,否则返回 null* throws SocketTimeoutException */public Mess

14、age receiveMessage() throws SocketTimeoutExceptionMessage receiveMessage = null;try inputStream = new ObjectInputStream(new BufferedInputStream(socket.getInputStream(); receiveMessage = (Message)inputStream.readObject(); catch(SocketTimeoutException e) throw new SocketTimeoutException(“读取数据超时“); cat

15、ch (ClassCastException e) logger.error(“ClassCastException 从服务器读取的数据不能转换为 Message“); catch (IOException ioe) logger.error(ioe.getMessage(); catch (ClassNotFoundException e) logger.error(e.getMessage(); return receiveMessage;/* 关闭连接* throws IOException */public void shutdownConnection() throws IOException if (outputStream != null)outputStream.close();if (inputStream != null)inputStream.close();if (socket != null)socket.close();Downloader.java package working;import java.io.File; import java.i

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号