728x90

Oracle Connection Pool

		<Resource auth="Container" 
              driverClassName="oracle.jdbc.driver.OracleDriver" 
              factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" 
              maxActive="100" 
              maxIdle="30" 
              maxWait="10000" 
              name="jdbc/testDS" 
              password="tiger" 
              type="javax.sql.DataSource" 
              url="jdbc:oracle:thin:@loclahost:1521:orcl" 
              username="scott"/>

Context 경로 추가

		<Context docBase="C:/workspace/images" path="images" reloadable="true"/>

URIEncoding

		<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" URIEncoding="UTF-8"/>
728x90
728x90

Spring Controller

@Controller
@RequestMapping(value = "/form/mfile_add")
public class CMXFileAddController {

	@RequestMapping(method = RequestMethod.GET)
	public String getUploadForm(Model model) {
		MFile mFile = new MFile ();
		model.addAttribute("mFile", mFile);
		return "/form/mfile_add";
	}

mfile_add.jsp

<form:form modelAttribute="mFile" method="post" enctype="multipart/form-data">

        <legend>자료 등록</legend>

        <table>
          <TR>
            <TD><form:label for="title" path="title">제목</form:label></TD>
            <TD><form:input path="title" type="text" size="85"/></TD>
          </TR>
          <TR>
            <TD><form:label for="file1" path="file1">파일1</form:label></TD>
            <TD><form:input path="file1" type="file" size="70"/></TD>
          </TR>
          <TR>
            <TD><form:label for="desc" path="desc">설명</form:label></TD>
            <TD><form:textarea path="desc" cols="84" rows="5" /></TD>
          </TR>
        </table>

        <input type="submit" value="등록"/>

</form:form>

Post 파일 업로드 처리

	@RequestMapping(method = RequestMethod.POST)
	public String create(MFile mFile, BindingResult result) {
		
		System.out.println(mFile);
		
		if (result.hasErrors()) {
			for (ObjectError error : result.getAllErrors()) {
				System.err.println("Error: " + error.getCode() + " - " + error.getDefaultMessage());
			}
			return "/form/mfile_add";
		}

		if (!mFile.getFile1().isEmpty()) {
			String filename = mFile.getFile1().getOriginalFilename();
			String imgExt = filename.substring(filename.lastIndexOf(".") + 1, filename.length());

			// upload 가능한 파일 타입 지정
			if (imgExt.equalsIgnoreCase("xls")) {
				byte[] bytes = mFile.getFile1().getBytes();
				try {
					File lOutFile = new File(fsResource.getPath() + filename  + "_temp.xls");
					FileOutputStream lFileOutputStream = new FileOutputStream(lOutFile);
					lFileOutputStream.write(bytes);
					lFileOutputStream.close();
				} catch (IOException ie) {
					// Exception 처리
					System.err.println("File writing error! ");
				}
				System.err.println("File upload success! ");
			} else {
				System.err.println("File type error! ");
			}
		
		}
		return "redirect:mfile_list.itg";
	}

 

728x90
728x90

MySQL JDBC 연결

import java.sql.Connection;
import java.sql.DriverManager;

public class Test {
  public static void main(String[] args) throws Exception {
    Connection conn = null;
    try {
      Class.forName("org.gjt.mm.mysql.Driver"); 
      conn = DriverManager.getConnection("jdbc:mysql://localhost:5515/dbname?user=id&useUnicode=true&characterEncoding=UTF8", "id", "pw");
    } catch (Exception e) {
      e.printStackTrace();
      if (conn!=null) try { conn.close(); } catch (Exception e2) { }
    }
  }
}

Oracle thin

import java.sql.Connection;
import java.sql.DriverManager;

public class Test {
  public static void main(String[] args) throws Exception {
    Connection conn = null;
    try {
      Class.forName("oracle.jdbc.driver.OracleDriver"); 
      conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "scott", "tiger");
      
      System.out.println(conn);
      
    } catch (Exception e) {
      e.printStackTrace();
      if (conn!=null) try { conn.close(); } catch (Exception e2) { }
    }
  }
}

Oracle OCI

import java.sql.Connection;
import java.sql.DriverManager;

public class TestOCI {
  public static void main(String[] args) throws Exception {
    Connection conn = null;
    try {
      Class.forName("oracle.jdbc.driver.OracleDriver"); 
      conn = DriverManager.getConnection("jdbc:oracle:oci:@xe", "scott", "tiger");
      
      System.out.println(conn);
      
    } catch (Exception e) {
      e.printStackTrace();
      if (conn!=null) try { conn.close(); } catch (Exception e2) { }
    }
  }
}
728x90
728x90

