Wednesday 26 December 2007

expanding hip size of eclipse

Please use one of below two options

1. D:\eclipseAllInOne\eclipse\eclipse.exe -vmargs -Xverify:none -XX:+UseParallelGC -XX:PermSize=20M -XX:MaxNewSize=32M -XX:NewSize=32M -Xmx256m -Xms256m

2. eclipse.exe -vmargs -Xverify:none -XX:+UseParallelGC -XX:PermSize=20M -XX:MaxNewSize=32M -XX:NewSize=32M -Xmx256m -Xms256m

Tuesday 25 December 2007

Basic Example-Web Service Client ,Axis2

* Basic Example-Web service Client with Axis2,Apache

see here

Thursday 15 November 2007

automatic update page

* It shows that the page is updated without any action of users or refresh.

see here

Tuesday 6 November 2007

Dom parsing as loop

This is an example how we can parse xml file with using loop method.

see here

Map example

import java.util.*;

public class HashMapTest
{
public static void main(String argv[])
{
HashMap hm = new HashMap();
System.out.println(hm.put("aaa", "111"));
System.out.println(hm.put("bbb", "222"));
System.out.println(hm.put("aaa", "444"));
System.out.println(hm.put("ccc", "333"));
System.out.println(hm.put("ccc", null));

System.out.println("HashMap size : " + hm.size());

Set set = hm.keySet();
Object []hmKeys = set.toArray();
for(int i = 0; i < hmKeys.length; i++)
{
String key = (String)hmKeys[i];
System.out.print(key);
System.out.print(" - ");
System.out.println((String)hm.get(key));
}
}
}


/**
run:java HashMapTest
output:
null
null
111
null
333
HashMap size : 3
ccc - null
bbb - 222
aaa - 444

Monday 5 November 2007

List example

import java.util.List ;
import java.util.Vector ;

public class A {

public static void main(String[] args) {
A a = new A() ;
List b = a.getSchools() ;

// get values
for( int i = 0 ; i < b.size() ; i++ ){
String str = (String)b.get(i) ;
System.out.println("["+i+"]:"+str) ;
}

System.out.println("=================================") ;

// add the value as the last position
b.add("SchoolName4") ;
b.add("SchoolName5") ;

// get values
for( int i = 0 ; i < b.size() ; i++ ){
String str = (String)b.get(i) ;
System.out.println("["+i+"]:"+str) ;
}

System.out.println("=================================") ;

// insert value to 3 position
b.add(2, "SchoolName6") ;

// get values
for( int i = 0 ; i < b.size() ; i++ ){
String str = (String)b.get(i) ;
System.out.println("["+i+"]:"+str) ;
}


}

private List getSchools() {

Vector v = new Vector() ;
v.add("SchoolName1") ;
v.add("SchoolName2") ;
v.add("SchoolName3") ;
return (List)v ;

}

}

Wednesday 31 October 2007

* How you can access the class from other project under eclipse

* How you can access the class from other project under eclipse

- Scenario
*** Project1
------ com.ssr1.yy (package)
------------ a1a.java
------------ b1b.java
------ com.ssr2.yy (package)
------------ a2a.java
------------ b2b.java

*** Project2
----- com.rr1.yy (package)
------------ cc1.java


you are supposed developing "project2" with eclipse like above enviroment.

Now you are trying to access some class that is located in "Project1" , suppose it is a1a.java

You want to access or create "a1a.java"(Project1) object from "cc1.java"(Project2)

Then you should customize some of enviroment (MANIFEST.MF) .

1. open MANIFEST.MF from Project1

2. Click "Runtime" tab on the bottom

3. Click "Add" button under "Exported Packages" title

4. select or type "com.ss1.yy" because "a1a.java" file is located under that pacakge name.

5. click ok and save it

6. Compile it
-----------------------
7. open MANIFEST.MF from Project2

8. Click "Dependencies" tab

9. click "Add" button under "Required Plug-in"

10. select or type "Project1" because a1a.java file is located under that project

11. click ok and save it

== Now you can create or access a1a.java file from cc1.java file ====

Monday 29 October 2007

Dom & ArrayList example

package com.samsung.dpd.everest.presentation.sespsdk.sample.loginapp.authn.localdb;

import java.io.File;
import java.util.ArrayList;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import com.samsung.dpd.everest.presentation.sespsdk.sample.loginapp.ui.LocalDbLocalUiServlet;

public class XMLparsing {

//private static final String _USER_DB_ = LocalDbLocalUiServlet._AUTHN_ +"/users.xml";
private static final String _USER_DB_ = "users.xml";

public XMLparsing() {
// TODO Auto-generated constructor stub
}

public static void main (String args []){
ArrayList v1 = new ArrayList();

UserAll ua = new UserAll();
XMLparsing s = new XMLparsing();
v1 = s.getInfoAll();
System.out.println("======================================");
for (int i =0 ; i < v1.size(); i++){
ua = (UserAll)v1.get(i);
System.out.println("11 : "+ ua.getUname());
}
}

public ArrayList getInfoAll() {

ArrayList v = new ArrayList();

try {
File file= new File(XMLparsing._USER_DB_);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(file);
doc.getDocumentElement().normalize();
System.out.println("Root element : "+doc.getDocumentElement().getNodeName());
NodeList nodeList = doc.getElementsByTagName("user");
System.out.println("Information of all users");

for (int s = 0; s < nodeList.getLength(); s++){
UserAll ua = new UserAll();
Node fstNode = nodeList.item(s);

if (fstNode.getNodeType() == Node.ELEMENT_NODE){
Element fstElmnt = (Element)fstNode;
NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("username");
Element fstNmElmnt = (Element)fstNmElmntLst.item(0);
NodeList fstNm = fstNmElmnt.getChildNodes();
System.out.println("user name : "+((Node)fstNm.item(0)).getNodeValue());
ua.setUname(((Node)fstNm.item(0)).getNodeValue());


NodeList fstNmElmntLst2 = fstElmnt.getElementsByTagName("userpassword");
Element fstNmElmnt2 = (Element)fstNmElmntLst2.item(0);
NodeList fstNm2 = fstNmElmnt2.getChildNodes();
System.out.println("user userpassword : "+((Node)fstNm2.item(0)).getNodeValue());
ua.setUpassword(((Node)fstNm2.item(0)).getNodeValue());

NodeList fstNmElmntLst3 = fstElmnt.getElementsByTagName("email");
Element fstNmElmnt3 = (Element)fstNmElmntLst3.item(0);
NodeList fstNm3 = fstNmElmnt3.getChildNodes();
System.out.println("user email : "+((Node)fstNm3.item(0)).getNodeValue());
ua.setUemail(((Node)fstNm3.item(0)).getNodeValue());

NodeList fstNmElmntLst4 = fstElmnt.getElementsByTagName("role");
Element fstNmElmnt4 = (Element)fstNmElmntLst4.item(0);
NodeList fstNm4 = fstNmElmnt4.getChildNodes();
System.out.println("user role : "+((Node)fstNm4.item(0)).getNodeValue());
ua.setUrole(((Node)fstNm4.item(0)).getNodeValue());
}
v.add(ua);
}


} catch (Exception e){
e.printStackTrace();
}

return v;
}

}

Sunday 28 October 2007

[HTML TIP] Create layout in Table

[table style="width:100%; height:100%; table-layout:fixed;border:0px solid;margin:0 auto"]
[tr][td valign="top"]
[div id="workformListDivId" style="overflow:auto;width:100%;height:96%;border:0;"]
[/div]tothe
[/td][/tr]
[/table]

......

key - word : table-layout and style="overflow:auto;width:100%;height:96%;border:0;"


=============== Example ====================
<table style="width:100%; height:100%; table-layout:fixed;border:0px solid;margin:0 auto">
<tr><td valign="top">
<div id="workformListDivId" style="overflow:auto;width:100;height:100;border:0;">
<table>
<tr>
<td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td>
</tr>
<tr>
<td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td>
</tr>
<tr>
<td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td>
</tr>
<tr>
<td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td>
</tr>
<tr>
<td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td><td>ssrfdas</td>
</tr>
</table>
</div>tothe
</td></tr>
</table>

Thursday 25 October 2007

simple Drag and drop example

* This is a simple example for drag and drop in limited area.

see here

Thursday 18 October 2007

Install JDK under linux

Install JDK under linux

1. download jdk installation file such as "jdk-6u3-linux-i586.rpm.bin"

2. open terminal and run "chmod a+x jdk-6u3-linux-i586.rpm.bin

3. ./j2sdk-1_4_2_-linux-i586.rpm.bin

4. agree the license

5. rpm -iv j2sdk-1_4_2_-linux-i586.rpm

Monday 15 October 2007

ENUM example in JAVA

** ENUM Example

==== ENUM_Season.java =====
public enum ENUM_Season {
SPRING, SUMMER, FALL, WINTER
}


==== ENUM_Season01_A.java ===

public class ENUM_Season01_A {
public static void main(String[] args) {
ENUM_Season season = ENUM_Season.SUMMER;
System.out.println(season);
if (season.equals(ENUM_Season.SPRING) == true) {
System.out.println("the current season is SPRING.");
}else {
System.out.println("the current season is not SPRING.");
}
}
}

===== Output ===
SUMMER
the current season is not SPRING.

Wednesday 3 October 2007

web developing with eclipse, my-sql

* web developing with eclipse, my-sql
eclipse 3.3 - WTP
DB - My-sql 5.0 (http://www.mysql.com/downloads)
Web server - Tomcat 6.0

This example describe how we can create web project under eclipse with my-sql.

See here

Tuesday 2 October 2007

Tomcat + eclipse error handle

* Tomcat 6.0 + eclipse 3.3 (WTP)

======= Error message ==========
Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: javax/el/ELResolver
...
...

> there are no el-api.jar file in jdk 1.x ext folder

Solution
- Please copy el-api.jar file from Tomcat_Home\lib
- paste el-api.jar file to JAVA_HOME\jre\lib\ext

Thursday 27 September 2007

* Basic Example-Web service with Axis2,Eclipse plugins and OSGI Under one project

* Basic Example-Web service with Axis2,Eclipse plugins and OSGI Under one project

- This example shows how Web serice is working with OSGI under one project in eclipse.
It will create "aar" file for Web Service and "jar" file for osgi
"aar" file will work under Tomcat web server.

see here

Basic Example-Web service with Axis2,Eclipse plugins and OSGI (Part 3)

* Basic Example-Web service with Axis2,Eclipse plugins and OSGI (Part 3)

- This part discribe how created jar file can work with osgi console system

- This example shows how we can create osgi bundle and working with Web Service from
previous example(Basic Example-Web service with Axis2,Eclipse plugins and OSGI (Part 2)).

Each program communicate data via stub that is automatically generated using
Axis2 plugin.

see here

Thursday 20 September 2007

Basic Example-Web service with Axis2,Eclipse plugins and OSGI (Part 2)

* Basic Example-Web service with Axis2,Eclipse plugins and OSGI (Part 2)

This example shows how we can create osgi bundle and working with Web Service from
previous example(Working under Tomcat and deploy it as a "aar" file).

There are two web server : one is from PC (Tomcat) and the other one is OSGI Web Server

Each program communicate data via stub that is automatically generated using
Axis2 plugin.

See here

- tomcat should be running
check out http://localhost:8080/axis2/services/listServices

Basic Example-Web service with Axis2,Eclipse plugins and OSGI (Part 1)

* Basic Example-Web service with Axis2,Eclipse plugins and OSGI (Part 1)

This shows how we can create Web service with Axis2 ,eclipse and Axis eclispe plug-in.
And it also works with OSGI application.

This is for only build web service and deploy in Tomcat , create WSDL file

See here

* Developing Web service with Axis2 , Eclipse plugins

* Developing Web service with Axis2 , Eclipse plugins
This is just from http://wso2.org/library/1719

The Bottom up Approach

Wednesday 19 September 2007

JAX-WS web service example with Eclipse (part 2 : Building the Client)

* This is for JAX-WS web service example with Eclipse (part 2 : Building the Client)

After you deploy the web service, you can access it from a client program. Here are the steps to follow to build the client:
A. Write the client.
B. Generate portable artifacts required to compile the client.
C. Compile the client.
D. Run the client.

See Here

JAX-WS web service example with Eclipse (part 1 : Developing Web Service)

* This is for JAX-WS web service example with Eclipse (part 1 : Developing Web Service)
It demonstrates a simple web service that is accessed using JAX-WS 2.0 through a standalone Java client.

See Here

Tuesday 18 September 2007

My Basic - OSGI programming Sample

My Basic - OSGI programming Sample
just show how servlet is working under osgi environment

Click here

Monday 17 September 2007

* Developing Web Services Using JAX-WS (Part 1 : generate Web service)

* Developing Web Services Using JAX-WS (Part 1 : generate Web service)

This is for how we can create web service using JAX-WS with eclipse.

* Developing Web Services Using JAX-WS (Part 1 : generate Web service)

Tuesday 4 September 2007

Jax-WS materials to study

--- Jax-WS Main Home page ----
https://jax-ws.dev.java.net/

--- Jax-WS download page----
https://glassfish.dev.java.net/downloads/v1_ur1-p01-b02.html

--- Jax-WS standard tutorial page----
http://java.sun.com/webservices/docs/2.0/tutorial/doc/

--- Jax-WS quick guide -----
https://glassfish.dev.java.net/downloads/quickstart/index.html

--- Jax-WS Basic concept page----
http://www.ftponline.com/javapro/2005_01/magazine/features/kjones_client/default.aspx

--- Jax-WS Example page ----
http://java.sun.com/developer/EJTechTips/2005/tt1220.html

http://blogs.sun.com/artf/entry/a_simple_howto_of_web

http://java-x.blogspot.com/2007/01/implementing-web-services-using-jax-ws.html

* Axis2( version 1.2) + Eclipse + OSGI Simple example - Part 3

* Axis2( version 1.2) + Eclipse + OSGI Simple example - Part 3

> Part 3 request a precondition of Part 2
This part will be implemented for getting "Authentication" from STWF service side.
It's like that we will create virtual machine that is working with STWF server.
From this part we will use Axis2 with osgi.
Suppose we are have Axis2 (version 1.2) and set AXIS2_HOME in enviroment variable

* Axis2( version 1.2) + Eclipse + OSGI Simple example - Part 3

Friday 31 August 2007

* Axis2( version 1.2) + Eclipse + OSGI Simple example - Part 2

* Axis2( version 1.2) + Eclipse + OSGI Simple example - Part 2

Part 2 request a precondition of Part 1.
This part does not include Axis2 option. It discribes how osgi is working under web application.

Axis2( version 1.2) + Eclipse + OSGI Simple example - Part 2

Thursday 30 August 2007

* Axis2( version 1.2) + Eclipse + OSGI Simple example - Part 1

First step to understand how Axis2 and OSGI is working

This is simple example only about osgi programming.
You can understand servlet and access way in osgi programming.

Please download or open the below

Axis2( version 1.2) + Eclipse + OSGI Simple example - Part 1

Sunday 26 August 2007

Axis2 + Tomcat tutorial link

http://wso2.org/library/tutorials --> This is working under Axis2 (version 1.2 and plugin 1.2)
http://wso2.org/library/1719 - Part 1
http://wso2.org/library/1986 - part 2

If you use Axis2 (version 1.3 and plugin 1.3 , please review below message)
(From above example (Developing web services using apache axis2 eclipse plugins - Part 1))

* Step2 - number 8
> To add jar files (right click from project > prperties > Add JARs > select TemperatureWebService > lib > and all jar file include "activation.jar" file

* Step2 - number 9 (This is under Axis2 plugin 1._3 and Eclipse 3.3 AllinOne version)
Please change the source
from "TemperatureConverterTemperatureConverterSOAPllPortStub"
to "TemperatureConverterStub"

==> Please below TemperatureConverterServiceClient.java


http://www.eclipse.org/webtools/community/tutorials/TopDownAxis2WebService/td_tutorial.html

http://www.eclipse.org/webtools/community/tutorials/BottomUpAxis2WebService/bu_tutorial.html



============ TemperatureConverterServiceClient.java ===================
package ws.example;

import java.rmi.RemoteException;
import org.apache.axis2.AxisFault;

public class TemperatureConverterServiceClient {

public static void main(String[] args){
TemperatureConverterStub stub;

try {
double c_value = 32;
stub = new TemperatureConverterStub("http://localhost:8080/axis2/services/TemperatureConverter");
TemperatureConverterStub.C2FConvertion c2f = new TemperatureConverterStub.C2FConvertion();

c2f.setCValue(c_value);

TemperatureConverterStub.C2FConvertionResponse res = stub.c2FConvertion(c2f);
System.out.println("c value : "+c_value+"\tResult : "+res.get_return());

TemperatureConverterStub.F2CValue f2c = new TemperatureConverterStub.F2CValue();
f2c.setFValue(res.get_return());

TemperatureConverterStub.F2CValueResponse resl = stub.f2CValue(f2c);
System.out.println("F value : "+res.get_return()+"\tResult : "+resl.get_return());
} catch (AxisFault e){
e.printStackTrace();
} catch (RemoteException e){
e.printStackTrace();
}
}
}

Thursday 23 August 2007

Axis1 simple example

Apache Axis is an implementation of the SOAP ("Simple Object Access Protocol")
submission to W3C.

SOAP (Simple Object Access Protocol)
WSDL (Web Service Description Langauge)
WSDD (Web Service Deployment Descriptor)

1. Apache Tomcat 4.1 Over , Full Version
Check http://localhost:8080
If you need any library , please copy it to c:\tomcat\common\lib\
* set up enviroment value
set CATALINA_HOME=c:\tomcat

2. JDK : over JDK 1.4

* Set up classpath
set CLASSPATH=.;c:\jdk15\lib\tools.jar;c:\tomcat\common\lib\servlet-api.jar;
Add libraries (ex JDBC ...)

set JAVA_HOME=c:\jdk15
set PATH=c:\jdk15\bin;

3. ANT (option) : ant

http://ant.apache.org (down) ant 1.6.2
* set up classpath
set ANT_HOME=c:\ant
set PATH=c:\ant\bin;
copy C:\tomcat\server\lib\catalina-ant.jar files into c:\ant\lib\
if you need any library such as junit or xml libraries, please copy it into c:\ant\lib\

4. AXIS (Version 1.1) : http://ws.apache.org/axis/ , http://ws.apache.org/axis/releases.html

set AXIS_HOME=c:\axis
set AXIS_LIB=%AXIS_HOME%\lib
set AXISCLASSPATH=%AXIS_LIB%\axis.jar;%AXIS_LIB%\commons-discovery.jar;
%AXIS_LIB%\commons-logging.jar;%AXIS_LIB%\jaxrpc.jar;%AXIS_LIB%\saaj.jar;
%AXIS_LIB%\log4j-1.2.8.jar;%AXIS_LIB%\xml-apis.jar;%AXIS_LIB%\xercesImpl.jar;
%AXIS_LIB%\wsdl4j.jar
set CLASSPATH=%CLASSPATH%;%AXISCLASSPATH%
etc :
you can download xml-apis.jar and xercesImpl.jar from http://xml.apache.org/

5. connect between axis and tomcat
copy axis directory from c:\axis\webapps\axis\ to c:\tomcat\webapps\axis

6. Test

Start Tomcat
http://localhost:8080/axis
* Test libraries
http://localhost:8080/axis/happyaxis.jsp
From this page, you can see missing jar files. Please download from web and copy it into
c:\tomcat\webapps\axis\lib\

Check http://localhost:8080/axis/happyaxis.jsp page again

7. SOAP test

http://localhost:8080/axis/services/Version?method=getVersion


- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
-
Apache Axis version: 1.1 Built on Jun 13, 2003 (09:19:43 EDT)




8. AdminClient test

Move C:\axis\samples\stock
Open dos command and type below line
java org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService deploy.wsdd

comfirm deploy, if you have any error , it is from classpath problem. so please check classpath again.

check deploy is ok or not
http://localhost:8080/axis/servlet/AxisServlet
you will see below page
urn:xmltoday-delayed-quotes (wsdl)
test
getQuote

9. Client test
Open dos command
Move C:\axis\
type below line
java samples.stock.GetQuote -lhttp://localhost:8080/axis/servlet/AxisServlet -uuser1 -wpass1 XXX
or
java -cp %AXISCLASSPATH% samples.stock.GetQuote -lhttp://localhost:8080/axis/servlet/AxisServlet -uuser1 -wpass1 XXX
or
Go to C:\axis\samples\stock
Open GetQuote.java and delete "package samples.stock " line
javac GetQuote.java

goto C:\axis\
java GetQuote -lhttp://localhost:8080/axis/servlet/AxisServlet -uuser1 -wpass1 XXX

You will see XXX: 5525

10. order for programm

a. implement "Interface" and Class for Server side
b. Create WSDL from implemented class
c. create deploy.wsdd file from WSDL file
d. deploy webservice from deploy.wsdd file and update server-config.wsdd
e. create client-side class

11. program flow





12. example

java Interface, Implement
go to c:\test\
create 2 files

//begin - HelloIF.java
package webservice.hello;
public interface HelloIF extends java.rmi.Remote {
public String hello(java.lang.String name) throws java.rmi.RemoteException;
}
//end - HelloIF.java

//begin - HelloImpl.java
package webservice.hello;
public class HelloImpl implements HelloIF {
public HelloImpl() {
}
public String hello(String name) {
System.out.println(name);
return "hi " + name;
}
}
//end - HelloImpl.java


compile

javac -d . HelloImpl.java

If there is error.
c:\test>javac -d . HelloIF.java
c:\test>javac -d . HelloImpl.java

HelloImpl.class and HelloIF.class under c:\test\webservice/hello
(If you can not compile , please use eclipse. because we need only 2 class files with folder)

copy (webservice)folder into C:\Tomcat\webapps\axis\WEB-INF\classes

* Create WSDL file

c:\test>java org.apache.axis.wsdl.Java2WSDL -o c:\test\webservice\hello\Hello.wsdl
-l http://localhost:8080/axis/services/Hello -n http://hello.webservice -pwebservice.hello
http://hello.webservice webservice.hello.HelloIF

Java2WSDL parameter (http://ws.apache.org/axis/java/reference.html)

-o file path and wsdl locationi to create
-l URL for connecting from URL Client
-n Namespace : WSDL target NameSpace
-p package Name space and mapping with namespace Target inerface name


[check Hello.wsdl file from c:\test\webservice\hello]

.......


* Create deploy.wsdd file and create Client-side java class

c:\test>java org.apache.axis.wsdl.WSDL2Java -o c:\test\webservice\hello\
-d Application -s c:\test\webservice\hello\Hello.wsdl

webservice/hello directory is created under c:\test\webservice\hello
deploy.wsdd - the file to deploy in web server
HelloIF.java
HelloIFService.java
HelloIFServiceLocator.java
HelloSoapBindingImpl.java
HelloSoapBindingStub.java
undeploy.wsdd - the file to undeploy in web server

Parameter
-o directory path for wsdd file and class files
-d install area of scope - Application, Request , Session
-s create wsdd file
Target wsdl file path


[deploy.wsdd - update]

wsdd file is created from wsdl file so it does not set up what is real implement class.
So you should update that part
from webservice.hello.HelloSoapBindingImpl to webservice.hello.HelloImpl

deployment
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
...
......
...
parameter name="className" value="webservice.hello.HelloImpl"/>
...
......
...
parameter name="allowedMethods" value="hello"/>
parameter name="scope" value="Application"/>
/service>
/deployment>


*deploy service
Go to C:\test\webservice\hello\webservice\hello
java org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService deploy.wsdd

[checking deply]
http://localhost:8080/axis/servlet/AxisServlet
'Hello' Serviec (display)


* undeploy service

java org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService undeploy.wsdd

[Checking undeploy service]
http://localhost:8080/axis/servlet/AxisServlet
'Hello' service (disappear)

*deploy service
Go to C:\test\webservice\hello\webservice\hello
java org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService deploy.wsdd

[checking deply]
http://localhost:8080/axis/servlet/AxisServlet
'Hello' Serviec (display)

* confirm WSDL from web
http://localhost:8080/axis/services/Hello?wsdl

14. implement client

create client side to access

crate below file and copy to c:\tomcat\webapps\axis\


[HelloClient.jsp]

%@ page contentType="text/html; charset=utf-8" language="java"
import="java.net.MalformedURLException,
java.net.URL,
java.rmi.RemoteException,
javax.xml.namespace.QName,
javax.xml.rpc.ServiceException,
org.apache.axis.client.Call,
org.apache.axis.client.Service" %>
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
html>
head>
title>test web service : Hello World!/title>
/head>
body>
%
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL("http://localhost:8080/axis/services/Hello?wsdl"));
call.setOperationName(new QName("http://soapinterop.org/", "hello"));
String returnValue = (String)call.invoke(new Object[]{"! your name"});
out.println(returnValue);
%>
/body>
/html>





http://localhost:8080/axis/HelloClient.jsp

hi ! your name - (if you can see this message, you are success until here.)


14. second example

There are faster way
after you crate java file and change jws files(change file extenstion from java to jws)

please refer to c:\tomcat\webapps\axis\WEB-INF\web.xml

Please create below file under c:\tomcat\webapps\axis\
[ HelloWorldService.jws]

public class HelloWorldService
{
public String HelloWorld(String data)
{
return "Hello World! You sent the string '" + data + "'.";
}
}

* Access to below address
http://localhost:8080/axis/HelloWorldService.jws
you will see
========================
There is a Web Service here
Click to see the WSDL
=======================
It address there are html page install,
try call HelloWorld method

http://localhost:8080/axis/HelloWorldService.jws?method=HelloWorld&data=Hi+my+name+is+rrr

you received the XML as a result for calling method


* now implement client with java

create below java file in anywhere
[ HelloWorldClient.java]

import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class HelloWorldClient
{
public static void main(String[] args) throws ServiceException, MalformedURLException, RemoteException
{
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL("http://debianbox:8080/axis/HelloWorldService.jws"));
call.setOperationName(new QName("http://soapinterop.org/", "HelloWorld"));
String returnValue = (String)call.invoke(new Object[]{"My name is rrr."});
System.out.println(returnValue);
}
}

compile and run
You will see
Hello World ! you send the string My name is rrr.
from dos command

Tuesday 21 August 2007

Axis2 + Tomcat 6.0

1. Install JDK - jdk 1.5.0_12

2. Install Apache Tomcat : apache-tomcat-6.0.10

3. Install Eclipse : eclipse wtp all-in-one 1.5.3

4. Install tomcatPluginV32

for eclipse plugin : tomcatPluginV32

5. Install Axis2

down - Axis2 1.1.1 - WAR file
http://ftp.kaist.ac.kr/pub/Apache/ws/axis2/1_2/axis2.war
unzip in C:\Apache Software Foundation\Tomcat 6.0\webapps\axis2

6. modify server.xml - but does not need (you can skip this)

Add <Context path="/axis2" ~~~



7. Try to confirm running of Tomcat

access : http://localhost:8080/axis2/

There are 3 links : Services, Validate, Administration

8. Click Services

There are only Version service is running

10. Click Validate link

notify what kind of jar files is running

11. Click Administration

Login information : you can find ID/Password from axis2\WEB-INF\conf\axis2.xml

12. check it and look around

Sunday 19 August 2007

My Javascript Model total data

All javascript file for my creating source

downlaod

Simple OSGI programming example

**** implemented functions

- View OSGI Bundles list
- View selected OSGI Details
- Stop selected OSGI Bundle
- Start selected OSGI bundle

downlaod(for eclipse)

simple dom example (for ...)

******* example xml type *****

<?xml version="1.0" encoding="UTF-8" ?>
<bundles>
<bundle>
<id>0</id>
<bundleName>OSGi System Bundle</bundleName>
<symbolicName>org.eclipse.osgi</symbolicName>
<version>3.3.0.v20070530</version>
<status>actived</status>
</bundle>
<bundle>
<id>50</id>
<bundleName>HTTP Service</bundleName>
<symbolicName>org.eclipse.equinox.http</symbolicName>
<version>1.0.100.v20061218</version>
<status>actived</status>
</bundle>
</bundles>

*********** Javascript Dom part ********
<script type="text/javascript">
function clickButton() {
sendRequest(load_xmlFile, 'action=GetBundlesInfo&sig=1', 'GET', 'MyTest3', true, true);
}

function load_xmlFile(oj) {
var xmlDoc = oj.responseXML;
var xmlText = oj.responseText;
//alert(xmlText);
var node_bundle = xmlDoc.getElementsByTagName("bundle");
var node_bundleName = null;
var bundleName = null;
for (var i = 0; i < node_bundle.length ; i++) {
node_bundleName = node_bundle[i].getElementsByTagName("bundleName");
bundleName = node_bundleName[0].firstChild.nodeValue;
alert(bundleName);
}
//var nodes = xmlDoc.getElementsByTagName("testdata");
//alert(nodes[0].firstChild.nodeValue);
}
</script>


******* inner HTML id ******
<div id="workformListDivIdSub'+workformUser_Id+'" style="display:none">

........
document.getElementById("workformListDivId").style.display = "block";
document.getElementById("workformListDivId").innerHTML = htmlTag;

Ajax example for communicating with service side

Requested file :

* test.html - main html test page
* echo.php - php file as a source for display
* jslb_ajax.js - ajax component javascript file

******* jslb_ajax.js ***********
Download jslb_ajax.js

******* echo.php *****
<?php

//get Post request
$data = $_POST['data'];
$data = "receive ".$data." value now.";

// HTML entity (change < to ....)
$data = htmlspecialchars($data, 0, "UTF-8");

// URI encoding
$data = rawurlencode($data);

// setup UTF-8 for output
mb_http_output ('UTF-8');

// output
echo($data);
?>


**** test.html ****
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="Javascript" src="jslb_ajax.js" charset="utf-8"></script>
<script type="text/javascript">
function clickButton() {
sendRequest(load_xmlFile, '&data=abcd', 'POST', './echo.php', true, true);
}

function load_xmlFile(oj) {
var xmlDoc = oj.responseXML;
var nodes = xmlDoc.getElementsByTagName("testdata");
alert(nodes[0].firstChild.nodeValue);
}
</script>
<title>Test page</title>
</head>
<body>
<br>
<form>
<input type="button" value="send abcd to server side" onclick="clickButton()">
</form>
</body>
</html>

AJax example for reading xml file

Requested file :

* test.html - main html test page
* test.xml - xml file as a source for reading
* jslb_ajax.js - ajax component javascript file

******** test.xml *******
<?xml version="1.0" encoding="UTF-8"?>
<testdata> this is the text source part </testdata>

******* jslb_ajax.js ***********
download ajax component

***** test.html ******
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="Javascript" src="jslb_ajax.js" charset="utf-8"></script>
<script type="text/javascript">
function clickButton() {
sendRequest(load_xmlFile, '', 'GET', 'test.xml', true, true);
}

function load_xmlFile(oj) {
var xmlDoc = oj.responseXML;
var nodes = xmlDoc.getElementsByTagName("testdata");
alert(nodes[0].firstChild.nodeValue);
}
</script>
<title>Test page</title>
</head>
<body>
<br>
<form>
<input type="button" value="read test.xml and display it" onclick="clickButton()">
</form>
</body>
</html>

Sunday 12 August 2007

Simple URL Object example

import java.net.*;

class testURL {
public static void main(String args[]) throws MalformedURLException {
URL testURL1 = new URL("http://help.blogger.com/bin/static.py?page=start.cs");
// create cs URL object
System.out.println("Protocal : " + testURL1.getProtocol());
System.out.println("Port: " + testURL1.getPort());
System.out.println("Host: " + testURL1.getHost());
System.out.println("File(include full location): " + testURL1.getFile());
System.out.println("full URL: " + testURL1.toExternalForm());
}
}

Tuesday 7 August 2007

Memory Hipe

Create below bat file

@echo OFF

set JAVA_OPTIONS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8888,server=y,suspend=n

"%JAVA_HOME%"\bin\java %JAVA_OPTIONS% -Xmx256m -jar org.eclipse.osgi_3.2.2.R32x_v20070118.jar -console

********** Or create enviroment value **********
JAVA_OPTION / -Xmx256m


===== There is another option for it ======================

http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=15&t=000785

You can increase heap size for tomcat by setting an environment variable for that
1. right click on My Computer icon
2. click properties option
3. click advanced tab
4. click Environment Variables button
5. click New button under System Variables
6. type JAVA_OPTS in the Variable Name box
7. type -Xms512m -Xmx128m in the variable value box
8. click Ok and then Ok and then Ok
enjoy …

++++++++++++ incluses heap size of Tomcat +++++++++++++++++

http://www.chemaxon.com/jchem/doc/admin/tomcat.html

Summary
1. Right button click from "my computer" in window explore
2. Click property
3. click advance tab
4. click Enviroment variable
5. create classpath variable
6. variable name > "CATALINA_OPTS"
variable value > "-server -Xmx128m"



3.1 Recommended JVM options
There are two important Java options which should be set for Tomcat.
Maximum heap size: this is the maximum amount of heap memory the Java Virtual Machine (JVM)
is allowed to allocate.
In the case of most JVMs, the default setting of the maximum heap size is 64MB.
You can increase the maximum heap size of applications by setting the -Xmx JVM parameter.
For example -Xmx1024m allows maximum 1GB (1024MB) heap to be allocated for the JVM.

Note: it is recommended to specify a considerably lower value than the amount
of physical RAM in your system,
so the operating system and other applications will also have enough space.
Otherwise the swap memory of the operating system will be used,
which can result in high disk activity, and reduced system performance.

Server mode: server mode instructs the JVM to perform more extensive run-time optimization.
Right after startup it means a slightly slower execution,
but after the JVM had enough time to optimize the code,
the execution will be considerably faster.

3.2 Setting JVM options for Tomcat

Windows running Tomcat 5 and later : Go to the "Apache Tomcat 5.0" folder in the Start Menu.
Start the "Configure Tomcat application".
Note: the configuration can only be started when Tomcat is not running.
Select the "Java VM" tab in the configuration dialog.
You will see some pre-defined lines in the "Java Options" test box.
Append your Java options at the bottom of the option list. For example,
to set server mode and allow 512MB of heap memory, append the following:
-server
-Xmx400m

Windows running Tomcat 4.1 or earlier :
place the Java options into the CATALINA_OPTS environment variable.
To do this, run Control Panel / System, select Environment Variables and
create the CATALINA_OPTS variable,
and set the desired option, for example "-server -Xmx400m".
Linux : place the Java options into the CATALINA_OPTS environment variable.
For example: "-server -Xmx400m".

sample ant file

<?xml version="1.0" encoding="UTF-8"?>
<project name="myTest" default="all">
<property name="title" value="myTest"/>
<property name="debug" value="true"/>
<property name="jar.name" value="myTest.jar"/>
<property name="libs.location" value="lib"/>
<path id="project.classpath">
<pathelement location="."/>
<pathelement location="${libs.location}/framework.jar"/>
<pathelement location="${libs.location}/servlet.jar"/>
<pathelement location="${libs.location}/http_all-2.0.0.jar"/>
</path>
<target name="all" depends="init,compile,jar"/>
<target name="init">
<mkdir dir="./classes"/>
</target>
<target name="compile">
<echo>${libs.location}</echo>
<javac destdir= "./classes" debug = "on">
<src path= "./src"/>
<classpath refid = "project.classpath"/>
</javac>
</target>
<target name="jar">
<jar basedir = "./classes"
jarfile = "${jar.name}"
compress = "true"
includes = "**/*"
manifest = "./META-INF/MANIFEST.MF"
/>
</target>
<target name="clean">
<delete dir = "./classes"/>
</target>
</project>



