📄 localcommunicationhandlerimpl.java
字号:
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Created on Jun 6, 2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package eti.bi.alphaminer.core.handler;
import eti.bi.alphaminer.core.storage.BCB;
import eti.bi.alphaminer.core.storage.BCBLocalBindingImpl;
import eti.bi.alphaminer.core.storage.BCR;
import eti.bi.alphaminer.core.storage.BCRLocalBindingImpl;
import eti.bi.alphaminer.vo.BICase;
import eti.bi.alphaminer.vo.CaseInfoList;
import eti.bi.alphaminer.vo.Node;
import eti.bi.alphaminer.vo.Result;
import eti.bi.alphaminer.vo.SearchCriteria;
import eti.bi.alphaminer.vo.SearchedCaseInfoList;
import eti.bi.exception.AppException;
import eti.bi.exception.BaseException;
import eti.bi.exception.SysException;
/**
* @author twang
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class LocalCommunicationHandlerImpl implements ICommunicationHandler {
private BCR m_BCR;
private BCB m_BCB;
/**
* Constructs a CommunicationHandler
*/
protected LocalCommunicationHandlerImpl() {
m_BCR = new BCRLocalBindingImpl();
m_BCB = new BCBLocalBindingImpl();
}
/**
* Change password of an existing user account.
* @param a_Username user name of the account
* @param a_HashedOldPassword hashed old password of the account
* @param a_HashedNewPassword hashed new password of the account
* @return true if password is changed successfully; false otherwise
*/
public boolean changePassword(
String a_Username,
String a_HashedOldPassword,
String a_HashedNewPassword) {
return false;
}
/**
* Connect to the KBBI server.
*/
public void connect() {
}
/**
* Discounnt from the KBBI server
*/
public void disconnect() {
}
/**
* Executes a node contained in a case.
* @param a_Node node to be executed
* @return a Result of the execution results
*/
public Result executeNode(Node a_Node) {
return null;
}
/**
* Retrive a case from the KBBI server.
* @param a_CaseID ID of the case to be retrieved
* @return a Case
*/
public BICase getCase(String a_CaseID) throws BaseException {
Object[] obj = { a_CaseID };
try {
BICase aCase = m_BCR.getCase(a_CaseID);
return aCase;
} catch (Exception e) {
Throwable throwable = e.getCause();
if (throwable instanceof BaseException) {
BaseException be = (BaseException) throwable;
//System.out.println(be.getMessage());
throw new AppException(be, obj);
} else {
e.printStackTrace();
throw new SysException(e, obj);
}
}
}
/**
* Gets a list of case information of all cases stored in the DBBI server
* @return a CaseInfoList
*/
public CaseInfoList getCaseInfoList() {
try {
CaseInfoList list = m_BCR.getCaseInfoList();
return list;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* Checks current connection status to the KBBI server.
* @return true if it is currently connecting to the server; false otherwise
*/
public boolean isConnected() {
return false;
}
public String login(String a_Username, String a_HashedPassword) {
return "";
}
/**
* Removes a case from the KBBI server.
* @param a_CaseID ID of the case to be removed
* @return true if the case is removed successfully; false otherwise
*/
public boolean removeCase(String a_CaseID) {
try {
m_BCB.removeCase(a_CaseID);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* Search cases that match the specific searching criteria in the KBBI server.
* @param a_SearchCriteria a SearchCriteria object stores the searching
* criteria
* @param a_Threshold a threshold used to identify valid searched cases
* @return a list of searched case information
*/
public SearchedCaseInfoList searchCase(
SearchCriteria a_SearchCriteria,
double a_Threshold) {
try {
SearchedCaseInfoList list =
m_BCR.searchCase(a_SearchCriteria, a_Threshold);
return list;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* Sets status of a Case.
* @param a_CaseID ID of the case to be set.
* @param a_Status status of the case.
*/
public void setCaseStatus(String a_CaseID, String a_Status) {
try {
m_BCB.setCaseStatus(a_CaseID, a_Status);
} catch (Exception e) {
e.printStackTrace();
return;
}
}
/**
* Stores a case into the KBBI server.
* @param a_Case case to be stored
* @return ID of the case
*/
public String storeCase(BICase a_Case) {
try {
//System.out.println("Case is: " + a_Case.getStatus());
BCB aBCB = new BCBLocalBindingImpl();
return aBCB.storeCase(a_Case);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -