Examples of AppData


Examples of com.dianping.cat.broker.api.app.AppData

  private void processOneRecord(int cityId, int operatorId, String record) {
    String items[] = record.split("\t");

    if (items.length == 10) {
      AppData appData = new AppData();

      try {
        String url = URLDecoder.decode(items[4], "utf-8").toLowerCase();
        Integer command = m_appConfigManager.getCommands().get(url);

        if (command != null) {
          // appData.setTimestamp(Long.parseLong(items[0]));
          appData.setTimestamp(System.currentTimeMillis());
          appData.setCommand(command);
          appData.setNetwork(Integer.parseInt(items[1]));
          appData.setVersion(Integer.parseInt(items[2]));
          appData.setConnectType(Integer.parseInt(items[3]));
          appData.setCode(Integer.parseInt(items[5]));
          appData.setPlatform(Integer.parseInt(items[6]));
          appData.setRequestByte(Integer.parseInt(items[7]));
          appData.setResponseByte(Integer.parseInt(items[8]));
          appData.setResponseTime(Integer.parseInt(items[9]));
          appData.setCity(cityId);
          appData.setOperator(operatorId);
          appData.setCount(1);

          int responseTime = appData.getResponseTime();

          if (responseTime < 60 * 1000 && responseTime >= 0) {
            offerQueue(appData);

            Cat.logEvent("Command", url, Event.SUCCESS, null);
          } else if (responseTime > 0) {
            Integer tooLong = m_appConfigManager.getCommands().get(TOO_LONG);

            if (tooLong != null) {
              appData.setCommand(tooLong);
              offerQueue(appData);
            }
            Cat.logEvent("ResponseTooLong", url, Event.SUCCESS, String.valueOf(responseTime));
          } else {
            Cat.logEvent("ResponseTimeError", url, Event.SUCCESS, String.valueOf(responseTime));
View Full Code Here

Examples of org.apache.fulcrum.intake.xmlmodel.AppData

     */
    public Group getGroup(String groupName) throws IntakeException
    {
        Group group = null;

        AppData appData = (AppData) groupNames.get(groupName);

        if (groupName == null)
        {
            throw new IntakeException(
                    "Intake IntakeServiceImpl.getGroup(groupName) is null");
View Full Code Here

Examples of org.apache.torque.engine.database.model.AppData

     * @throws ParseException error parsing the input file
     */
    public AppData execute() throws IOException, ParseException
    {
        count = 0;
        appData = new AppData(databaseType, basePropsFilePath);
        appDataDB = new Database();
        appData.addDatabase(appDataDB);

        FileReader fr = new FileReader(sqlFile);
        BufferedReader br = new BufferedReader(fr);
View Full Code Here

Examples of org.apache.torque.engine.database.model.AppData

     * @throws Exception an exception
     */
    public static void main(String args[]) throws Exception
    {
        SQLToAppData s2a = new SQLToAppData(args[0]);
        AppData ad = s2a.execute();
        System.out.println(ad);
    }
View Full Code Here

Examples of org.apache.torque.engine.database.model.AppData

        try
        {
            log("Parsing SQL Schema", Project.MSG_INFO);

            SQLToAppData sqlParser = new SQLToAppData(inputFile);
            AppData app = sqlParser.execute();

            log("Preparing to write xml schema", Project.MSG_INFO);
            FileWriter fr = new FileWriter(outputFile);
            BufferedWriter br = new BufferedWriter (fr);

            br.write(app.toString());

            log("Writing xml schema", Project.MSG_INFO);

            br.flush();
            br.close();
View Full Code Here

Examples of org.apache.torque.engine.database.model.AppData

            {
                // Transform the XML database schema into
                // data model object.
                xmlParser = new XmlToAppData(getTargetDatabase(),
                        getTargetPackage(), getBasePathToDbProps());
                AppData ad = xmlParser.parseFile(xmlFile);
                ad.setName(grokName(xmlFile));
                dataModels.add(ad);
            }
            else
            {
                // Deal with the filesets.
                for (int i = 0; i < filesets.size(); i++)
                {
                    FileSet fs = (FileSet) filesets.get(i);
                    DirectoryScanner ds = fs.getDirectoryScanner(project);
                    File srcDir = fs.getDir(project);
                   
                    String[] dataModelFiles = ds.getIncludedFiles();
                   
                    // Make a transaction for each file
                    for (int j = 0; j < dataModelFiles.length; j++)
                    {
                        File f = new File(srcDir, dataModelFiles[j]);
                        xmlParser = new XmlToAppData(getTargetDatabase(),
                                getTargetPackage(),
                                getBasePathToDbProps());
                        AppData ad = xmlParser.parseFile(f.toString());
                        ad.setName(grokName(f.toString()));
                        dataModels.add(ad);
                    }
                }
            }
           
            Iterator i = dataModels.iterator();
            databaseNames = new Hashtable();
            dataModelDbMap = new Hashtable();
           
            // Different datamodels may state the same database
            // names, we just want the unique names of databases.
            while (i.hasNext())
            {
                AppData ad = (AppData) i.next();
                Database database = ad.getDatabase();
                databaseNames.put(database.getName(), database.getName());
                dataModelDbMap.put(ad.getName(), database.getName());
            }
        }
        catch (EngineException ee)
        {
            throw new BuildException(ee);
View Full Code Here

Examples of org.apache.torque.engine.database.model.AppData

    {
        // Transform the XML database schema into
        // data model object.
        XmlToAppData xmlParser = new XmlToAppData(getTargetDatabase(), null,
                                                  getBasePathToDbProps());
        AppData ad = xmlParser.parseFile(getIdTableXMLFile());

        ad.setName("idmodel");
        context.put("idmodel", ad);
    }
View Full Code Here

Examples of org.apache.torque.engine.database.model.AppData

     * file, including trailing slash.
     */
    public XmlToAppData(String databaseType, String defaultPackage,
                        String basePropsFilePath)
    {
        app = new AppData(databaseType, basePropsFilePath);
        this.defaultPackage = defaultPackage;
        firstPass = true;
    }
View Full Code Here

Examples of org.apache.torque.engine.database.model.AppData

                    + "a fileset of XML data files!");
        }

        try
        {
            AppData app = (AppData) getDataModels().get(0);
            Database db = app.getDatabase();
           
            List data;
           
            if (dataXmlFile != null)
            {
View Full Code Here

Examples of org.apache.torque.engine.database.model.AppData

            {
                File file = (File) files.elementAt(i);
                String filename = file.getAbsolutePath();
                // load the sql file
                SQLToAppData s2a = new SQLToAppData(filename);
                AppData ad = s2a.execute();
                // write the output to a new xml file
                String xmlFilename = filename + ".xml";
                PrintWriter out = new PrintWriter(
                        new FileOutputStream(xmlFilename, false),true);
                out.println(ad);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.