******************************************************************************

<?xml version="1.0"?>
<project name="MyPrinterWorkspace" default="all">

<property name="services" value="../MyPrinterWorkspace"/>
<property name="libs" value="./lib"/>

<path id="project.classpath">
<pathelement location="."/>
<pathelement location="${libs}/framework.jar"/>
<pathelement location="${libs}/servlet.jar"/>
<pathelement location="${libs}/http_all-2.0.0.jar"/>
<pathelement location="${libs}/himalaya-bundle.jar"/>
<pathelement location="./SESPControls.jar"/>
<pathelement location="./com.samsung.dpd.everest.core_0.2.0.u2a.jar"/>
<pathelement location="./com.samsung.dpd.everest.portability_0.2.0.u1aRC2.jar"/>
</path>

<target name="all" depends="init,compile,jar"/>

<target name="init">
<mkdir dir="./classes"/>
</target>

<target name="compile">
<javac destdir= "./classes" debug = "on">
<src path= "./src"/>
<classpath refid = "project.classpath"/>
</javac>
</target>

<target name="jar">
<jar basedir = "./classes"
jarfile = "./myprinterworkspace.jar"
compress = "true"
includes = "**/*"
manifest = "./META-INF/MANIFEST.MF"
/>
</target>

<target name="clean">
<delete dir = "./classes"/>
</target>

