FileDocCategorySizeDatePackage
AdminObjectResourceDeployer.javaAPI DocGlassfish v2 API6263Fri May 04 22:35:14 BST 2007com.sun.enterprise.resource

AdminObjectResourceDeployer

public class AdminObjectResourceDeployer extends GlobalResourceDeployer implements com.sun.enterprise.server.ResourceDeployer
author
Srikanth P

Fields Summary
static Logger
_logger
Constructors Summary
Methods Summary
public synchronized voiddeployResource(java.lang.Object resource)
Deploy the resource into the server's runtime naming context

param
resource a resource object (eg. AdminObjectResource)
exception
Exception thrown if fail


                              
           

        final AdminObjectResource aor = 
           (com.sun.enterprise.config.serverbeans.AdminObjectResource)resource;
        final ConnectorRuntime crt = ConnectorRuntime.getRuntime();
        
        if (aor.isEnabled()) {
            //registers the jsr77 object for the mail resource deployed
            final ManagementObjectManager mgr = 
                getAppServerSwitchObject().getManagementObjectManager();
            mgr.registerAdminObjectResource(aor.getJndiName(), 
                aor.getResAdapter(), aor.getResType(), 
                getPropNamesAsStrArr(aor.getElementProperty()), 
                getPropValuesAsStrArr(aor.getElementProperty()));
        } else {
                _logger.log(Level.INFO, "core.resource_disabled",
                        new Object[] {aor.getJndiName(),
                        IASJ2EEResourceFactoryImpl.JMS_RES_TYPE});
        }
        
        _logger.log(Level.FINE,
            "Calling backend to add adminObject",aor.getJndiName());
        crt.addAdminObject(null,aor.getResAdapter(),aor.getJndiName(),
                aor.getResType(),transformProps(aor.getElementProperty()));
        _logger.log(Level.FINE,
            "Added adminObject in backend",aor.getJndiName());
    
public synchronized voiddisableResource(java.lang.Object resource)


    
public synchronized voidenableResource(java.lang.Object resource)

    
public java.lang.ObjectgetResource(java.lang.String name, com.sun.enterprise.config.serverbeans.Resources rbeans)

        Object res = rbeans.getAdminObjectResourceByJndiName(name);

        if (res == null) {
            Exception ex = new Exception("No such resource");
            _logger.log(Level.SEVERE,"no_resource",name);
            _logger.log(Level.SEVERE,"",ex);
            throw ex;
        }

        return res;
    
public synchronized voidredeployResource(java.lang.Object resource)

    
java.util.PropertiestransformProps(com.sun.enterprise.config.serverbeans.ElementProperty[] domainProps)

             
        Properties props = new Properties();
        for (ElementProperty domainProp : domainProps) {
            props.setProperty(domainProp.getName(), domainProp.getValue());
        }
        return props;
    
public synchronized voidundeployResource(java.lang.Object resource)
d


        final AdminObjectResource aor = 
           (com.sun.enterprise.config.serverbeans.AdminObjectResource)resource;
        final ConnectorRuntime crt = ConnectorRuntime.getRuntime();
        
        _logger.log(Level.FINE,
                   "Calling backend to delete adminObject",aor.getJndiName());
        crt.deleteAdminObject(aor.getJndiName());
        _logger.log(Level.FINE,
                   "Deleted adminObject in backend",aor.getJndiName());
        
        //unregister the managed object
        final ManagementObjectManager mgr =
                getAppServerSwitchObject().getManagementObjectManager();
        mgr.unregisterAdminObjectResource(aor.getJndiName(), aor.getResType());