String endpoint = dialog.getEndpoint();
Endpoint _bean = EndpointFactory.getEndpoint(endpoint, EndpointFactory.SERVER_FACEBOOK);
if(!(_bean instanceof OAuthEndpoint)) {
throw new FacesExceptionEx("The Facebook endpopint must be a OAuthEndPoint");
}
OAuthEndpoint bean = (OAuthEndpoint)_bean;
writeJSSDK(context, component, bean);
}