LogUtils.DEBUG("Failed to create UrlReference factory");
throw new com.sun.star.lang.IllegalArgumentException( "Failed to create UrlReference factory for url " + scriptURI );
}
XUriReference uriRef = xFac.parse( scriptURI );
XVndSunStarScriptUrl sfUri = ( XVndSunStarScriptUrl )
UnoRuntime.queryInterface( XVndSunStarScriptUrl.class, uriRef );
if ( sfUri == null )
{
LogUtils.DEBUG("Failed to parse url");
throw new com.sun.star.lang.IllegalArgumentException( "Failed to parse url " + scriptURI );
}
ParsedScriptUri parsedUri = new ParsedScriptUri();
// parse language
parsedUri.language = sfUri.getParameter("language");
parsedUri.function= sfUri.getName();
parsedUri.parcel = "";
// parse parcel name;
StringTokenizer tokenizer = new StringTokenizer( parsedUri.function, "." );
if ( tokenizer.hasMoreElements() )
{
parsedUri.parcel = (String)tokenizer.nextElement();
LogUtils.DEBUG("** parcelName = " + parsedUri.parcel );
}
if ( parsedUri.function != null && ( parsedUri.function.length() > 0 ) )
{
// strip out parcel name
parsedUri.function = parsedUri.function.substring( parsedUri.parcel.length() + 1);
}
// parse location
parsedUri.location = sfUri.getParameter("location");
// TODO basic sanity check on language, location, functioname, parcel
// should be correct e.g. verified by MSP and LangProvider by the
// time its got to here