</project>

Monday 6 August 2007

dependence package information

- MyPrinterWorkspace (copy folder from cc - label : SESP_Rel_S2.1_HQ)

- Create Plug-in

- Import copied MyPrinterWorkspace folder

- needed jar file
* should be located in package folder and link by Window > Preference > Plug-In Development > Target Platform >
Add (button) > File System > link in jar file folder

com.samsung.dpd.everest.core_0.2.0.u2a.jar
com.samsung.dpd.everest.portability_0.2.0.u1aRC2.jar
com.samsung.dpd.himalaya_0.2.0.u2a.jar
org.eclipse.equinox.http_1.0.100.v20061218.jar
org.eclipse.equinox.log_1.0.100.v20060717.jar
org.eclipse.equinox.servlet.api_1.0.0.v20060717.jar
sespcontrols.jar
com.samsung.dpd.winslow.common_0.1.7.a.jar
com.samsung.dpd.winslow.doctreestream_0.1.5.a.jar
com.samsung.dpd.winslow.jobmanagement_0.1.5.a.jar
com.samsung.dpd.winslow.portabilitysim_0.0.0.a.jar
com.samsung.dpd.winslow.scan_0.1.5.a.jar
com.samsung.dpd.winslow.store_0.1.5.a.jar
com.samsung.dpd.winslow.system_0.1.5.a.jar
com.samsung.dpd.winslow.tiffcomposer_0.1.5.a.jar

- go to Window > Preference > Plug-In Development > Target Platform
only check
com.samsung.dpd.everest.core
com.samsung.dpd.everest.portability
com.samsung.dpd.himalaya
com.samsung.dpd.winslow.common
com.samsung.dpd.winslow.doctreestream
com.samsung.dpd.winslow.jobmanagement
com.samsung.dpd.winslow.portabilitysim
com.samsung.dpd.winslow.scan
com.samsung.dpd.winslow.store
com.samsung.dpd.winslow.system
com.samsung.dpd.winslow.tiffcomposer
javax.servlet
org.eclipse.equinox.http
org.eclipse.equinox.http.servlet
org.eclipse.equinox.log
org.eclipse.osgi
org.eclipse.osgi.services
org.eclipse.osgi.util
SESPControls


- From MANIFEST.MF
- Dependencies > Imported Packages > Add
com.samsung.dpd.Controls,
com.samsung.dpd.everest.core,
com.samsung.dpd.everest.core.basics,
com.samsung.dpd.everest.core.collections,
com.samsung.dpd.everest.core.device,
com.samsung.dpd.everest.core.device.printer,
com.samsung.dpd.everest.core.device.scanner,
com.samsung.dpd.everest.core.device.store,
com.samsung.dpd.everest.core.events,
com.samsung.dpd.everest.core.imagebasics,
com.samsung.dpd.everest.core.jobmanagement,
com.samsung.dpd.everest.core.lifecycle,
com.samsung.dpd.everest.core.mfpbasics,
com.samsung.dpd.everest.core.support,
com.samsung.dpd.everest.core.systembasics,
com.samsung.dpd.everest.core.work,
com.samsung.dpd.everest.core.work.common,
com.samsung.dpd.everest.core.work.printing,
com.samsung.dpd.everest.core.work.retrieving,
com.samsung.dpd.everest.core.work.scanning,
com.samsung.dpd.everest.core.work.storing,
com.samsung.dpd.winslow.common,
javax.servlet;version="2.4.0",
javax.servlet.http;version="2.4.0",
org.osgi.framework;version="1.4.0",
org.osgi.service.http;version="1.2.0"


- Run AS > Open Run Diagram
check all Target Platform

com.samsung.dpd.everest.core
com.samsung.dpd.everest.portability
com.samsung.dpd.himalaya
com.samsung.dpd.winslow.common
com.samsung.dpd.winslow.doctreestream
com.samsung.dpd.winslow.jobmanagement
com.samsung.dpd.winslow.portabilitysim
com.samsung.dpd.winslow.scan
com.samsung.dpd.winslow.store
com.samsung.dpd.winslow.system
com.samsung.dpd.winslow.tiffcomposer
javax.servlet
org.eclipse.equinox.http
org.eclipse.equinox.http.servlet
org.eclipse.equinox.log
org.eclipse.osgi
org.eclipse.osgi.services
org.eclipse.osgi.util
SESPControls

- Click Run

- You will see this console
osgi> ss

Framework is launched.

id State Bundle
0 ACTIVE org.eclipse.osgi_3.3.0.v20070530
2 ACTIVE org.eclipse.equinox.http_1.0.100.v20061218
3 ACTIVE org.eclipse.equinox.log_1.0.100.v20060717
14 ACTIVE MyPrinterWorkspace_1.0.0
24 ACTIVE org.eclipse.osgi.services_3.1.200.v20070605
28 ACTIVE org.eclipse.equinox.http.servlet_1.0.0.v20070606
29 ACTIVE org.eclipse.osgi.util_3.1.200.v20070605
31 ACTIVE javax.servlet_2.4.0.v200706111738
32 ACTIVE SESPControls_1.0.0
33 ACTIVE com.samsung.dpd.winslow.portabilitysim_0.0.0.a
34 ACTIVE com.samsung.dpd.winslow.jobmanagement_0.1.5.a
35 ACTIVE com.samsung.dpd.everest.portability_0.2.0.u1aRC2
36 ACTIVE com.samsung.dpd.winslow.system_0.1.5.a
37 ACTIVE com.samsung.dpd.everest.core_0.2.0.u2a
38 ACTIVE com.samsung.dpd.winslow.tiffcomposer_0.1.5.a
39 ACTIVE com.samsung.dpd.himalaya_0.2.0.u2a
40 ACTIVE com.samsung.dpd.winslow.doctreestream_0.1.5.a
41 ACTIVE com.samsung.dpd.winslow.store_0.1.5.a
42 ACTIVE com.samsung.dpd.winslow.scan_0.1.5.a
43 ACTIVE com.samsung.dpd.winslow.common_0.1.7.a


* Kill IIS server
http://localhost/MyPrinterWorkspace
==================================================================================================

- YahooDemo

- Copy all file of YahooDemo

- Create Plug-in

- Import YahooDemo

- Change Activator name : com.samsung.dpd.sesp.samples.yahoodemo.Activator

- - needed jar file
* should be located in package folder and link by Window > Preference > Plug-In Development > Target Platform >
Add (button) > File System > link in jar file folder

org.eclipse.equinox.http_1.0.100.v20061218.jar
org.eclipse.equinox.log_1.0.100.v20060717.jar
org.eclipse.equinox.servlet.api_1.0.0.v20060717.jar


- go to Window > Preference > Plug-In Development > Target Platform
only check

javax.servlet
org.eclipse.equinox.http
org.eclipse.equinox.http.servlet
org.eclipse.equinox.log
org.eclipse.osgi
org.eclipse.osgi.services
org.eclipse.osgi.util

- From MANIFEST.MF
- Dependencies > Imported Packages > Add
javax.servlet;version="2.4.0",
javax.servlet.http;version="2.4.0",
org.osgi.framework;version="1.3.0",
org.osgi.service.http;version="1.2.0"

- Run AS > Open Run Diagram
check all Target Platform

javax.servlet;version="2.4.0",
javax.servlet.http;version="2.4.0",
org.osgi.framework;version="1.3.0",
org.osgi.service.http;version="1.2.0"

- You will see this console
osgi> ss

Framework is launched.

id State Bundle
0 ACTIVE org.eclipse.osgi_3.3.0.v20070530
2 ACTIVE org.eclipse.equinox.http_1.0.100.v20061218
3 ACTIVE org.eclipse.equinox.log_1.0.100.v20060717
24 ACTIVE org.eclipse.osgi.services_3.1.200.v20070605
28 ACTIVE org.eclipse.equinox.http.servlet_1.0.0.v20070606
29 ACTIVE org.eclipse.osgi.util_3.1.200.v20070605
31 ACTIVE javax.servlet_2.4.0.v200706111738
32 ACTIVE YahooDemo

* Kill IIS server
http://localhost/main.html

eclipse start option

change the short cut option

From :

C:\eclipse\eclipse.exe

******** For assign lots of memory ********
D:\eclipse-rcp-europa-win32\eclipse\eclipse.exe -vmargs -Xms512m -Xmx512m

**** When Eclipse display "Out Of Memory Exception : Heap Space" *****
To :
eclipse [platform options] [-vmargs [Java VM arguments]]

eclipse.exe -vm %JAVA_HOME%\jre\bin\javaw.exe -vmargs -Xmx512M

Tuesday 24 July 2007

dos command - javac -classpath

If you want to specify two classpath file,

javac -classpath equinox.jar;MoviesInterface.jar osgitut/movies/impl/*.java

Sunday 22 July 2007

Basic - OSGI programming

http://neilbartlett.name/blog/osgi-articles/

http://www.eclipsezone.com/eclipse/forums/t90365.html

Wednesday 18 July 2007

basic concept of Ant

first : http://www.javastudy.co.kr/docs/lec_oop/ant/ant1.htm

second : http://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html

Wednesday 11 July 2007

JDK version confilict

** Error Message **

Generated servlet error:
bad class file: C:\Program Files\Java\jre1.5.0_04\lib\rt.jar(java/lang/Object.class)
class file has wrong version 49.0, should be 48.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public final class write_jsp extends org.apache.jasper.runtime.HttpJspBase


*** Reason ***
Installed JDK 1.4 and JDK 1.5 and it is conflicted.

*** Solution ***
Please clear JDK 1.4 and JDK 1.5
(Remove JDK 1.4 and Reinstall JDK 1.5)

1 open regedit
2 HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment > defined VM
3 delete all key under JavaSoft
4 And reinstall JDK

- Also tomcat has the location for VM...

Also you have to change jre setting. It should be a JDK folder (ex : C:\Program Files\Java\jdk1.5.0_12\jre)
this plugin launches Tomcat using the default JRE checked in Eclipe preferences window. To set a JDK as default JRE for Eclipse open the preference window : Window -> Preferences -> Java -> Installed JREs.
This JRE must be a JDK (This is a Tomcat prerequisite).

** Study **
Q)
자바 프로그램을 만들고 도스 상에서 java 라고 명령을 치는데요.
제가 path 나 classpath 등 환경변수를 모두 삭제하고 해봤거든요.
그런데 다른건 다 안되는데 java 명령은 실행이 되는 겁니다.

그래서 이번엔 program files\java\ ... 안의 jvm.dll 파일을 삭제하고
java 명령을 내려보니까
program files\java\bin\client 안에 jvm.dll 이 없어서 실행이 안된다는
메세지가 나오더라구요.

그래서 아! java 명령은 자바 런타임 환경(Jre) 하고 관련이 있는가
싶거든요. 그런데 java.exe 파일이 path 설정된 것도 아닌데
왜 어떻게 program files 안의 Jre 와 관련이 있는지 이해가 안갑니다.

A)
가장 정확하게 아실려면... src.zip 파일을 열어서 그 안에 launcher 폴더 내의 c 코드를 분석하면 가장 잘 이해할 수 있습니다...

일단 java.exe가 자바 바이너리를 구동하기에는 가장 먼저 jvm.dll이 필요하구요 그리고 해당 몇 가지 추가적인 dll 그리고 API들의 바이너리를 가지고 있는 jar 또는 zip 파일들이 필요합니다...

저두 정확하게 무엇이 필요하며 무엇이 필요없는지 알 수 없습니다... ㅡ.ㅡ;;

일단 java_md.c 파일을 잠깐 분석해보면... jvm.dll을 찾기 위해 그리고 Java_Home을 찾기 위해 Windows일 경우에는 레지스트리를 찾아갑니다... 기본적으로

HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Environment

아래의 CurrentVersion이라는 이름의 값을 봅니다.. 저는 현재 1.4입니다. 그리면 그 아래 키로 1.4가 있는지 찾죠.. 그 키 아래 Java_Home이라는 이름의 값을 봅니다... 있다면 이것이 Java_Home으로 인식합니다.. 저의 경우에는..

C:\Program Files\Java\j2re1.4.2_02

이였습니다...

다음은 .. jvm.dll을 찾습니다.. 먼저 Java_Home 아래의 lib 디렉토리를 찾습니다. 그리고 Windows일 경우 i386이라는 디렉토리 아래에 jvm.cfg를 살펴봅니다... 제경우 그 파일안에 다음과 같이 적혀 있습니다..

-client KNOWN
-server KNOWN
-hotspot ALIASED_TO -client
-classic WARN
-native ERROR
-green ERROR

여기서 jvm의 이름 또는 참조 장소를 말하고 있습니다... KNOWN은 아마 존재한다 또는 사용할 수 있다라는 의미인듯하구요... WARN이나 ERROR인 경우는 오류를 내겠다는 의미인듯합니다... 그리고 ALIAED_TO는 별칭된 이름과 동일하다라는 의미입니다...

위 목록중에서 가장 빠른 KNOWN으로 설정된 jvm이 선택됩니다... 여기선 client이죠 그러면 Java_Home 아래 bin 아래 client 디렉토리에 있는 jvm.dll이 jvm으로 로딩되고 그리고 JNI를 사용하여 해당 main class를 로딩하여 main함수를 호출합니다...

앗 그리고 jvm이 로딩되기 이전에 classpath와 여러가지 옵션등이 추가되게 됩니다...

Monday 2 July 2007

How you can use ObJectRelationalBridge – OJB

Apache ObJectRelationalBridge (OJB) is an Object/Relational mapping tool that allows transparent persistence for Java Objects against relational databases.

Main Web site
http://db.apache.org/ojb/

Download File

Sunday 1 July 2007

Converter between XML Object and String Object

=== From Body ===
var xmlStringConverterObj = new xmlStringConverter();
var metaData_String = xmlStringConverterObj.xmlToString(this is xml object location);

==== From JS File ===

xmlStringConverter = function () {

this.browserOption = "";
if (window.ActiveXObject) {
this.browserOption = 0;
} else {
this.browserOption = 1;
}
}

xmlStringConverter.prototype = {

xmlToString: function(xmlObj) {
var result = "";
if (this.browserOption == 0)
{
result = xmlObj.xml;
} else {
result = (new XMLSerializer()).serializeToString(xmlObj);
}
return result;
},

stringToXml: function(stringObj) {
var result;
var xmlObj;

if (this.browserOption == 0)
{
xmlObj = new ActiveXObject("Microsoft.XMLDOM");
xmlObj.async = false;
xmlObj.loadXML(stringObj);
} else {
var parser=new DOMParser();
xmlObj = parser.parseFromString(stringObj,"text/xml");
}
return xmlObj;
}
}

Javascript Modal Window

This javascript modal window is working under IE, Firefox, Nescape.

=== From Body ====
window.modal("SaveAsXML.htm", "height=270,width=460,toolbars=0,resizable=0,top=200,left=100");


=== From JS File ====
function modal(url,feature)
{
dialog(url,"",feature,true);
return false;
}

function dialog(url,name,feature,isModal)
{
if(url==null){return false;}
url = url
if(name==null){name=""}
if(feature==null){feature=""};
if(window.showModelessDialog)
{
var WindowFeature = new Object();
WindowFeature["width"] = 400;
WindowFeature["height"] =400;
WindowFeature["left"] = "";
WindowFeature["top"] = "";
WindowFeature["resizable"] = "";

if(feature !=null && feature!="")
{
feature = ( feature.toLowerCase()).split(",");

for(var i=0;i< feature.length;i++)
{
if( feature[i].isArgument())
{
var featureName = feature[i].split("=")[0];
var featureValue = feature[i].split("=")[1];

if(WindowFeature[featureName]!=null){WindowFeature[featureName] = featureValue; }
}
}
}

if(WindowFeature["resizable"]==1 || WindowFeature["resizable"]=="1" || WindowFeature["resizable"].toString().toLowerCase()=="yes"){WindowFeature["resizable"] = "resizable:1;minimize:1;maximize:1;"}
if(WindowFeature["left"]!=""){WindowFeature["left"] ="dialogLeft:" + WindowFeature["left"] +"px;";}
if(WindowFeature["top"]!=""){WindowFeature["top"] ="dialogTop:" + WindowFeature["top"] +"px;"; }
if(window.ModelessDialog ==null){window.ModelessDialog = new Object() ; };
if(name!="")
{
if(window.ModelessDialog[name]!=null && !window.ModelessDialog[name].closed )
{
window.ModelessDialog[name].focus();
return window.ModelessDialog[name];
}
}
var F = WindowFeature["left"] +WindowFeature["top"] + "dialogWidth:"+WindowFeature["width"] +"px;dialogHeight:"+WindowFeature["height"]+"px;center:1;help:0;resizable:" + WindowFeature["resizable"] +";status:No;scroll:no;unadorned:0;edge: raised;border:thick;"

if(isModal)
{
window.showModalDialog(url,self,F);
return false;
}
else
{
window.ModelessDialog[name] = window.showModelessDialog(url,self,F);
return window.ModelessDialog[name];
}
}
else
{
if(document.getBoxObjectFor)
{


if(isModal)
{
var Modal = window.open(url,name,"modal=1," + feature);
var ModalFocus = function()
{
if(!Modal.closed){Modal.focus();}
else{Modal =null;window.removeEventListener(ModalFocus,"focus");ModalFocus = null; };
}
window.addEventListener( "focus",ModalFocus, false );
return false;
}
else
{
return window.open(url,name,"modal=1," + feature);
}
}
else
{
return window.open(url,name,feature);
}
//
}
return null;
}

==== From opener Window =====
if (window.dialogArguments)
{
var openerV = window.dialogArguments;
} else {
var openerV = window.opener;
}

var getParentValue = openerV.metaData;


Download JS File

Encode / Decode to base64 - Javascript js

/*
* Title -> JavaScript Base64 Encoder Decoder
* Author -> Paul Gration
* URL -> http://www.i-labs.org
* Email -> pmgration(at)i-labs.org
*/

function JavaScriptBase64()
{
var string;
var base64;

this.JavaScriptBase64 = function(string)
{
this.string = new String(string);
this.base64 = new Array('A','B','C','D','E','F','G','H',
'I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','X',
'Y','Z','a','b','c','d','e','f',
'g','h','i','j','k','l','m','n',
'o','p','q','r','s','t','u','v',
'w','x','y','z','0','1','2','3',
'4','5','6','7','8','9','*','/');
}

this.encode = function()
{
var binary = new String();
var result = new String();
for(i = 0; i < this.string.length; i++)
{
binary += String("00000000" + this.string.charCodeAt(i).toString(2)).substring(this.string.charCodeAt(i).toString(2).length);
}
for(i = 0; i < binary.length; i+=6)
{
var number = new Number();
var counter = new Number();
for(j = 0; j < binary.substring(i, i+6).length; j++)
{
for(k = 32; k >= 1; k-=(k/2))
{
if(binary.substring(i, i+6).charAt(counter++) == "1")
{
number += k;
}
}
}
result += this.base64[number];
}
return result;
}

this.decode = function()
{
var binary = new String();
var result = new String();
for(i = 0; i < this.string.length; i++)
{
for(j = 0; j < this.base64.length; j++)
{
if(this.string.charAt(i) == this.base64[j])
{
binary += String("000000" + j.toString(2)).substring(j.toString(2).length);
}
}
}
for(i = 0; i < binary.length; i+=8)
{
var number = new Number();
var counter = new Number();
for(j = 0; j < binary.substring(i, i+8).length; j++)
{
for(k = 128; k >= 1; k-=(k/2))
{
if(binary.substring(i, i+8).charAt(counter++) == "1")
{
number += k;
}
}
}
result += String.fromCharCode(number);
}
return result;
}
}
Download JS file

Encode / Decode to UTF 8 - Javascript js

===== Real Method Part ====
var changeValue = Utf8.encode(return_XML);

==== JS Part =====
var Utf8 = {

// public method for url encoding
encode : function (string) {
string = string.replace(/\r\n/g,"\n");
//var ss = string.toCharArray();
var utftext = "";

/*for (var i = 0; ss.length ;i++ )
{
utftext = ss[i];

if (utftext < 128) {
ss[i] = String.fromCharCode(ss[i]);
}
else if((ss[i] > 127) && (ss[i] < 2048)) {
ss[i] = String.fromCharCode((ss[i] >> 6) | 192);
ss[i] = String.fromCharCode((ss[i] & 63) | 128);
}
else {
ss[i] = String.fromCharCode((ss[i] >> 12) | 224);
ss[i] = String.fromCharCode(((ss[i] >> 6) & 63) | 128);
ss[i] = String.fromCharCode((ss[i] & 63) | 128);
}
}*/

for (var n = 0; n < string.length; n++) {

var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}

return utftext;
},

// public method for url decoding
decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;

while ( i < utftext.length ) {

c = utftext.charCodeAt(i);

if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}

}

return string;
}
}
Download js File

AJAX for workflow

This is introduction paper for how we can create Ajax component under XSLT UI enviroment.

Data is flowing as xml data.
In this case, the service from server side should return the data as XML format.

Download Presentation File

Download Ajax js component File

Remote Scanning Application for USB Connection

1 Introduction

For years technical integrators have struggled with installing different brands of scanners on a single network and letting users share those scanners in the same way that they share printers or MFP. People working at their own computers want to share any network scanner – scanning and importing directly into their own applications.
However, Samsung Electronics has the Network Scan software for supporting scanning work process under the network environments. But it does not support the connection of the scanner that is working with USB devices because Network Scan software did not implement with Twain interface. Therefore, it is required the Scanning software which is implemented with Twain interface and it also works web application so that user does not need to install application for scanning process because it can work with web browser.
1.1 Purpose
This document aim in specifying the “Remote Scanning Application for USB connection” developed for OJT Project in S/W 1 Lab. The document defines requirement specifications such as the project scope, purposes and the overall description. It also contains a user interface, functional, operational, other project issues that can be helpful in understanding the software requirement.

1.2 Scope

The title of this project is a Remote Scanning Application for USB connection that consists of three parts: the first part is a scanning management system which is for providing network web scan service to the user, the second part is user management system and the third part is folder management system.
This application supports Multi-User Connection System with Samsung MFP models of working class. The application is based on web environment that request web server and Database. But development of web server and Database for the application is out of this project. Therefore, the project is restricted only web application.


Download The File 1
Download The File 2
Download The File 3
Download The File 4
Download The File 5
Download The File 6
Download The File 7

My Simple UI Development Guide

-UI part is working with variable javascript components (js file : button, list and so on).

-Those components are gathered in container (UIManager component).