출처 : http://inmist.tistory.com/entry/%EC%8A%A4%ED%81%AC%EB%9E%A9Android-NDK-%EC%82%AC%EC%9A%A9%EB%B2%95
http://www.kkaneko.com/rinkou/js/andk.html
http://darkryu.egloos.com/m/3299369

NDK 다운로드

http://developer.android.com/sdk/ndk/index.html

NDK 설치

cd 다운로드
tar xvjof android-ndk-r8-linux-x86.tar.bz2
mv android-ndk-r8 ~/dev

NDK 환경 설정

echo 'export ANDROID_NDK_ROOT=/home/user1/dev/android-ndk-r8' | tee -a ~/.bashrc
echo 'export ANDROID_SDK_ROOT=/home/user1/dev/android-sdks' | tee -a ~/.bashrc
echo 'export PATH=$PATH:$ANDROID_NDK_ROOT:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools' | tee -a ~/.bashrc

ToolChain 만들기

sudo ~/dev/android-ndk-r8/build/tools/make-standalone-toolchain.sh --ndk-dir=/home/user1/dev/android-ndk-r8 --platform=android-8 --install-dir=/opt/android-8-toolchain
sudo chown user1:user1 -hR /opt/android-8-toolchain

echo 'export TOOLCHAIN=/opt/android-8-toolchain' | tee -a ~/.bashrc
echo 'export PATH=$TOOLCHAIN/bin:$PATH' | tee -a ~/.bashrc
echo 'export CC=arm-linux-androideabi-gcc' | tee -a ~/.bashrc

cygwin (참조용)
./make-standalone-toolchain.sh --ndk-dir=/opt/android-ndk --platform=android-8 --install-dir=/opt/android-8-toolchain

NDK 테스트 빌드

cd ~/dev/android-ndk-r8/samples/hello-jni/jni
ndk-build

컴파일 확인

NDK Sample 만들기 

기본 Sample을 사용하는 것이라서 HelloJni 입력하고, [Next] 버튼 선택

Target SDK를 Android 2.1로 선택하고, [Next] 버튼 선택

Package Name : com.example.hellojni
Create Activity : HelloJni

HelloJni.java파일를 NDK Sample 폴더에서 복사하거나, 아래와 같이 입력 한다

package com.example.hellojni;

import android.app.Activity;
import android.widget.TextView;
import android.os.Bundle;


public class HelloJni extends Activity
{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        /** 
         * Create a TextView and set its content.
         * the text is retrieved by calling a native
         * function.
         */
        TextView  tv = new TextView(this);
        tv.setText( stringFromJNI() );
        setContentView(tv);
    }

    /**
     * A native method that is implemented by the
     * 'hello-jni' native library, which is packaged
     * with this application.
     */
    public native String  stringFromJNI();

    /**
     * This is another native method declaration that is *not*
     * implemented by 'hello-jni'. This is simply to show that
     * you can declare as many native methods in your Java code
     * as you want, their implementation is searched in the
     * currently loaded native libraries only the first time
     * you call them.
     *
     * Trying to call this function will result in a
     * java.lang.UnsatisfiedLinkError exception !
     */
    public native String  unimplementedStringFromJNI();

    /**
     * this is used to load the 'hello-jni' library on application
     * startup. The library has already been unpacked into
     * /data/data/com.example.HelloJni/lib/libhello-jni.so at
     * installation time by the package manager.
     */
    static {
        System.loadLibrary("hello-jni");
    }
}

jni 폴더를 만들고, Android.mk, hello-jni.c NDK Sample 폴더에서 복사하거나, 아래와 같이 입력 한다.

Android.mk 파일

# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := hello-jni
LOCAL_SRC_FILES := hello-jni.c

include $(BUILD_SHARED_LIBRARY)

hello-jni.c 파일

/*
 * Copyright (C) 2009 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
#include 
#include 

/* This is a trivial JNI example where we use a native method
 * to return a new VM String. See the corresponding Java source
 * file located at:
 *
 *   apps/samples/hello-jni/project/src/com/example/HelloJni/HelloJni.java
 */
jstring
Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env,
                                                  jobject thiz )
{
    return (*env)->NewStringUTF(env, "Hello from JNI !");
}

NDK 빌드

cd ~/dev/workspace/HelloJni/jni
ndk-build

HelloJni 프로젝트를 refresh 해보면 libs/armeabi/libhello-jni.so 파일이 생성 된것을 확인 할 수 있다. 

실행

728x90
728x90
출처 : http://dbin318.tistory.com/13

웹페이지 호출 후 오래 걸리는 작업을 실행하는 경우 응답을 바로 할 수 없어서
MQ 시스템을 적용하게 되었습니다.

MQ(Message Queue) 시스템은
Message를 Queue에 전달하고, MQ시스템은 다시 Queue에서 Message을 받아서
Message을 실행하는 것으로, 시스템에서 처리 가능한 용량 만큼만 Queue에 Message을 받아서
처리 하게 됩니다.

부하가 많이 걸리는 SMS 시스템과 같은 시스템에 적용하게 됩니다.

저의 경우는 부하가 많이 걸리는 작업은 아니지만
특정 작업이 1시간 이상 걸리는 작업을 웹페이지에서 호출하는데,
호출후 바로 응답을 받을 수 없는 문제로 MQ 시스템을 적용하게 되었습니다.
(Message을 Queue에 전달하고 바로 응답 페이지를 보여줄 수 있기때문에...비동기식 호출이 가능)

자세한 설명은 출처 페이지에서 보실수 있습니다.

적용환경

Tomcat 7
Spring 3.0.4
ActiveMQ 5.4.3

test-activemq.xml
<?xml version="1.0" encoding="UTF-8"?>

<beans 
  xmlns="http://www.springframework.org/schema/beans" 
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

	<!-- a pooling based JMS provider -->
	<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
		<property name="brokerURL">
			<value>vm://localhost</value>
		</property>
	</bean>

	<bean id="jmsFactory" class="org.apache.activemq.pool.PooledConnectionFactory"
		destroy-method="stop">
		<property name="connectionFactory" ref="connectionFactory" />
	</bean>

	<bean id="queueDestination" class="org.apache.activemq.command.ActiveMQQueue">
		<constructor-arg value="dbin.queue" />
	</bean>

	<bean id="msgConverter" class="test.dbin.MsgConverterImpl" />
	<bean id="msgMdp" class="test.dbin.MsgMDP" />

	<bean id="purePojoMdp"
		class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
		<property name="delegate" ref="msgMdp" />
		<property name="defaultListenerMethod" value="handleMessage" />
		<property name="messageConverter" ref="msgConverter" />
	</bean>
	
	<bean class="org.springframework.jms.listener.SimpleMessageListenerContainer">
		<property name="connectionFactory" ref="jmsFactory" />
		<property name="destination" ref="queueDestination" />
		<property name="messageListener" ref="purePojoMdp" />
	</bean>

	<!-- Spring JMS Template -->
	<bean id="producerJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
		<property name="connectionFactory" ref="jmsFactory" />
		<property name="defaultDestination" ref="queueDestination" />
		<property name="messageConverter" ref="msgConverter" />
	</bean>

	<bean id="producer" class="test.dbin.MsgProducerImpl">
		<property name="jmsTemplate" ref="producerJmsTemplate" />
	</bean>
</beans>

Msg.java
package test.dbin;

public class Msg {

	private String name;
	private String value;

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getValue() {
		return value;
	}

	public String toString() {
		return "name = " + name + ", value = " + value;
	}

}

MsgProducer.java
package test.dbin;

import org.springframework.jms.core.JmsTemplate;

public interface MsgProducer {
 
	public void send(final Msg map);
 
	public void setJmsTemplate(JmsTemplate jmsTemplate);
 
}

MsgProducerImpl.java
package test.dbin;

import org.springframework.jms.core.JmsTemplate;

public class MsgProducerImpl implements MsgProducer {

	private JmsTemplate jmsTemplate;
 
	public void setJmsTemplate(JmsTemplate jmsTemplate) {
 		this.jmsTemplate = jmsTemplate;
 	}
	
	public void send(final Msg msg) {		
 		jmsTemplate.convertAndSend(msg);
 	}	
 
}

MsgMDP.java
package test.dbin;

/**
 * Message Driven POJO
 *
 */
public class MsgMDP {
 
	public void handleMessage(Msg msg) {
		// handles the message
		System.out.println("handler called");
		System.out.println(msg);
	}
 
}

MsgConverterImpl.java
package test.dbin;
 
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.Session;

import org.springframework.jms.support.converter.MessageConversionException;
import org.springframework.jms.support.converter.MessageConverter;

/**
 * MapMessage로의 conversion을 담당하는 class
 * 
 *
 */
