Package jp.co.smg.endosnipe.javassist

Examples of jp.co.smg.endosnipe.javassist.CtMethod


        if (behaviorList.size() > 0)
        {
            CtField field = CtField.make("private long createTimeJvn;", ctClass);
            ctClass.addField(field);

            CtMethod getServerInfoMethod = CtMethod.make("" + //
                    "public long getCreateTimeJvn(){ " + //
                    "        return this.createTimeJvn;" + //
                    "}", ctClass);
            ctClass.addMethod(getServerInfoMethod);
           
View Full Code Here


        {
            // �C���^�[�t�F�[�X�̒lj�
            CtClass accessorClass = getClassPool().get(FSNamesystemAccessor.class.getName());
            ctClass.addInterface(accessorClass);

            CtMethod getServerInfoMethod = CtMethod.make("" + //
                    "public java.util.List resolve(java.util.List names){ " + //
                    "        return this.dnsToSwitchMapping.resolve(names);" + //
                    "}", ctClass);
            ctClass.addMethod(getServerInfoMethod);

            CtMethod getHLCapacityRemainingMethod = CtMethod.make("" + //
                    "public long getHLCapacityRemaining(){ " + //
                    "        return this.getCapacityRemaining();" + //
                    "}", ctClass);
            ctClass.addMethod(getHLCapacityRemainingMethod);

            CtMethod getHLCapacityUsedMethod = CtMethod.make("" + //
                    "public long getHLCapacityUsed(){ " + //
                    "        return this.getCapacityUsed();" + //
                    "}", ctClass);
            ctClass.addMethod(getHLCapacityUsedMethod);

            CtMethod getDfsNodeInfoMethod = CtMethod.make("" + //
                "public java.util.Map getDfsNodeInfo() {" + //
                "" + //
                "  java.util.Map info = new jp.co.acroquest.endosnipe.javelin.util.HashMap();" + //
                "  java.util.List aliveNodeList = this" + //
                "      .getDatanodeListForReport(org.apache.hadoop.hdfs.protocol.FSConstants.DatanodeReportType.LIVE);" + //
View Full Code Here

      CtClass accessorClass = getClassPool().get(
          HMasterAccessor.class.getName());

      // HServerInfo���AHBase�̃N���X����AJavelin�p�N���X�ɕϊ�����B
      // RegionLoad�ɂ‚��Ă͖��Ή��B
      CtMethod convertServerInfoMethod = CtMethod
          .make(""
              + "public jp.co.acroquest.endosnipe.javelin.converter.hbase.monitor.HServerInfo convertServerInfo(org.apache.hadoop.hbase.HServerInfo inputInfo) { "
              + "            jp.co.acroquest.endosnipe.javelin.converter.hbase.monitor.HServerInfo info ="
              + "                                                                                         new jp.co.acroquest.endosnipe.javelin.converter.hbase.monitor.HServerInfo();"
              + "            info.setServerAddress(inputInfo.getServerAddress().getInetSocketAddress());"
              + "            info.setStartCode(inputInfo.getStartCode());"
              + "" //
              + "            org.apache.hadoop.hbase.HServerLoad inputLoad = inputInfo.getLoad();"
              + "            jp.co.acroquest.endosnipe.javelin.converter.hbase.monitor.HServerLoad load ="
              + "                                                                                         new jp.co.acroquest.endosnipe.javelin.converter.hbase.monitor.HServerLoad();"
              + "" //
              + "            load.setMaxHeapMB(inputLoad.getMaxHeapMB());"
              + "            load.setUsedHeapMB(inputLoad.getUsedHeapMB());"
              + "            load.setNumberOfRegions(inputLoad.getNumberOfRegions());"
              + "            load.setNumberOfRequests(inputLoad.getNumberOfRequests());"
              + "            info.setLoad(load); " //
              + "            info.setInfoPort(inputInfo.getInfoPort());"
              + "            info.setServerName(inputInfo.getServerName());"
              + "            info.setHostname(inputInfo.getHostname());"
              + "        return info;" + //
              "}", ctClass);
      ctClass.addMethod(convertServerInfoMethod);

      ctClass.addInterface(accessorClass);

      CtMethod getServerInfoMethod = CtMethod
          .make(""
              + "public java.util.Map getServerInfo(){ "
              + "        java.util.Map resMap ="
              + "                                  new jp.co.acroquest.endosnipe.javelin.util.HashMap();"
              + "        java.util.Map inputMap ="
              + "                                  this.serverManager.getOnlineServers();"
              + ""
              + "        java.util.Iterator it = inputMap.entrySet().iterator();"
              + "        while (it.hasNext())"
              + "        {" //
              + "            java.util.Map.Entry inputInfoEntry = (java.util.Map.Entry)it.next();"
              + "            jp.co.acroquest.endosnipe.javelin.converter.hbase.monitor.HServerInfo info = convertServerInfo((org.apache.hadoop.hbase.HServerInfo)inputInfoEntry.getValue());"
              + "            " //
              + "            resMap.put(inputInfoEntry.getKey(), info);"
              + "        }" //
              + "        " //
              + "        return (resMap);" //
              + "}", ctClass);
      ctClass.addMethod(getServerInfoMethod);

      CtMethod getDeadServerInfoMethod = CtMethod
          .make(""
              + "public java.util.Set getDeadServerInfo(){ "
              + "        java.util.Set deadServers ="
              + "                                  this.serverManager.getDeadServers();"
              + "        return (deadServers);" + //
              "}", ctClass);
      ctClass.addMethod(getDeadServerInfoMethod);

      CtField hBaseAdminField = CtField
          .make("private org.apache.hadoop.hbase.client.HBaseAdmin ensHBaseAdmin;",
              ctClass);
      ctClass.addField(hBaseAdminField);

      CtMethod getListTablesMethod = CtMethod
          .make(""
              + "    public java.util.List listTables()"
              + "    {"
              + "        try"
              + "        {"
              + "            if (ensHBaseAdmin == null) {"
              + "                ensHBaseAdmin = new org.apache.hadoop.hbase.client.HBaseAdmin(this.getConfiguration());"
              + "            }"
              + "        }"
              + "        catch (java.lang.Exception ex)"
              + "        {"
              + "            "
              + "        }"
              + "        java.util.List tableList = new java.util.ArrayList();"
              + "        try"
              + "        {"
              + "            org.apache.hadoop.hbase.HTableDescriptor[] listTables = ensHBaseAdmin.listTables();"
              + "            for (int index = 0; index < listTables.length; index++)"
              + "            {"
              + "                jp.co.acroquest.endosnipe.javelin.converter.hbase.monitor.HTableDescriptor ensDescriptor ="
              + "                                                                                                           new jp.co.acroquest.endosnipe.javelin.converter.hbase.monitor.HTableDescriptor();"
              + ""
              + "                ensDescriptor.setName(listTables[index].getName());"
              + "                ensDescriptor.setNameAsString(listTables[index].getNameAsString());"
              + "                tableList.add(ensDescriptor);"
              + "            }"
              + "        }" //
              + "        catch (java.lang.Exception ex)"
              + "        {" //
              + "            ex.printStackTrace();" //
              + "        }" //
              + "        return tableList;" //
              + "" //
              + "    }", ctClass);
      ctClass.addMethod(getListTablesMethod);

      CtMethod getRegionsOfTableMethod = CtMethod
          .make(""
              + "    public int getRegionsOfTable(byte[] name)"
              + "    {" //
              + "        java.util.List regionsOfTable = this.assignmentManager.getRegionsOfTable(name);"
              + "        return regionsOfTable.size();" //
              + "    }", ctClass);
      ctClass.addMethod(getRegionsOfTableMethod);

      CtMethod getAssignmentsMethod = CtMethod
          .make(""
              + "    public java.util.Map getAssignments()"
              + "    {" //
              + "        java.util.Map resultMap = new jp.co.acroquest.endosnipe.javelin.util.HashMap();"
              + "        java.util.Map inputMap = this.assignmentManager.getAssignments();"
View Full Code Here

TOP

Related Classes of jp.co.smg.endosnipe.javassist.CtMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.