-Components are initialized and shown. All components are written in pure HTML/CSS/Javascript (method : getHTML).

-When the page (xsl file) is loading, all components and HTML representations are written into the page as HTML thus they are shown.

-DOM methods are used later. First components are generated as HTML (getHTML call).

-During page is loading this HTML is rendered and UIManager calls init method of each component (to bind JavaScript object and DOM objects)

-Also repaint method is used to adjust sizes and other stuff.

Download presition file

substring in xsl programming

* For loop from xsl files
<xsl:for-each select="/WSTResponse/Device">
<div id="detailDiv{@ID}">
ss
</div>
</xsl:for-each>

* Loop from style tag
<select name="Printer_name">
<xsl:for-each select="/WSTResponse/PluginInfo/WorkformParams/Param">
<option>
<xsl:attribute name="value">
<xsl:value-of select="value"/>
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="value"/>
</xsl:attribute>
<xsl:variable name="printer"><xsl:value-of select="value"/></xsl:variable>
<xsl:value-of select="substring($printer, 0, 30)"/>
</option>
</xsl:for-each>
</select>

xsl programming : increase parameter

* For loop from xsl files
<xsl:for-each select="/WSTResponse/Device">
<div id="detailDiv{@ID}">
ss
</div>
</xsl:for-each>

* Loop from style tag
<xsl:variable name = "a" >75</xsl:variable>

<xsl:for-each select="/WSTResponse/Device">
<xsl:variable name="rr"><xsl:number/></xsl:variable>
<xsl:if test="$rr = 1">
#detailDiv<xsl:value-of select="@ID"/> { right: 400px; top:<xsl:number value="75"/>px ; POSITION: absolute; }
</xsl:if>
<xsl:if test="$rr > 1">
#detailDiv<xsl:value-of select="@ID"/> { right: 400px; top:<xsl:number value="($rr*37)+38"/>px ; POSITION: absolute; }
</xsl:if>
</xsl:for-each>

DOM method

* What is different between getElementById and getElementsByName
Is it simple array or complex array ?
Simple array > getElementById
Complex array > getElemetnByName

Example : Simple array > getElementById)
<input id="test" value=“ss">
var Obj = document.getElementById("test").value;
alert( Obj );// display “ss”

Example : complex array > getElementByName)
<input name="test" value=“11">
<input name="test" value=“22">
<input name="test" value=“33">
<script language="javascript">
var obj = document.getElementsByName("test");
alert( obj[0].value); // display “11”
</script>

* Disable text box : <input type=text disabled>

function f_check(){
if(document.form.checkbutton.checked==true){
document.form.textbox.disabled = true; //Or
//document.textbox.disabled = true;
} else if(document.form.checkbutton.checked==false){
document.form.textbox.disabled = false; //Or
//document.textbox.disabled = false;
}
}
</script>
<body>
<form name='form'>
<input type='text' name='textbox'>
<input type='checkbox' name='checkbutton' onclick='f_check()‘>
</form>
</body>

Like HashTable

*  hasttable - Input
var selectedUser_Array = [];
selectedUser_Array[key1] = value1;
selectedUser_Array[key2] = value2;

*  hasttable - Get
for (var key in selectedUser_Array) {
alert(“key : “+key+” value : “+ selectedUser_Array[key]);
}

*  hasttable - Delte
delete (selectUser_Array[key]);

Get check box number / value

======= What did the user check =========
<input type="checkbox" name="userListCheck" value=“1" onClick="buttonUpdate()">
<input type="checkbox" name="userListCheck" value=“2" onClick="buttonUpdate()">
………..
………..
--- Javascript ----
function buttonUpdate() {
var checkboxLength = document.getElementsByName("userListCheck").length;

for (var i = 0; i < checkboxLength ; i++ ) {
if (document.getElementsByName("userListCheck")[i].checked == true) {
//Do something when the check box is checked over one
//such as > UIManager.getInstance().getControl("RemoveButton").setEnabled(true);
break;
} else {
//Do something when the check box is not checked anything
//UIManager.getInstance().getControl("RemoveButton").setEnabled(false);
}
}
}

======= Get check value =========
---- HTML Part ----
<input type="checkbox" name="userListCheck" value=“1" onClick="buttonUpdate()">
<td width="270" class="Base1" id="userListName1" value=“1'">
<p>name</p></td>
<input type="checkbox" name="userListCheck" value=“2" onClick="buttonUpdate()">
<td width="270" class="Base1" id="userListName2" value=“2'">
<p>name</p></td>

………..

---- Javascript ----
function buttonUpdate() {
var checkboxLength = document.getElementsByName("userListCheck").length;

for (var i = 0; i < checkboxLength ; i++ ) {
if (document.getElementsByName("userListCheck")[i].checked != true) {
selectedValue = document.getElementsByName("userListCheck")[i].value;
selectedName = document.getElementById("userListName"+selectedValue).value;}
}
}
}

Check text number in Textarea field

function textCounter(field, countfield, maxlimit) {
if (field.value.length >= maxlimit) {
alert("Over your writting.");
if (field.value.length > maxlimit ) {
field.value = field.value.substring(0, maxlimit-1)   
}  
} else {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
}

Change image file by clicking 1

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script language="javascript">
function chgImg(){
var cur_img = document.nemo.src;
var get_filename = cur_img.substr(143); //split string
if (get_filename == "workform_top1.gif") {
document.nemo.src = "workform_top2.gif";
} else {
document.nemo.src = "workform_top1.gif";
}
}
</script>
</HEAD>
<BODY>
<img name="nemo" src="workform_top1.gif" onClick="javascript:chgImg();" width="560" height="22">
</BODY>
</HTML>

============ 2 =======================

<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script language="javascript">
    var img = new Array("1.gif","2.gif");
    var i;   
i=0;

function chgImg() {
      document.nemo.src = img[i++];
     //document.images[0].src = img[i++];possible.
}
</script>
</HEAD>
<BODY>
     <img name="nemo" src="1.gif" onClick="javascript:chgImg();">
</BODY>
</HTML>

============= 3=====================
function showDetail(value) {
var get_param = "document."+"imgExtend" + value+ ".src";
//eval(‘document’+value).style.right = 400;
var get_img = eval(get_param);
var get_img_file = get_img.substr(72);
var get_id = "imgID"+value;
var ss = document.getElementById(get_id);

if (get_img_file == "libr_mainBar_ico2.gif" ) {
ss.src = "../../lib/rc/image/img/Workform_library/libr_mainBar_ico1.gif";
} else {
ss.src = "../../lib/rc/image/img/Workform_library/libr_mainBar_ico2.gif";
}
}

<a href="#" onclick="showDetail('{@ID}')">
<img name="imgExtend{@ID}" id="imgID{@ID}" src="../../lib/rc/image/img/Workform_library/libr_mainBar_ico2.gif" border="0" />
</a>

Friday 29 June 2007

New model of JSP programming using custom tag and eXcelon Database for XML

KI YOUNG HWANG
Department of Computing
University of Surrey, Guildford, Surrey, GU2 5XH, UK

The problem of web programming is that the source code is mixed with HTML and programming script. It makes the difficulty to manage and analyze. In this project, I suggest new model of JSP web programming using custom tag, JRun(Web server), and eXcelon(XML Database). All data are stored as XML data and it is appeared to user by XSLT with XPath. A programming script and HTML source is separated as a component. It improves reuse of each component, even the XSLT (view part) file can be reused with other component of java source. There is another advantage. The JSP source is very simple to analyze for the person who does not have knowledge of program. They can modify the source easily. Therefore, it leads saving the time to manage.

DOWNLOAD Presendation File

DOWNLOAD Paper File

Input only number value (숫자만 입력)

<form name=f>
<input type=text name=t size=20
onKeyDown="return checkKey(event.keyCode);">
</form>
<script language=javascript>
function checkKey(key) {
if ((key >= 48 && key <= 57) // 키보드 상단 숫자키
(key >= 96 && key <= 105) // 키패드 숫자키
key == 8 // 백스페이스 키
key == 37 // 왼쪽 화살표 키
key == 39 // 오른쪽 화살표 키
key == 46 // DEL 키
key == 13 // 엔터 키
key == 9 // Tab 키
) {
return true;
} else {
// alert(key);
return false;
}
}
</script>

=============== 숫자여부 체크 ==============================

function numcheck(check_num) {
var inText = check_num.value;
var ret;

for (var i=0; i<inText.length; i++) {
ret = inText.charCodeAt(i);
if ((ret<48) || (ret>57)) {
alert("숫자로만 기입하여 주시기 바랍니다.");
check_num.value = "";
check_num.focus();
return false
} // if 문
}
}