public class MsgConverterImpl implements MessageConverter {

	public MsgConverterImpl() {

	}

	public Object fromMessage(Message message) throws JMSException, MessageConversionException {
		if( !(message instanceof MapMessage)) {
			throw new MessageConversionException("not MapMessage");
		}
		
		System.out.println("MsgConverterImpl.fromMessage");
		
		MapMessage mapMessage = (MapMessage)message;
		Msg msg = new Msg();
		msg.setName(mapMessage.getString("name"));
		msg.setValue(mapMessage.getString("value"));

		return msg;
	}

	public Message toMessage(Object object, Session session)  throws JMSException, MessageConversionException {
		if ( !(object instanceof Msg) ) {
			throw new MessageConversionException("not Msg");
		}
		
		System.out.println("MsgConverterImpl.toMessage");
		
		Msg msg = (Msg)object;
		MapMessage mapMessage = session.createMapMessage();

		mapMessage.setString("name", msg.getName());
		mapMessage.setString("value", msg.getValue());
		
		return mapMessage;
	}
}

MQController.java
  @Override
	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		
		Msg msg = new Msg();
		msg.setName("daniel yoon");
		msg.setValue("lullaby");
 		
		// 전송 
		MsgProducer producer = (MsgProducer)BeanUtils.getBean("producer");
		producer.send(msg);
		System.out.println(msg + " sent");
		
		
		ModelAndView mv = new ModelAndView();
		mv.setViewName("/index");

		return mv;
	}
실행결과

MsgConverterImpl.toMessage
MsgConverterImpl.fromMessage
handler called
name = daniel yoon, value = lullaby
name = daniel yoon, value = lullaby sent
728x90
728x90
출처 : http://www.ibm.com/developerworks/kr/library/j-jstl0520/

JAR 파일 추가 

jstl-1.2.jar 파일를 WEB-INF/lib 밑에 복사합니다.

WEB-INF/web.xml 편집 불필요

jstl-1.2.jar에 내장되어 있어 web.xml 편집 필요 없음

JSP 파일 작성

<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>JSTL SQL Test</title>
</head>
<body>

<sql:setDataSource dataSource="jdbc/testDS"/> 
<sql:query var="items" sql="SELECT * FROM user_info">
</sql:query>

<table border="1" align="center" valign="center">
<c:forEach var="row" items="${items.rows}">
<tr>
<td><c:out value="${row.user_id}"/></td>
</tr>
</c:forEach>
</table>

</body>
</html>

728x90
728x90

출처 : http://www.supermind.org/blog/613/dom4j-xpath-tagsoup-namespaces-sweet
http://tomasblue.tistory.com/entry/Dom4j-XPath%EB%A5%BC-%EC%9D%B4%EC%9A%A9%ED%95%9C-%EC%BF%BC%EB%A6%AC-%EB%AC%B8%EC%A0%9C%EC%A0%90-%ED%95%B4%EA%B2%B0-Namespace%EA%B4%80%EB%A0%A8

//
XPath xpath = XPathFactory.newInstance().newXPath(); 

//
BufferedReader bis = new BufferedReader (new InputStreamReader ("index.html"), "UTF-8")); 

//
XMLReader tagsoup = new org.ccil.cowan.tagsoup.Parser(); 
SAXReader reader = new SAXReader(tagsoup);
Document doc = reader.read(bis); 
 
// 네임스페이스 제거 XPath를 이용하려면 네임스페이스를 제거해야 함
XMLUtils.fixNamespaces(doc);
//XMLUtils.generateXmlFile(doc, "index.xml");

//<li class="bar">하나
DefaultText han_mean_Node = (DefaultText)ajax_pron_dlNode.selectSingleNode("//li[@class='bar']/text()[1]");

//<span class="count"> 
//  <b>2</b>개
//</span>  
DefaultElement hanziCountNode = (DefaultElement)doc.selectSingleNode("//span[@class=\"count\"]/b");

//<div id="content"> 
//  <div id="detail">
//    <ul id="data1">1</ul>
//    <ul id="data2">2</ul>
List contentList = doc.selectNodes("//div[@id='content']/div[@id='detail']/node()");
XMLUtils.java
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.List;

import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.Namespace;
import org.dom4j.Node;
import org.dom4j.QName;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;

