All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.appops.service.deployment.ServiceJettyLauncher Maven / Gradle / Ivy

/*
 * AppOps is a Java framework to develop, deploy microservices with ease and is available for free
 * and common use developed by AinoSoft ( www.ainosoft.com )
 *
 * AppOps and AinoSoft are registered trademarks of Aino Softwares private limited, India.
 *
 * Copyright (C) <2016> 
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version along with applicable additional terms as
 * provisioned by GPL 3.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License and applicable additional terms
 * along with this program.
 *
 * If not, see  and 
 */

package org.appops.service.deployment;

import com.google.inject.Inject;
import java.io.IOException;
import org.appops.configuration.store.ConfigurationStore;
import org.appops.core.deployment.ServiceConfiguration;
import org.appops.marshaller.Marshaller;
import org.appops.service.exception.DeploymentException;
import org.appops.web.jetty.server.JettyContainer;

/**
 * Launcher class to configure and start embeded jetty server within an appops service.
 *
 * @author deba
 * @version $Id: $Id
 */
public class ServiceJettyLauncher {

  // private AppServiceProvider serviceProvider;
  private Marshaller marshaller;
  private ConfigurationStore configurationStore;
  private JettyContainer jettyContainer;

  /**
   * Launches embedded jetty server for service application.
   *
   * @param serviceConfiguration contains embedded jetty server configuration.
   * @return true, if launched embedded jetty server otherwise false.
   */
  public boolean launch(ServiceConfiguration serviceConfiguration) {

    try {
      getJettyContainer().deployWebapp(serviceConfiguration.getWebConfig().getPort(),
          serviceConfiguration.getWebConfig().getContextPath(),
          serviceConfiguration.getWebappDirectory().toURI().toURL(),
          serviceConfiguration.getServiceName(), serviceConfiguration.getJettyConfig());
    } catch (IOException e) {
      throw new DeploymentException(e);
    }
    return true;

  }


  // public AppServiceProvider getServiceProvider() {
  // return serviceProvider;
  // }
  //
  // @Inject
  // public void setServiceProvider(AppServiceProvider serviceProvider) {
  // this.serviceProvider = serviceProvider;
  // }

  /**
   * 

* Getter for the field marshaller. *

* * @return a {@link org.appops.marshaller.Marshaller} object. */ public Marshaller getMarshaller() { return marshaller; } /** *

* Setter for the field marshaller. *

* * @param marshaller a {@link org.appops.marshaller.Marshaller} object. */ @Inject public void setMarshaller(Marshaller marshaller) { this.marshaller = marshaller; } /** *

* Getter for the field configurationStore. *

* * @return a {@link org.appops.configuration.store.ConfigurationStore} object. */ public ConfigurationStore getConfigurationStore() { return configurationStore; } /** *

* Setter for the field configurationStore. *

* * @param configurationStore a {@link org.appops.configuration.store.ConfigurationStore} object. */ @Inject public void setConfigurationStore(ConfigurationStore configurationStore) { this.configurationStore = configurationStore; } /** *

* Getter for the field jettyContainer. *

* * @return a {@link org.appops.web.jetty.server.JettyContainer} object. */ public JettyContainer getJettyContainer() { return jettyContainer; } /** *

* Setter for the field jettyContainer. *

* * @param jettyContainer a {@link org.appops.web.jetty.server.JettyContainer} object. */ @Inject public void setJettyContainer(JettyContainer jettyContainer) { this.jettyContainer = jettyContainer; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy