Package org.jboss.deployment.spi

Examples of org.jboss.deployment.spi.SerializableTargetModuleID


         log.info("hack: failed" + e);
      }
   }
   public void start(String url) throws Exception
   {
      SerializableTargetModuleID moduleID = (SerializableTargetModuleID)moduleMap.get(url);
      if (moduleID == null)
         throw new IOException("deployURL(" + url + ") has not been distributed");

      if (moduleID.isRunning()) {
         log.error("start, url: " + url + " Already started");
         return;
      }
      URL deployURL = new URL(url);
      // Build the local path
      File path = new File(deployURL.getFile());
      String archive = path.getName();
      File deployFile = new File(uploadDir, archive);

      VirtualFile root = VFS.getChild(deployFile.toURI());
      Deployment deployment = mainDeployer.getDeployment(getDeploymentName(root));

      /* TODO: that is a hack */
      if (deployment == null)
      {
         deployment = deploymentFactory.createVFSDeployment(getDeploymentName(root), root);
         mainDeployer.addDeployment(deployment);
         mainDeployer.process();
         moduleID.setRunning(true);
         moduleID.clearChildModuleIDs();
         // Repopulate the child modules
         DeploymentContext context = mainDeployer.getDeploymentContext(deployment.getName());
         fillChildrenTargetModuleID(moduleID, context);
      }

View Full Code Here


      return objectName.toString();
   }

   public void deploy_phase2(String url) throws Exception
   {
      SerializableTargetModuleID moduleID = moduleMap.get(url);
      if (moduleID == null)
         throw new IOException("deployURL(" + url + ") has not been distributed");
      if (moduleID.isRunning())
      {
         return;
      }

      URL deployURL = new URL(url);
      // Build the local path
      File path = new File(deployURL.getFile());
      String archive = path.getName();
      File deployFile = new File(uploadDir, archive);
      if (deployFile.exists() == false)
         throw new IOException("deployURL(" + url + ") has no local archive");

      VirtualFile root = VFS.getChild(deployFile.toURI());
      Deployment deployment = deploymentFactory.createVFSDeployment(getDeploymentName(root), root);
      mainDeployer.addDeployment(deployment);
      DeploymentContext context = null;
      try
      {
         mainDeployer.process();
         context = mainDeployer.getDeploymentContext(deployment.getName());
         mainDeployer.checkComplete(deployment);
      }
      catch (Exception e)
      {
         /* destroy the context */
         hack(moduleID, context, "destroy");
         /* clear the child */
         moduleID.clearChildModuleIDs();
         /* remove the deployment */
         mainDeployer.removeDeployment(getDeploymentName(root));
         mainDeployer.process();

         /* remove the map */
         if (deleteOnUndeploy)
           Files.delete(deployFile);
         moduleMap.remove(url);
         throw e;
      }

      moduleID.setRunning(true);
      moduleID.clearChildModuleIDs();
      // Repopulate the child modules
      fillChildrenTargetModuleID(moduleID, context);

      // TODO: invoke the start.
      // hack(moduleID, context, "start");
View Full Code Here

        
   }

   public void stop(String url) throws Exception
   {
      SerializableTargetModuleID moduleID = (SerializableTargetModuleID)moduleMap.get(url);
      if (moduleID == null)
         throw new IOException("deployURL(" + url + ") has not been distributed");

      URL deployURL = new URL(url);
      // Build the local path
      File path = new File(deployURL.getFile());
      String archive = path.getName();
      File deployFile = new File(uploadDir, archive);
      if (deployFile.exists() == false)
         throw new IOException("deployURL(" + url + ") has no local archive");

      VirtualFile root = VFS.getChild(deployFile.toURI());
      mainDeployer.removeDeployment(getDeploymentName(root));
      mainDeployer.process();
      moduleID.setRunning(false);
   }
View Full Code Here

      moduleID.setRunning(false);
   }

   public void undeploy(String url) throws Exception
   {
      SerializableTargetModuleID moduleID = (SerializableTargetModuleID)moduleMap.get(url);
      if (moduleID == null)
         return;

      // If the module is still running, stop it
      if (moduleID.isRunning())
         stop(url);

      URL deployURL = new URL(url);
      // Build the local path
      File path = new File(deployURL.getFile());
View Full Code Here

   {
      ArrayList<SerializableTargetModuleID> matches = new ArrayList<SerializableTargetModuleID>();
      Iterator<SerializableTargetModuleID> modules = moduleMap.values().iterator();
      while (modules.hasNext())
      {
         SerializableTargetModuleID module = modules.next();
         if (module.getModuleType() == moduleType)
            matches.add(module);
      }

      SerializableTargetModuleID[] ids = new SerializableTargetModuleID[matches.size()];
      matches.toArray(ids);
View Full Code Here

            if (type != null)
            {
               String module = ctx.getName();
               // TODO, DEPLOYED may not be the same as running?
               boolean isRunning = ctx.getState() == DeploymentState.DEPLOYED;
               SerializableTargetModuleID child = new SerializableTargetModuleID(moduleID, module, type.getValue(), isRunning);
               moduleID.addChildTargetModuleID(child);
               fillChildrenTargetModuleID(child, ctx);
            }
         }
         catch (UnsupportedOperationException e)
View Full Code Here

    * Deploy a given module
    */
   public void deploy(TargetModuleID targetModuleID) throws Exception
   {
      TargetModuleIDImpl moduleID = (TargetModuleIDImpl)targetModuleID;
      SerializableTargetModuleID smoduleID = new SerializableTargetModuleID(moduleID);
      Client client = getClient();
      log.info("Begin deploy: " + moduleID);
      transferDeployment(client, smoduleID);
      log.info("End deploy");
      client.disconnect();
View Full Code Here

         SerializableTargetModuleID[] modules = (SerializableTargetModuleID[])
            invoke(client, "getAvailableModules", args);
         List<TargetModuleID> list = new ArrayList<TargetModuleID>();
         for (int n = 0; n < modules.length; n++)
         {
            SerializableTargetModuleID id = modules[n];
            String moduleID = id.getModuleID();
            boolean isRunning = id.isRunning();
            ModuleType type = ModuleType.getModuleType(id.getModuleType());
            TargetModuleIDImpl tmid = new TargetModuleIDImpl(this, moduleID, null, isRunning, type);
            convertChildren(tmid, id);
            list.add(tmid);
         }
View Full Code Here

   {
      SerializableTargetModuleID[] children = parentID.getChildModuleIDs();
      int length = children != null ? children.length : 0;
      for (int n = 0; n < length; n++)
      {
         SerializableTargetModuleID id = children[n];
         String moduleID = id.getModuleID();
         boolean isRunning = id.isRunning();
         ModuleType type = ModuleType.getModuleType(id.getModuleType());
         TargetModuleIDImpl child = new TargetModuleIDImpl(this, moduleID, parent, isRunning, type);
         parent.addChildTargetModuleID(child);
         convertChildren(child, id);
      }
   }
View Full Code Here

    * @param request - the remoting invocation
    */
   public Object handleStream(InputStream contentIS, InvocationRequest request)
      throws Throwable
   {
      SerializableTargetModuleID moduleID = (SerializableTargetModuleID) request.getParameter();
      log.debug("handleStream, moduleID: "+moduleID);
      moduleID.setContentIS(contentIS);
      deployService.deploy(moduleID);
      return null;
   }
View Full Code Here

TOP

Related Classes of org.jboss.deployment.spi.SerializableTargetModuleID

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.