public class XMLUtils {
	/**
	 * @param doc DOM4J XML Document
	 * Generate XML File
	 */
	public static void generateXmlFile(Document doc, String xmlfile) {
		XMLWriter writer = null;
		try {
			OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(new File(xmlfile)), "UTF-8");
			OutputFormat format = OutputFormat.createPrettyPrint();
			format.setEncoding("UTF-8");
			writer = new XMLWriter(osw,format);
			
			writer.write(doc);
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if(writer != null) {
				try {
					writer.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	
	} 
	
	/**
	 * @param doc DOM4J XML Document
	 * Generate XML File
	 */
	private static void generateXmlFile(Element doc, String xmlfile) {
		XMLWriter writer = null;
		try {
			OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(new File(xmlfile)), "UTF-8");
			OutputFormat format = OutputFormat.createPrettyPrint();
			format.setEncoding("UTF-8");
			writer = new XMLWriter(osw,format);
			
			writer.write(doc);
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if(writer != null) {
				try {
					writer.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}  			

	/**
	 * 네임스페이스 제거 XPath를 이용하려면 네임스페이스를 제거해야 함
	 */
	public static void fixNamespaces(Document doc) {
		Element root = doc.getRootElement();
		if (root.getNamespace() != Namespace.NO_NAMESPACE)
			removeNamespaces(root.content());
	}

	/**
	 * 네임스페이스 원복
	 */
	public static void unfixNamespaces(Document doc, Namespace original) {
		Element root = doc.getRootElement();
		if (original != null)
			setNamespaces(root.content(), original);
	}

	/**
	 * 목록내 모든 element의 네임스페이스 제거
	 */
	@SuppressWarnings("unchecked")
	private static void removeNamespaces(List l) {
		setNamespaces(l, Namespace.NO_NAMESPACE);
	}

	/**
	 * Element의 네임스페이스 설정(child포함)
	 */
	private static void setNamespaces(Element elem, Namespace ns) {
		setNamespace(elem, ns);
		setNamespaces(elem.content(), ns);
	}

	/**
	 * 목록내 node(child포함)의 네임스페이스 설정
	 */
	@SuppressWarnings("unchecked")
	private static void setNamespaces(List l, Namespace ns) {
		Node n = null;
		for (int i = 0; i < l.size(); i++) {
			n = (Node) l.get(i);
			if (n.getNodeType() == Node.ATTRIBUTE_NODE)
				((Attribute) n).setNamespace(ns);
			if (n.getNodeType() == Node.ELEMENT_NODE)
				setNamespaces((Element) n, ns);
		}
	}

	/**
	 * Elemnet의 네임스페이스 설정
	 */
	private static void setNamespace(Element elem, Namespace ns) {
		elem.setQName(QName.get(elem.getName(), ns, elem.getQualifiedName()));
	}
}
728x90
728x90

@header {
package xxx;
}

@members {
private AppBase appBase;

public void SetAppBase(AppBase appBase) {
  this.appBase = appBase;
}
}

@lexer::header {
package xxx;
}

packageDeclaration 
    :   'package' qualifiedName {
         System.out.println("--" + $qualifiedName.result.getLine() + "/" + $qualifiedName.result.getQualifiedName());
      }
        ';'
    ;

qualifiedName returns [AstQualifiedName result]
scope {
  AstQualifiedName current;
}
@init {
  $qualifiedName::current = new AstQualifiedName();
}

    :   IDENTIFIER {
          $qualifiedName::current.setLine($IDENTIFIER.getLine());
          $qualifiedName::current.addIdentifier($IDENTIFIER.getText());
      }
        ('.' IDENTIFIER {
          $qualifiedName::current.addIdentifier($IDENTIFIER.getText());
        }
        )* {
          $result = $qualifiedName::current;
        }
    ;

-----------------------------------------------------------------------------------

package xxx;

import xxx.AppBase;

import org.antlr.runtime.ANTLRFileStream;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.RuleReturnScope;
import org.antlr.runtime.Token;
import org.antlr.runtime.TokenStream;
import org.antlr.runtime.tree.CommonErrorNode;
import org.antlr.runtime.tree.CommonTreeAdaptor;
import org.antlr.runtime.tree.TreeAdaptor;

public class JavaTestMain {
 
 public static void main(String[] args) throws Exception {
  
  AppBase appBase = new AppBase();
  
  ANTLRFileStream fileStream = new ANTLRFileStream("ASTMain.java");
  JavaLexer lexer = new JavaLexer(fileStream);
  CommonTokenStream tokens = new CommonTokenStream(lexer);
  JavaParser parser = new JavaParser(tokens);
  parser.SetAppBase(appBase);
  parser.compilationUnit();
  }
}


728x90

+ Recent posts