Package com.sun.enterprise.resource.beans

Examples of com.sun.enterprise.resource.beans.AdministeredObjectResource


        if (logger.isLoggable(Level.FINE)) {
            logger.fine("AdministeredObjectFactory: " + ref
                    + " Name:" + name);
        }

        AdministeredObjectResource aor =
            (AdministeredObjectResource) ref.get(0).getContent();
        String moduleName = aor.getResourceAdapter();


        //If call fom application client, start resource adapter lazily.
        //todo: Similar code in ConnectorObjectFactory - to refactor.

        ConnectorRuntime runtime = ConnectorNamingUtils.getRuntime();
        if (runtime.isACCRuntime() || runtime.isNonACCRuntime()) {
            ConnectorDescriptor connectorDescriptor = null;
            try {
                Context ic = new InitialContext();
                String descriptorJNDIName = ConnectorAdminServiceUtils.
                        getReservePrefixedJNDINameForDescriptor(moduleName);
                connectorDescriptor = (ConnectorDescriptor) ic.lookup(descriptorJNDIName);
            } catch (NamingException ne) {
                if (logger.isLoggable(Level.FINE)) {
                    logger.log(Level.FINE, "Failed to look up ConnectorDescriptor "
                            + "from JNDI", moduleName);
                }
                throw new ConnectorRuntimeException("Failed to look up " +
                        "ConnectorDescriptor from JNDI");
            }
            runtime.createActiveResourceAdapter(connectorDescriptor, moduleName, null);
        }

        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        if (runtime.checkAccessibility(moduleName, loader) == false) {
          throw new NamingException("Only the application that has the embedded resource" +
                                 "adapter can access the resource adapter");

      }

        if(logger.isLoggable(Level.FINE)) {
      logger.fine("[AdministeredObjectFactory] ==> Got AdministeredObjectResource = " + aor);
        }

    // all RARs except system RARs should have been available now.
        if(ConnectorsUtil.belongsToSystemRA(moduleName)) {
            //make sure that system rar is started and hence added to connector classloader chain
            if(ConnectorRegistry.getInstance().getActiveResourceAdapter(moduleName) == null){
                String moduleLocation = ConnectorsUtil.getSystemModuleLocation(moduleName);
                runtime.createActiveResourceAdapter(moduleLocation, moduleName, null);
            }
            loader = ConnectorRegistry.getInstance().getActiveResourceAdapter(moduleName).getClassLoader();
        } else if(runtime.isServer()){
            if(ConnectorsUtil.isStandAloneRA(moduleName) ){
                loader = ConnectorRegistry.getInstance().getActiveResourceAdapter(moduleName).getClassLoader();
            }
        }
  return aor.createAdministeredObject(loader);
    }
