Package org.jboss.jbossas.servermanager

Examples of org.jboss.jbossas.servermanager.Server


     */
    public Context getNamingContext(String serverName)
    {
        try
        {
            Server server = manager.getServer(serverName);

            return (server != null ? server.getNamingContext() : null);
        }
        catch (NamingException e)
        {
            e.printStackTrace();

View Full Code Here


     * @throws IOException If another process is already using a port required by this instance
     * @see org.jboss.jbossas.servermanager.ServerController#startServer(org.jboss.jbossas.servermanager.Server, org.jboss.jbossas.servermanager.ServerManager)
     */
    public void startServer(String serverName) throws IOException
    {
        Server server = manager.getServer(serverName);

        // Warning !server.isRunning() is not equivalent to server.isStopped()
        // !server.isRunning() and !server.isStopped() implies that some other entity terminated the server
        if (!server.isRunning())
            manager.startServer(serverName);
    }
View Full Code Here

    /**
     * @see org.jboss.jbossas.servermanager.ServerController#stopServer(org.jboss.jbossas.servermanager.Server, org.jboss.jbossas.servermanager.ServerManager)
     */
    public void stopServer(String serverName) throws IOException
    {
        Server server = manager.getServer(serverName);

        if (server.isRunning())
            manager.stopServer(serverName);
    }
View Full Code Here

     * @throws SAXException error parsing the server bindings xml file
     * @throws ParserConfigurationException error parsing the server bindings xml file
     */
    public void configureServerBinding(String serverName) throws TransformerException, IOException, SAXException, ParserConfigurationException
    {
        Server server = manager.getServer(serverName);
        String configHome = getProductDir();
        String mbeanServiceFile = getServerPath(serverName) + "conf/jboss-service.xml";
        String bindingName = server.getSysProperty("server.binding.name");
        String bindingFile = server.getSysProperty("server.binding.location");

        if (bindingFile == null)
            return;

        bindingFile = configHome + bindingFile;

        // if bindingName is set then it is safe to check that the AS is up via the Naming service port
        // BTW the AS5 team has changed the behavior of the naming service port - it is opened before
        // all the services have been configured so any target deployments may not have been initialised
        // when the server is declared as running. Instead we force the server to use a web server port to
        // determine if the AS is running.
        if (bindingName == null)
            return;
//            bindingName = ServerBindingConfig.DEFAULT_BINDING;
//        else
//            server.setHasWebServer(true);

        ServerBindingConfig.setBinding(mbeanServiceFile, bindingName, bindingFile);

        server.setRmiPort(ServerBindingConfig.lookupRmiPort(bindingFile, bindingName, server.getRmiPort()));
        server.setHttpPort(ServerBindingConfig.lookupHttpPort(bindingFile, bindingName, server.getHttpPort()));

        System.out.println("Using: " + Context.PROVIDER_URL
                + " = jnp://"+ server.getHost() + ':' + server.getRmiPort()
                + " and http port " + server.getHttpPort());
    }
View Full Code Here

   @Override
   public void start() throws LifecycleException
   {
      try
      {
         Server server = manager.getServer(configuration.getProfileName());
         if(ServerController.isServerStarted(server))
         {
            throw new LifecycleException(
                "The server is already running! " +
                "Managed containers does not support connecting to running server instances due to the " +
                "possible harmfull effect of connecting to the wrong server. Please stop server before running or " +
                "change to another type of container.");
         }
        
         manager.startServer(server.getName());
         initProfileService(server);
      }
      catch (Exception e)
      {
         throw new LifecycleException("Could not start remote container", e);
View Full Code Here

   }

   @Override
   public void stop() throws LifecycleException
   {
      Server server = manager.getServer(configuration.getProfileName());
     
      if(!server.isRunning())
      {
         throw new LifecycleException("Can not stop server. Server is not started");
      }
      try
      {
         removeFailedUnDeployments();
      }
      catch (Exception e)
      {
         throw new LifecycleException("Could not clean up failed undeployments", e);
      }
     
      try
      {
         manager.stopServer(server.getName());
      }
      catch (Exception e)
      {
         throw new LifecycleException("Could not stop server", e);
      }
View Full Code Here

      }
   }

   private void removeFailedUnDeployments() throws IOException
   {
      Server server = manager.getServer(configuration.getProfileName());
     
      List<String> remainingDeployments = new ArrayList<String>();
      for (String name : failedUndeployments)
      {
         try
         {
            server.undeploy(new File(name));
         }
         catch (Exception e)
         {
            IOException ioe = new IOException();
            ioe.initCause(e);
View Full Code Here

      return manager;
   }

   private Server createAndConfigureServer()
   {
      Server server = new Server();
      server.setName(configuration.getProfileName());
      server.setHttpPort(httpPort());
      server.setRmiPort(rmiPort());
      server.setHost(configuration.getBindAddress());
      server.setHasWebServer(!configuration.isUseRmiPortForAliveCheck());
     
      server.setUsername("admin");
      server.setPassword("admin");
     
      if (configuration.getPartition() != null) {
          server.setPartition(configuration.getPartition());
      }
      else {
          server.setPartition(Long.toHexString(System.currentTimeMillis()));
      }

      // Set server's JVM arguments
      setServerVMArgs(server, javaVmArguments());

      // Set server's system properties
      Property prop = new Property();
      prop.setKey("jbosstest.udp.ip_ttl");
      prop.setValue("0");
      server.addSysProperty(prop);
      prop = new Property();
      prop.setKey("java.endorsed.dirs");
      prop.setValue(new File(configuration.getJbossHome(), "lib/endorsed").getAbsolutePath());
      server.addSysProperty(prop);
     
      return server;
   }
View Full Code Here

   @Override
   public void start() throws LifecycleException
   {
      try
      {
         Server server = serverManager.getServer(configuration.getProfileName());
        
         if (ServerController.isServerStarted(server))
         {
            throw new LifecycleException(
                  "The server is already running! " +
                  "Managed containers does not support connecting to running server instances due to the " +
                  "possible harmfull effect of connecting to the wrong server. Please stop server before running or " +
                  "change to another type of container.");
         }

         serverManager.startServer(server.getName());
        
         createContext(server);
         deploymentManager = createDeploymentManager(server);
      }
      catch (Exception e)
View Full Code Here

      File deployment = ShrinkWrapUtil.toFile(archive);
      targetModuleIDs = deploy(deployment);

      try
      {
         Server server = serverManager.getServer(configuration.getProfileName());
         return ManagementViewParser.parse(archive.getName(), server.getServerConnection());
      }
      catch (Exception e)
      {
         throw new DeploymentException("Could not extract deployment metadata", e);
      }
View Full Code Here

TOP

Related Classes of org.jboss.jbossas.servermanager.Server

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.