Package org.apache.catalina.deploy

Examples of org.apache.catalina.deploy.ContextEnvironment


        Tomcat.addServlet(ctx, "Bug53339", new Bug53339Servlet());
        ctx.addServletMapping("/*", "Bug53339");

        // Create the resource
        ContextEnvironment env = new ContextEnvironment();
        env.setName(Bug53339WsInbound.JNDI_NAME);
        env.setType(String.class.getName());
        env.setValue(Bug53339WsInbound.TEST_MESSAGE);
        ctx.getNamingResources().addEnvironment(env);

        tomcat.start();

        WebSocketClient client= new WebSocketClient(getPort());
View Full Code Here


                annotation.type().getCanonicalName().equals("java.lang.Short") ||
                annotation.type().getCanonicalName().equals("java.lang.Long") ||
                annotation.type().getCanonicalName().equals("java.lang.Float")) {
           
            // env-ref element
            ContextEnvironment resource = new ContextEnvironment();
           
            resource.setName(annotation.name());
            resource.setType(annotation.type().getCanonicalName());
           
            resource.setDescription(annotation.description());
           
            resource.setValue(annotation.mappedName());
           
            context.getNamingResources().addEnvironment(resource);
           
        } else if (annotation.type().getCanonicalName().equals("javax.xml.rpc.Service")) {
           
            // service-ref element
            ContextService service = new ContextService();
           
            service.setName(annotation.name());
            service.setWsdlfile(annotation.mappedName());
           
            service.setType(annotation.type().getCanonicalName());
            service.setDescription(annotation.description());
           
            context.getNamingResources().addService(service);
           
        } else if (annotation.type().getCanonicalName().equals("javax.sql.DataSource") ||
                annotation.type().getCanonicalName().equals("javax.jms.ConnectionFactory") ||
                annotation.type().getCanonicalName()
                .equals("javax.jms.QueueConnectionFactory") ||
                annotation.type().getCanonicalName()
                .equals("javax.jms.TopicConnectionFactory") ||
                annotation.type().getCanonicalName().equals("javax.mail.Session") ||
                annotation.type().getCanonicalName().equals("java.net.URL") ||
                annotation.type().getCanonicalName()
                .equals("javax.resource.cci.ConnectionFactory") ||
                annotation.type().getCanonicalName().equals("org.omg.CORBA_2_3.ORB") ||
                annotation.type().getCanonicalName().endsWith("ConnectionFactory")) {
           
            // resource-ref element
            ContextResource resource = new ContextResource();
           
            resource.setName(annotation.name());
            resource.setType(annotation.type().getCanonicalName());
           
            if (annotation.authenticationType()
                    == Resource.AuthenticationType.CONTAINER) {
                resource.setAuth("Container");
            }
            else if (annotation.authenticationType()
                    == Resource.AuthenticationType.APPLICATION) {
                resource.setAuth("Application");
            }
           
            resource.setScope(annotation.shareable() ? "Shareable" : "Unshareable");
            resource.setProperty("mappedName", annotation.mappedName());
            resource.setDescription(annotation.description());
           
            context.getNamingResources().addResource(resource);
           
        } else if (annotation.type().getCanonicalName().equals("javax.jms.Queue") ||
                annotation.type().getCanonicalName().equals("javax.jms.Topic")) {
           
            // message-destination-ref
            MessageDestinationRef resource = new MessageDestinationRef();
           
            resource.setName(annotation.name());
            resource.setType(annotation.type().getCanonicalName());
           
            resource.setUsage(annotation.mappedName());
            resource.setDescription(annotation.description());
           
            context.getNamingResources().addMessageDestinationRef(resource);
           
        } else if (annotation.type().getCanonicalName()
                .equals("javax.resource.cci.InteractionSpec") ||
                annotation.type().getCanonicalName()
                .equals("javax.transaction.UserTransaction") ||
                true) {
           
            // resource-env-ref
            ContextResourceEnvRef resource = new ContextResourceEnvRef();
           
            resource.setName(annotation.name());
            resource.setType(annotation.type().getCanonicalName());
           
            resource.setProperty("mappedName", annotation.mappedName());
            resource.setDescription(annotation.description());
           
            context.getNamingResources().addResourceEnvRef(resource);
           
        }
       
