Package javax.naming

Examples of javax.naming.RefAddr


        throws Exception {
       
        if (obj instanceof ResourceRef) {
            Reference ref = (Reference) obj;
            ObjectFactory factory = null;
            RefAddr factoryRefAddr = ref.get(Constants.FACTORY);
            if (factoryRefAddr != null) {
                // Using the specified factory
                String factoryClassName =
                    factoryRefAddr.getContent().toString();
                // Loading factory
                ClassLoader tcl =
                    Thread.currentThread().getContextClassLoader();
                Class factoryClass = null;
                if (tcl != null) {
View Full Code Here


        // Can we process this request?
        Reference ref = (Reference) obj;

        // Read the global ref addr
        String globalName = null;
        RefAddr refAddr = ref.get(ResourceLinkRef.GLOBALNAME);
        if (refAddr != null) {
            globalName = refAddr.getContent().toString();
            Object result = null;
            result = globalContext.lookup(globalName);
            // FIXME: Check type
            return result;
        }
View Full Code Here

        throws Exception {
       
        if (obj instanceof TransactionRef) {
            Reference ref = (Reference) obj;
            ObjectFactory factory = null;
            RefAddr factoryRefAddr = ref.get(Constants.FACTORY);
            if (factoryRefAddr != null) {
                // Using the specified factory
                String factoryClassName =
                    factoryRefAddr.getContent().toString();
                // Loading factory
                ClassLoader tcl =
                    Thread.currentThread().getContextClassLoader();
                Class factoryClass = null;
                if (tcl != null) {
View Full Code Here

                try {

                    Resources resources =
                        getTransactionDomain().getResources();
                    RefAddr nameAddr = ref.get(RESOURCE_NAME);
                    if (nameAddr != null) {
                        return resources
                            .getResource(nameAddr.getContent().toString())
                            .getClientFactory();
                    } else {
                        return resources.getResource(DEFAULT_RESOURCE_NAME)
                            .getClientFactory();
                    }
View Full Code Here

        throws Exception {
       
        if (obj instanceof ResourceEnvRef) {
            Reference ref = (Reference) obj;
            ObjectFactory factory = null;
            RefAddr factoryRefAddr = ref.get(Constants.FACTORY);
            if (factoryRefAddr != null) {
                // Using the specified factory
                String factoryClassName =
                    factoryRefAddr.getContent().toString();
                // Loading factory
                ClassLoader tcl =
                    Thread.currentThread().getContextClassLoader();
                Class factoryClass = null;
                if (tcl != null) {
View Full Code Here

                Object bean = beanClass.newInstance();
               
                Enumeration e = ref.getAll();
                while (e.hasMoreElements()) {
                   
                    RefAddr ra = (RefAddr) e.nextElement();
                    String propName = ra.getType();
                   
                    if (propName.equals(Constants.FACTORY) ||
                        propName.equals("scope") || propName.equals("auth")) {
                        continue;
                    }
                   
                    String value = (String)ra.getContent();
                   
                    Object[] valueArray = new Object[1];
                   
                    int i = 0;
                    for (i = 0; i<pda.length; i++) {
View Full Code Here

                    Properties props = new Properties();
                    props.put("mail.transport.protocol", "smtp");
                    props.put("mail.smtp.host", "localhost");
                    Enumeration attrs = ref.getAll();
                    while (attrs.hasMoreElements()) {
                        RefAddr attr = (RefAddr) attrs.nextElement();
                        if ("factory".equals(attr.getType()))
                            continue;
                        props.put(attr.getType(), (String) attr.getContent());
                    }

                    // Create and return the new Session object
                    Session session = Session.getInstance(props, null);
                    return (session);
View Full Code Here

       
        if (obj instanceof EjbRef) {
            Reference ref = (Reference) obj;

            // If ejb-link has been specified, resolving the link using JNDI
            RefAddr linkRefAddr = ref.get(EjbRef.LINK);
            if (linkRefAddr != null) {
                // Retrieving the EJB link
                String ejbLink = linkRefAddr.getContent().toString();
                Object beanObj = (new InitialContext()).lookup(ejbLink);
                // Load home interface and checking if bean correctly
                // implements specified home interface
                /*
                String homeClassName = ref.getClassName();
                try {
                    Class home = Class.forName(homeClassName);
                    if (home.isInstance(beanObj)) {
                        System.out.println("Bean of type "
                                           + beanObj.getClass().getName()
                                           + " implements home interface "
                                           + home.getName());
                    } else {
                        System.out.println("Bean of type "
                                           + beanObj.getClass().getName()
                                           + " doesn't implement home interface "
                                           + home.getName());
                        throw new NamingException
                            ("Bean of type " + beanObj.getClass().getName()
                             + " doesn't implement home interface "
                             + home.getName());
                    }
                } catch (ClassNotFoundException e) {
                    System.out.println("Couldn't load home interface "
                                       + homeClassName);
                }
                */
                return beanObj;
            }
           
            ObjectFactory factory = null;
            RefAddr factoryRefAddr = ref.get(Constants.FACTORY);
            if (factoryRefAddr != null) {
                // Using the specified factory
                String factoryClassName =
                    factoryRefAddr.getContent().toString();
                // Loading factory
                ClassLoader tcl =
                    Thread.currentThread().getContextClassLoader();
                Class factoryClass = null;
                if (tcl != null) {
View Full Code Here

                    throw new MissingVersionNumberException();
                }
            }

            //version number MUST exist and it MUST be the same as AO_VERSION_STR_JMQ1
            RefAddr versionAddr = ref.get(REF_VERSION);
            if (versionAddr == null) {
                //version number does not exist
                throw new MissingVersionNumberException();
            } else {
                //version number does not match
                String version = null;
                if (!AO_VERSION_STR_JMQ1.equals (version = (String)versionAddr.getContent())) {
                    throw new UnsupportedVersionNumberException(version);
                }
                ((AdministeredObject)cf).storedVersion = version;
            }  
            String securityPort = DEFAULT;

            // retreive the security port value from the Reference
            RefAddr securityPortAddr = ref.get(REF_SECURITYPORT);
            if (securityPortAddr != null) {
                securityPort = (String)securityPortAddr.getContent();
            } else {
                //securityPort is missing - corrupted?
                throw new CorruptedConfigurationPropertiesException();
            }
            /*
 
View Full Code Here

     * Retrieves the value for each JMSX propertry from the Reference.
     * Enables the JMSX property in ConnectionFactory, if it is true.
     *
     */
    private void setJMSXProperties(ConnectionFactory cf, Reference ref) throws Exception {
        RefAddr addr = null;
        if (((addr = (ref.get(REF_JMSXUSERID))) != null) &&
            ("true".equals((String)addr.getContent())))
            cf.setProperty(ConnectionConfiguration.imqSetJMSXUserID, "true");
        if (((addr = (ref.get(REF_JMSXAPPID))) != null) &&
            ("true".equals((String)addr.getContent())))
            cf.setProperty(ConnectionConfiguration.imqSetJMSXAppID, "true");
        if (((addr = (ref.get(REF_JMSXPRODUCERTXID)))
            != null) && ("true".equals((String)addr.getContent())))
            cf.setProperty(ConnectionConfiguration.imqSetJMSXProducerTXID, "true");
        if (((addr = (ref.get(REF_JMSXCONSUMERTXID)))
            != null) && ("true".equals((String)addr.getContent())))
            cf.setProperty(ConnectionConfiguration.imqSetJMSXConsumerTXID, "true");
        if (((addr = (ref.get(REF_JMSXRCVTIMESTAMP)))
            != null) && ("true".equals((String)addr.getContent())))
            cf.setProperty(ConnectionConfiguration.imqSetJMSXRcvTimestamp, "true");
    }
View Full Code Here

TOP

Related Classes of javax.naming.RefAddr

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.