Search in sources :

Example 6 with AdminObject

use of com.sun.enterprise.deployment.AdminObject in project Payara by payara.

the class AdministeredObjectResource method createAdministeredObject.

// called by com.sun.enterprise.naming.factory.AdministeredObjectFactory
// FIXME.  embedded??
public Object createAdministeredObject(ClassLoader jcl) throws PoolingException {
    try {
        if (jcl == null) {
            // use context class loader
            jcl = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {

                public Object run() {
                    return Thread.currentThread().getContextClassLoader();
                }
            });
        }
        Object adminObject = jcl.loadClass(adminObjectClass_).newInstance();
        AccessController.doPrivileged(new SetMethodAction(adminObject, configProperties_));
        // associate ResourceAdapter if the admin-object is RAA
        if (adminObject instanceof ResourceAdapterAssociation) {
            try {
                ResourceAdapter ra = ConnectorRegistry.getInstance().getActiveResourceAdapter(resadapter_).getResourceAdapter();
                ((ResourceAdapterAssociation) adminObject).setResourceAdapter(ra);
            } catch (ResourceException ex) {
                _logger.log(Level.SEVERE, "rardeployment.assoc_failed", ex);
            }
        }
        // At this stage, administered object is instantiated, config properties applied
        // validate administered object
        // ConnectorRuntime should be available in CLIENT mode now as admin-object-factory would have bootstapped
        // connector-runtime.
        ConnectorRuntime.getRuntime().getConnectorBeanValidator().validateJavaBean(adminObject, resadapter_);
        return adminObject;
    } catch (PrivilegedActionException ex) {
        throw (PoolingException) (new PoolingException().initCause(ex));
    } catch (Exception ex) {
        throw (PoolingException) (new PoolingException().initCause(ex));
    }
}
Also used : PoolingException(com.sun.appserv.connectors.internal.api.PoolingException) ResourceAdapterAssociation(javax.resource.spi.ResourceAdapterAssociation) PrivilegedAction(java.security.PrivilegedAction) PrivilegedActionException(java.security.PrivilegedActionException) ResourceAdapter(javax.resource.spi.ResourceAdapter) AdminObject(com.sun.enterprise.deployment.AdminObject) ResourceException(javax.resource.ResourceException) PoolingException(com.sun.appserv.connectors.internal.api.PoolingException) PrivilegedActionException(java.security.PrivilegedActionException) ResourceException(javax.resource.ResourceException) SetMethodAction(com.sun.enterprise.connectors.util.SetMethodAction)

Aggregations

AdminObject (com.sun.enterprise.deployment.AdminObject)6 Result (com.sun.enterprise.tools.verifier.Result)3 Set (java.util.Set)3 Iterator (java.util.Iterator)2 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)1 PoolingException (com.sun.appserv.connectors.internal.api.PoolingException)1 SetMethodAction (com.sun.enterprise.connectors.util.SetMethodAction)1 ConnectorConfigProperty (com.sun.enterprise.deployment.ConnectorConfigProperty)1 ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)1 EnvironmentProperty (com.sun.enterprise.deployment.EnvironmentProperty)1 AdministeredObjectResource (com.sun.enterprise.resource.beans.AdministeredObjectResource)1 PrivilegedAction (java.security.PrivilegedAction)1 PrivilegedActionException (java.security.PrivilegedActionException)1 NamingException (javax.naming.NamingException)1 Reference (javax.naming.Reference)1 ResourceException (javax.resource.ResourceException)1 AdministeredObject (javax.resource.spi.AdministeredObject)1 ResourceAdapter (javax.resource.spi.ResourceAdapter)1 ResourceAdapterAssociation (javax.resource.spi.ResourceAdapterAssociation)1