View Full Code Here

        contextTransaction.setProperty(Constants.FACTORY, UserTransactionFactory.class.getName());
        naming.setTransaction(contextTransaction);
    }

    public void mergeRef(NamingResources naming, EnvEntryInfo ref) {
        ContextEnvironment environment = naming.findEnvironment(ref.name);
        boolean addEntry = false;
        if (environment == null) {
            environment = new ContextEnvironment();
            environment.setName(ref.name);
            addEntry = true;
        }

        environment.setType(ref.type);
        environment.setValue(ref.value);

        if (addEntry) {
            naming.addEnvironment(environment);
        }

        if (replaceEntry) {
            ContextAccessController.setWritable(namingContextListener.getName(), standardContext);
            if (!addEntry) namingContextListener.removeEnvironment(environment.getName());
            namingContextListener.addEnvironment(environment);
            ContextAccessController.setReadOnly(namingContextListener.getName());
        }
    }
View Full Code Here

        } else if (type.equals("addEnvironment")) {

            String environmentName = (String) event.getData();
            if (environmentName != null) {
                ContextEnvironment env =
                    namingResources.findEnvironment(environmentName);
                addEnvironment(env);
            }

        } else if (type.equals("addLocalEjb")) {
View Full Code Here

                    addEjb(ejb);
                }
            }
        } else if (name.equals("environment")) {
            if (oldValue != null) {
                ContextEnvironment env = (ContextEnvironment) oldValue;
                if (env.getName() != null) {
                    removeEnvironment(env.getName());
                }
            }
            if (newValue != null) {
                ContextEnvironment env = (ContextEnvironment) newValue;
                if (env.getName() != null) {
                    addEnvironment(env);
                }
            }
        } else if (name.equals("localEjb")) {
            if (oldValue != null) {
View Full Code Here

        } catch (Throwable e) {
        }

        if (isLookupRef(naming, ref)) return;

        ContextEnvironment environment = naming.findEnvironment(ref.referenceName.replaceAll("^comp/env/", ""));
        boolean addEntry = false;
        if (environment == null) {
            environment = new ContextEnvironment();
            environment.setName(ref.referenceName.replaceAll("^comp/env/", ""));
            addEntry = true;
        }

        environment.setType(ref.type);
        environment.setValue(ref.value);
        environment.setOverride(false);

        if (addEntry) {
            naming.addEnvironment(environment);
        }

        if (replaceEntry) {
            ContextAccessController.setWritable(namingContextListener.getName(), standardContext);
            if (!addEntry) namingContextListener.removeEnvironment(environment.getName());
            namingContextListener.addEnvironment(environment);
            ContextAccessController.setReadOnly(namingContextListener.getName());
        }
    }
View Full Code Here

     *
     * @param environment New environment entry
     */
    public void addEnvironment(ContextEnvironment environment) {

        ContextEnvironment env = findEnvironment(environment.getName());
        if ((env != null) && !env.getOverride())
            return;
        namingResources.addEnvironment(environment);
        fireContainerEvent("addEnvironment", environment.getName());

    }
View Full Code Here

     */
    public void removeEnvironment(String name) {
        if (namingResources == null) {
            return;
        }
        ContextEnvironment env = namingResources.findEnvironment(name);
        if (env == null) {
            throw new IllegalArgumentException
                ("Invalid environment name '" + name + "'");
        }

View Full Code Here

        NamingResources nresources = getNamingResources();
        if (nresources == null) {
            return null;
        }
        ContextEnvironment env = nresources.findEnvironment(envName);
        if (env != null) {
            throw new IllegalArgumentException
                ("Invalid environment name - already exists '" + envName + "'");
        }
        env = new ContextEnvironment();
        env.setName(envName);
        env.setType(type);
        nresources.addEnvironment(env);

        // Return the corresponding MBean name
        ManagedBean managed = Registry.getRegistry(null, null)
            .findManagedBean("ContextEnvironment");
View Full Code Here

     *
     * @param environment New environment entry
     */
    public void addEnvironment(ContextEnvironment environment) {

        ContextEnvironment env = findEnvironment(environment.getName());
        if ((env != null) && !env.getOverride())
            return;
        namingResources.addEnvironment(environment);
        fireContainerEvent("addEnvironment", environment.getName());

    }
View Full Code Here

TOP

Related Classes of org.apache.catalina.deploy.ContextEnvironment

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.