View Full Code Here


        if(aoDesc==null){
          String msg = localStrings.getString("aor.could_not_determine_aor", adminObjectType, adminObjectClassName);
          throw new ConnectorRuntimeException(msg);
        }

        AdministeredObjectResource aor = new AdministeredObjectResource(resourceInfo);
        aor.initialize(aoDesc);
        aor.setResourceAdapter(connectorName);

        Object[] envProps = aoDesc.getConfigProperties().toArray();

        //Add default config properties to aor
        //Override them if same config properties are provided by the user
        for (int i = 0; i < envProps.length; i++) {
            ConnectorConfigProperty  envProp = (ConnectorConfigProperty ) envProps[i];
            String name = envProp.getName();
            String userValue = (String) props.remove(name);
            if (userValue != null)
                aor.addConfigProperty(new ConnectorConfigProperty (
                        name, userValue, userValue, envProp.getType()));
            else
                aor.addConfigProperty(envProp);
        }

        //Add non-default config properties provided by the user to aor
        Iterator iter = props.keySet().iterator();
        while (iter.hasNext()) {
            String name = (String) iter.next();
            String userValue = props.getProperty(name);
            if (userValue != null)
                aor.addConfigProperty(new ConnectorConfigProperty (
                        name, userValue, userValue));

        }

        // bind to JNDI namespace
        try {

            Reference ref = aor.createAdminObjectReference();
            connectorRuntime_.getResourceNamingService().publishObject(resourceInfo, ref, true);
        } catch (NamingException ex) {
            String i18nMsg = localStrings.getString(
                    "aira.cannot_bind_admin_obj");
            throw new ConnectorRuntimeException(i18nMsg);
View Full Code Here

            }
        }else{
            aoDesc = desc.getAdminObject(adminObjectType, adminObjectClassName);
        }

        AdministeredObjectResource aor = new AdministeredObjectResource(resourceInfo);
        aor.initialize(aoDesc);
        aor.setResourceAdapter(connectorName);

        Object[] envProps = aoDesc.getConfigProperties().toArray();

        //Add default config properties to aor
        //Override them if same config properties are provided by the user
        for (int i = 0; i < envProps.length; i++) {
            ConnectorConfigProperty  envProp = (ConnectorConfigProperty ) envProps[i];
            String name = envProp.getName();
            String userValue = (String) props.remove(name);
            if (userValue != null)
                aor.addConfigProperty(new ConnectorConfigProperty (
                        name, userValue, userValue, envProp.getType()));
            else
                aor.addConfigProperty(envProp);
        }

        //Add non-default config properties provided by the user to aor
        Iterator iter = props.keySet().iterator();
        while (iter.hasNext()) {
            String name = (String) iter.next();
            String userValue = props.getProperty(name);
            if (userValue != null)
                aor.addConfigProperty(new ConnectorConfigProperty (
                        name, userValue, userValue));

        }

        // bind to JNDI namespace
        try {

            Reference ref = aor.createAdminObjectReference();
            connectorRuntime_.getResourceNamingService().publishObject(resourceInfo, ref, true);
        } catch (NamingException ex) {
            String i18nMsg = localStrings.getString(
                    "aira.cannot_bind_admin_obj");
            throw new ConnectorRuntimeException(i18nMsg);
View Full Code Here

        if(aoDesc==null){
          String msg = localStrings.getString("aor.could_not_determine_aor", adminObjectType, adminObjectClassName);
          throw new ConnectorRuntimeException(msg);
        }

        AdministeredObjectResource aor = new AdministeredObjectResource(resourceInfo);
        aor.initialize(aoDesc);
        aor.setResourceAdapter(connectorName);

        Object[] envProps = aoDesc.getConfigProperties().toArray();

        //Add default config properties to aor
        //Override them if same config properties are provided by the user
        for (int i = 0; i < envProps.length; i++) {
            ConnectorConfigProperty  envProp = (ConnectorConfigProperty ) envProps[i];
            String name = envProp.getName();
            String userValue = (String) props.remove(name);
            if (userValue != null)
                aor.addConfigProperty(new ConnectorConfigProperty (
                        name, userValue, userValue, envProp.getType()));
            else
                aor.addConfigProperty(envProp);
        }

        //Add non-default config properties provided by the user to aor
        Iterator iter = props.keySet().iterator();
        while (iter.hasNext()) {
            String name = (String) iter.next();
            String userValue = props.getProperty(name);
            if (userValue != null)
                aor.addConfigProperty(new ConnectorConfigProperty (
                        name, userValue, userValue));

        }

        // bind to JNDI namespace
        try {

            Reference ref = aor.createAdminObjectReference();
            connectorRuntime_.getResourceNamingService().publishObject(resourceInfo, ref, true);
        } catch (NamingException ex) {
            String i18nMsg = localStrings.getString(
                    "aira.cannot_bind_admin_obj");
            throw new ConnectorRuntimeException(i18nMsg, ex);
View Full Code Here

            }
        }else{
            aoDesc = desc.getAdminObject(adminObjectType, adminObjectClassName);
        }

        AdministeredObjectResource aor = new AdministeredObjectResource(resourceInfo);
        aor.initialize(aoDesc);
        aor.setResourceAdapter(connectorName);

        Object[] envProps = aoDesc.getConfigProperties().toArray();

        //Add default config properties to aor
        //Override them if same config properties are provided by the user
        for (int i = 0; i < envProps.length; i++) {
            ConnectorConfigProperty  envProp = (ConnectorConfigProperty ) envProps[i];
            String name = envProp.getName();
            String userValue = (String) props.remove(name);
            if (userValue != null)
                aor.addConfigProperty(new ConnectorConfigProperty (
                        name, userValue, userValue, envProp.getType()));
            else
                aor.addConfigProperty(envProp);
        }

        //Add non-default config properties provided by the user to aor
        Iterator iter = props.keySet().iterator();
        while (iter.hasNext()) {
            String name = (String) iter.next();
            String userValue = props.getProperty(name);
            if (userValue != null)
                aor.addConfigProperty(new ConnectorConfigProperty (
                        name, userValue, userValue));

        }

        // bind to JNDI namespace
        try {

            Reference ref = aor.createAdminObjectReference();
            connectorRuntime_.getResourceNamingService().publishObject(resourceInfo, ref, true);
        } catch (NamingException ex) {
            String i18nMsg = localStrings.getString(
                    "aira.cannot_bind_admin_obj");
            throw new ConnectorRuntimeException(i18nMsg);
View Full Code Here

TOP

Related Classes of com.sun.enterprise.resource.beans.AdministeredObjectResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.