axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harsha Thirimanna <harsha.thirima...@gmail.com>
Subject [AXIS2] Most Perfectly When and Where we should load XSD Schema in WebService
Date Mon, 18 Jun 2012 10:07:52 GMT
Hi

Most Perfectly When and Where we should load XSD Schema in WebService.
Our XSD's are available in aar file so , we want to avoid load everytime
xsd when request coming.
We maintain the
private static ConcurrentHashMap<String,Schema> map = new
ConcurrentHashMap<String,Schema>();

private static Schema loadXSD(String xsd ){
        Schema schema =null;

        try {
            URL url = new URL(ServiceConfig.getServerURL()+ xsd);
            schema = factory.newSchema(url);
            map.put(xsd, schema);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return schema;
    }

public static Schema loadSchema(String xsd){
        Schema schema = map.get(xsd);
        if(schema==null){
            schema=loadXSD(xsd);
        }
        return schema;
    }

When request coming we can load Schema using this and reuse loaded one.
But finally because of the synchronization problem, we thought to load all
XSD atonce in ContextListner in the AXIS2 Web. But when it execute , aar is
not deployed. So how we do this.

thanks
harsha

Mime
View raw message