Package org.apache.tuscany.sca.host.http

Examples of org.apache.tuscany.sca.host.http.ServletHostExtensionPoint


*/
public class WebAppModuleActivator implements ModuleActivator {

    public void start(ExtensionPointRegistry extensionPointRegistry) {

        ServletHostExtensionPoint servletHosts =
            extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);

        List<ServletHost> hosts = servletHosts.getServletHosts();
        // Only add webapp host if no other host already registered (eg jetty in standalone)
        if (hosts != null && hosts.size() < 1) {
            hosts.add(new WebAppServletHost());
        }
    }
View Full Code Here


    }
   
    private static WebAppServletHost getServletHost(Node node) {
        NodeImpl nodeImpl = (NodeImpl) node;
        ExtensionPointRegistry eps = nodeImpl.getExtensionPoints();
        ServletHostExtensionPoint servletHosts = eps.getExtensionPoint(ServletHostExtensionPoint.class);
        List<ServletHost> hosts = servletHosts.getServletHosts();
        if (hosts == null || hosts.size() < 1) {
            throw new IllegalStateException("No ServletHost found");
        }
        ServletHost servletHost = hosts.get(0);
        if (!(servletHost instanceof WebAppServletHost)) {
View Full Code Here

    private ServletHost servletHost;
    private DataBindingExtensionPoint dataBindings;
    private String defaultPort = "8085";

    public JAXWSBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
        ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
        List<ServletHost> hosts = servletHosts.getServletHosts();
        if (!hosts.isEmpty()) {
            this.servletHost = hosts.get(0);
        }
        modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
        dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
View Full Code Here

    private ServletHost servletHost;
    private Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames = null;
    private DataBindingExtensionPoint dataBindings;

    public Axis2BindingProviderFactory(ExtensionPointRegistry extensionPoints) {
        ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
        List<ServletHost> hosts = servletHosts.getServletHosts();
        if (hosts.isEmpty()) {
            throw new ServiceRuntimeException("No Servlet host is avaible for HTTP web services");
        } else {
            this.servletHost = hosts.get(0);
        }
View Full Code Here

                                            RuntimeComponentReference reference,
                                            DistributedSCABinding binding,
                                            ExtensionPointRegistry extensionPoints,
                                            Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames) {

        ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
        ServletHost servletHost = servletHosts.getServletHosts().get(0);
        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
        DataBindingExtensionPoint dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);

        this.component = component;
        this.reference = reference;
View Full Code Here

        // Create the SCA node
        SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
        node = nodeFactory.createSCANode(nodeImage);
       
        // Register the Servlet host
        ServletHostExtensionPoint servletHosts = servletHosts(node);
        servletHosts.getServletHosts().clear();
        servletHosts.addServletHost(servletHost);

        // Save the node in the Servlet context
        servletContext.setAttribute(SCAClient.class.getName(), node);
       
        // Start the node
View Full Code Here

        try {
            registry = (ExtensionPointRegistry)node.getClass().getMethod("getExtensionPointRegistry").invoke(node);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        ServletHostExtensionPoint servletHosts = registry.getExtensionPoint(ServletHostExtensionPoint.class);
        return servletHosts;
    }
View Full Code Here

    private MessageFactory messageFactory;
    private ServletHost servletHost;
    private Map<ClassLoader, List<PolicyHandlerTuple>> policyHandlerClassnames = null;

    public Axis2BindingProviderFactory(ExtensionPointRegistry extensionPoints) {
        ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
        this.servletHost = servletHosts.getServletHosts().get(0);
        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
        this.messageFactory = modelFactories.getFactory(MessageFactory.class);
        policyHandlerClassnames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
    }
View Full Code Here

                String host = InetAddress.getLocalHost().getHostName();
                ServerSocket socket = new ServerSocket(0);
                int port = socket.getLocalPort();
                socket.close();
               
                ServletHostExtensionPoint servletHosts = domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(ServletHostExtensionPoint.class);
                for (ServletHost servletHost: servletHosts.getServletHosts()) {
                    servletHost.setDefaultPort(port);
                    if (path != null && path.length() > 0 && !path.equals("/")) {
                        servletHost.setContextPath(path);
                    }
                }
               
                // make the node available to the model
                // this causes the runtime to start registering binding-sca service endpoints
                // with the domain proxy
                // TODO - This code is due to be pulled out and combined with the register and
                //        resolution code that appears in this class
                ModelFactoryExtensionPoint factories = domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
                nodeFactory = new NodeFactoryImpl(node);
                factories.addFactory(nodeFactory);               

                // Create an in-memory domain level management composite
                AssemblyFactory assemblyFactory = domainManagementRuntime.getAssemblyFactory();
                domainManagementComposite = assemblyFactory.createComposite();
                domainManagementComposite.setName(new QName(Constants.SCA10_NS, "domainManagement"));
                domainManagementComposite.setURI(domainModel.getDomainURI() + "/Management");
               
               
            } else {
                domainManagementRuntime = (ReallySmallRuntime)((SCANodeSPI)node).getNodeRuntime();
                domainManagementComposite = domainManagementRuntime.getCompositeActivator().getDomainComposite();

                // set the context path for the node
                String path = URI.create(node.getURI()).getPath();
                if (path != null && path.length() > 0 && !path.equals("/")) {
                    ServletHostExtensionPoint servletHosts = domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(ServletHostExtensionPoint.class);
                    for (ServletHost servletHost: servletHosts.getServletHosts()) {
                        servletHost.setContextPath(path);
                    }
                }
            }
         
View Full Code Here

    private TomcatServer server;

    public void start(ExtensionPointRegistry extensionPointRegistry) {

        // Register a Tomcat Servlet host
        ServletHostExtensionPoint servletHosts =
            extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);
       
        if (servletHosts.getServletHosts().size() < 1) {
            UtilityExtensionPoint utilities = extensionPointRegistry.getExtensionPoint(UtilityExtensionPoint.class);
            final WorkScheduler workScheduler = utilities.getUtility(WorkScheduler.class);
            // Allow privileged access to start MBeans. Requires MBeanPermission in security policy.
            server = AccessController.doPrivileged(new PrivilegedAction<TomcatServer>() {
                public TomcatServer run() {
                    return new TomcatServer(workScheduler);
                 }
            });       
            servletHosts.addServletHost(server);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.host.http.ServletHostExtensionPoint

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.