List of usage examples for java.lang Exception getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:com.clustercontrol.performance.util.code.CollectorItemCodeTable.java
/** * ??facilityId?????????ID????/*from w w w. j a v a 2 s . co m*/ * * @param facilityId * @return * @throws HinemosUnknown */ private static Set<CollectorItemCodeMstData> getEnableCodeSet(String facilityId) throws HinemosUnknown { m_log.debug("getEnableCodeSet() facilityId = " + facilityId); // ID????????????????? Set<CollectorItemCodeMstData> enableItemCodeSetInEveryNode = null; // ID????NULL????????? if (facilityId == null || "".equals(facilityId)) { m_log.debug("getEnableCodeSet() codeSet is 0"); return enableItemCodeSetInEveryNode; } try { // ???SessionBean RepositoryControllerBean bean = new RepositoryControllerBean(); //// // ??? //// List<String> nodeList = null; if (bean.isNode(facilityId)) { // ??? m_log.debug("getEnableCodeSet() facilityId is node"); // ?? nodeList = new ArrayList<String>(); nodeList.add(facilityId); } else { // ??? m_log.debug("getEnableCodeSet() facilityId is scope"); // ??????ID?? nodeList = bean.getNodeFacilityIdList(facilityId, null, RepositoryControllerBean.ALL); } //// // ???????ID? //// Set<PlatformIdAndSubPlatformId> platformSet = new HashSet<PlatformIdAndSubPlatformId>(); for (String nodeId : nodeList) { m_log.debug("getEnableCodeSet() target node = " + nodeId); NodeInfo node = bean.getNode(nodeId); platformSet .add(new PlatformIdAndSubPlatformId(node.getPlatformFamily(), node.getSubPlatformFamily())); } //// // ?????????ID?? //// for (PlatformIdAndSubPlatformId platform : platformSet) { if (m_log.isDebugEnabled()) { m_log.debug("getEnableCodeSet() " + "platformId = " + platform.getPlatformId() + ", subPlatformId = " + platform.getSubPlatformId()); } // ??????? Collection<CollectorCategoryCollectMstEntity> collects; // ???????? List<CollectorItemCalcMethodMstEntity> calsMethods; try { collects = QueryUtil.getCollectorCategoryCollectMstByPlatformIdSubPlatformId( platform.getPlatformId(), platform.getSubPlatformId()); calsMethods = QueryUtil.getCollectorItemCalcMethodMstByPlatformIdSubPlatformId( platform.getPlatformId(), platform.getSubPlatformId()); if (m_log.isDebugEnabled()) { m_log.debug("getEnableCodeSet() " + "platformId = " + platform.getPlatformId() + ", subPlatformId = " + platform.getSubPlatformId() + ", CollectorCategoryCollectMstEntity size = " + collects.size() + ", CollectorItemCalcMethodMstEntity size = " + calsMethods.size()); } // VM??????????????????????? // ???????? ????????? if (!platform.getSubPlatformId().isEmpty()) { Collection<CollectorCategoryCollectMstEntity> physicalCollects = QueryUtil .getCollectorCategoryCollectMstByPlatformIdSubPlatformId(platform.getPlatformId(), ""); Collection<CollectorItemCalcMethodMstEntity> physicalCalsMethods = QueryUtil .getCollectorItemCalcMethodMstByPlatformIdSubPlatformId(platform.getPlatformId(), ""); collects.addAll(physicalCollects); calsMethods.addAll(physicalCalsMethods); if (m_log.isDebugEnabled()) { m_log.debug("getEnableCodeSet() " + "platformId = " + platform.getPlatformId() + ", physical platform, " + ", CollectorCategoryCollectMstEntity size = " + physicalCollects.size() + ", CollectorItemCalcMethodMstEntity size = " + physicalCalsMethods.size()); } } } catch (Exception e) { m_log.warn("getEnableCodeSet() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); return null; } // categoryCode?collectMethod?? HashMap<String, String> categoryMap = new HashMap<String, String>(); for (CollectorCategoryCollectMstEntity collect : collects) { m_log.debug("getEnableCodeSet() add map categoryCode = " + collect.getId().getCategoryCode() + ", collectMethod = " + collect.getCollectMethod()); categoryMap.put(collect.getId().getCategoryCode(), collect.getCollectMethod()); } // ????????????Set HashSet<CollectorItemCodeMstData> enableItemCodeSetByPlatform = new HashSet<CollectorItemCodeMstData>(); // ???????????????????????? for (CollectorItemCalcMethodMstEntity calcBean : calsMethods) { CollectorItemCodeMstData codeBean; try { m_log.debug("getEnableCodeSet() search itemCode = " + calcBean.getId().getItemCode()); codeBean = CollectorMasterCache.getCategoryCodeMst(calcBean.getId().getItemCode()); if (codeBean == null) { // ??????? m_log.warn("getEnableCodeSet() codeBean is null. id = " + calcBean.getId()); return null; } } catch (Exception e) { m_log.warn("getEnableCodeSet() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); return null; } // ????????????? // ??????????Set?? if (categoryMap.get(codeBean.getCategoryCode()) != null && categoryMap .get(codeBean.getCategoryCode()).equals(calcBean.getId().getCollectMethod())) { // ??DTO? CollectorItemCodeMstData codeData = new CollectorItemCodeMstData(codeBean.getItemCode(), codeBean.getCategoryCode(), codeBean.getParentItemCode(), codeBean.getItemName(), codeBean.getMeasure(), codeBean.isDeviceSupport(), codeBean.getDeviceType(), codeBean.isGraphRange()); m_log.debug("getEnableCodeSet() add itemCode = " + calcBean.getId().getItemCode()); enableItemCodeSetByPlatform.add(codeData); } } // ???????????????AND? // ???????????????????? // ??????????????????? // ???????AND?set.retainAll // ?????????????????????????? if (enableItemCodeSetInEveryNode == null) { m_log.debug("getEnableCodeSet() enableCodeSetInEveryNode is null"); enableItemCodeSetInEveryNode = enableItemCodeSetByPlatform; } enableItemCodeSetInEveryNode.retainAll(enableItemCodeSetByPlatform); m_log.debug("getEnableCodeSet() enableCodeSetInEveryNode size = " + enableItemCodeSetInEveryNode.size()); } } catch (FacilityNotFound e) { m_log.debug("getEnableCodeSet " + facilityId); } catch (HinemosUnknown e) { throw e; } catch (Exception e) { m_log.warn("getEnableCodeSet() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e); throw new HinemosUnknown(e.getMessage(), e); } // 1??????0?Set? if (enableItemCodeSetInEveryNode == null) { enableItemCodeSetInEveryNode = new HashSet<CollectorItemCodeMstData>(); } return enableItemCodeSetInEveryNode; }
From source file:com.revorg.goat.IndexManager.java
/** * unregisters a collection and deletes its directories. * * @param indexPath Directory that contains the Lucene Collection * @throws Exception// w w w.j a v a2 s .com * @return ActionResult */ public static String deleteIndex(String indexPath) { //Cast To Directory File theDir = new File(indexPath); //Convert String To File try { IndexReader reader = IndexReader.open(indexPath); boolean indexExists = reader.indexExists(indexPath); reader.close(); //Close Index //if (theDir.exists() != stringFails) if (theDir.exists()) { FileUtils.deleteDirectory(theDir); ActionResult = "Success"; return ActionResult; } else { ActionResult = "Failure to delete index: " + indexPath; return ActionResult; } } catch (Exception e) { ActionResultError = " caught a " + e.getClass() + " with message: " + e.getMessage(); System.out.println("Failure to delete index: " + indexPath); } ActionResult = "Failure"; return ActionResult + ActionResultError; }
From source file:model.SQLiteModel.java
public static void setConnection() { try {// ww w.j a v a2 s.c om SQLiteConfig config = new SQLiteConfig(); config.enforceForeignKeys(true); Class.forName(DRIVER); c = DriverManager.getConnection(DB_URL, config.toProperties()); } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.exit(0); } System.out.println("Opened database successfully"); }
From source file:com.revorg.goat.IndexManager.java
/** * Returns the list of index types that can be used by GOAT. * * @throws Exception//www . ja va2s . c om * @return ActionResult */ public static List getIndexTypes() { try { // Create the list List list = new LinkedList(); // Doubly-linked list list = new ArrayList(); // List implemented as growable array // Append an element to the list list.add("PrimaryKey"); list.add("Date"); list.add("TriggerUpdate"); list.add("TriggerDelete"); list.add("Keyword"); list.add("UnIndexed"); list.add("Binary"); list.add("Text"); list.add("UnStored"); list.add("HTML"); return list; } catch (Exception e) { ActionResultError = " caught a " + e.getClass() + " with message: " + e.getMessage(); System.out.println("Failure to optimize index: "); } ActionResult = "Failure"; return new LinkedList(); }
From source file:com.revorg.goat.IndexManager.java
/** * Create a Lucene Index./*from w ww .j av a 2 s . c om*/ * * @param indexPath Directory that contains the Lucene Collection * @throws Exception * @return ActionResult */ public static String createIndex(String indexPath) { File theDir = new File(indexPath); // if the directory does not exist, create it try { //if the directory exist, do not create it if (theDir.exists()) { System.out.println("Failure to create index: " + indexPath); System.out.println("The index/directory already exists:"); ActionResult = "Failure"; return ActionResult + ActionResultError; } //StandardAnalyzer new StandardAnalyzer() = new StandardAnalyzer(); //Initialize Class IndexWriter writer = new IndexWriter(indexPath, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED); writer.close(); ActionResult = "Success"; return ActionResult; } catch (Exception e) { ActionResultError = " caught a " + e.getClass() + " with message: " + e.getMessage(); System.out.println("Failure to create index: " + indexPath); } ActionResult = "Failure"; return ActionResult + ActionResultError; }
From source file:model.SQLiteModel.java
public static Object[][] getMSynonyms(int metadatumID) { String query = "SELECT (SELECT metadatum FROM metadata WHERE metadatum2=metadatumId) as synonym, metadatum2 " + "FROM metadata_synonyms WHERE metadatum1=" + metadatumID; List<Map<String, String>> data = select(query); Object[][] tableData = null;// www. j a v a2 s . c o m try { tableData = new Object[data.size()][2]; for (int i = 0; i < data.size(); i++) { tableData[i][0] = data.get(i).get("synonym"); tableData[i][1] = Integer.parseInt(data.get(i).get("metadatum2")); } } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); } return tableData; }
From source file:model.SQLiteModel.java
public static Object[][] getSynonyms(int conceptID) { String query = "SELECT (SELECT concept FROM concepts WHERE concept2Id=conceptId) as synonym, concept2Id " + "FROM concept_synonyms WHERE concept1Id=" + conceptID; List<Map<String, String>> data = select(query); Object[][] tableData = null;//from w w w.j a va 2 s.com try { tableData = new Object[data.size()][2]; for (int i = 0; i < data.size(); i++) { tableData[i][0] = data.get(i).get("synonym"); tableData[i][1] = Integer.parseInt(data.get(i).get("concept2Id")); } } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); } return tableData; }
From source file:model.SQLiteModel.java
public static Object[][] getConcepts() { String query = "SELECT * FROM concepts"; List<Map<String, String>> data = select(query); Object[][] tableData = null;/*from ww w . java 2 s . co m*/ try { tableData = new Object[data.size()][3]; for (int i = 0; i < data.size(); i++) { tableData[i][0] = Integer.parseInt(data.get(i).get("conceptId")); tableData[i][1] = data.get(i).get("concept"); tableData[i][2] = data.get(i).get("concept_type"); } } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); } return tableData; }
From source file:model.SQLiteModel.java
public static Object[][] getMGeneralizations(int metadatumID) { String query = "SELECT generalization, (" + "SELECT count(metadatumId) " + "FROM metadata_generalizations as g2 WHERE g2.generalization=g1.generalization) as frequency " + "FROM metadata_generalizations as g1 WHERE metadatumId=" + metadatumID; List<Map<String, String>> data = select(query); Object[][] tableData = null;/* ww w .j av a2s .c o m*/ try { tableData = new Object[data.size()][2]; for (int i = 0; i < data.size(); i++) { tableData[i][0] = data.get(i).get("generalization"); tableData[i][1] = Integer.parseInt(data.get(i).get("frequency")); } } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); } return tableData; }
From source file:model.SQLiteModel.java
public static Object[][] getGeneralizations(int conceptID) { String query = "SELECT generalization, (" + "SELECT count(conceptId) " + "FROM concept_generalizations as g2 WHERE g2.generalization=g1.generalization) as frequency " + "FROM concept_generalizations as g1 WHERE conceptId=" + conceptID; List<Map<String, String>> data = select(query); Object[][] tableData = null;//from w ww . j a v a 2 s . c o m try { tableData = new Object[data.size()][2]; for (int i = 0; i < data.size(); i++) { tableData[i][0] = data.get(i).get("generalization"); tableData[i][1] = Integer.parseInt(data.get(i).get("frequency")); } } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); } return tableData; }