Package org.bladerunnerjs.model

Examples of org.bladerunnerjs.model.App


            || contentPath.formName.equals(VERSIONED_UNBUNDLED_RESOURCES_REQUEST))
        {
          String relativeFilePath = contentPath.properties.get(FILE_PATH_REQUEST_FORM);
         
          File unbundledResourcesDir = bundleSet.getBundlableNode().file(UNBUNDLED_RESOURCES_DIRNAME);
          App app = bundleSet.getBundlableNode().app();
          File requestedFile = new File(unbundledResourcesDir, relativeFilePath);
          String requestedFilePathRelativeToApp = RelativePathUtility.get(brjs.getFileInfoAccessor(), app.dir(), requestedFile);
         
          if (!requestedFile.isFile())
          {
            String requestedFilePathRelativeToRoot = RelativePathUtility.get(brjs.getFileInfoAccessor(), app.dir().getParentFile(), requestedFile);
            throw new ContentProcessingException("The requested unbundled resource at '"+requestedFilePathRelativeToRoot+"' does not exist or is not a file.");
          }
       
          ByteArrayOutputStream outputBuffer = new ByteArrayOutputStream();
          contentAccessor.handleRequest(requestedFilePathRelativeToApp, outputBuffer);
View Full Code Here


  private List<String> getGeneratedRequests(boolean isDev, Map<String, String> tagAttributes, BundleSet bundleSet, Locale locale, String version) throws MalformedTokenException, ContentProcessingException
  {
    List<String> possibleRequests = new ArrayList<String>();
    MinifierSetting minifierSettings = new MinifierSetting(tagAttributes);
    String minifierSetting = (isDev) ? minifierSettings.devSetting() : minifierSettings.prodSetting();
    App app = bundleSet.getBundlableNode().app();
   
    if(minifierSetting.equals(MinifierSetting.SEPARATE_JS_FILES)) {
      for(ContentPlugin contentPlugin : brjs.plugins().contentPlugins("text/javascript")) {
        List<String> contentPaths = (isDev) ? contentPlugin.getValidDevContentPaths(bundleSet) : contentPlugin.getValidProdContentPaths(bundleSet);
        for (String contentPath : contentPaths) {
          String requestPath = (isDev) ? app.createDevBundleRequest(contentPath, version) : app.createProdBundleRequest(contentPath, version);
          possibleRequests.add(requestPath);
        }
      }
    }
    else {
      String bundleRequestForm = (isDev) ? "dev-bundle-request" : "prod-bundle-request";
      String contentPath = compositeJsBundlerPlugin.getContentPathParser().createRequest(bundleRequestForm, minifierSetting);
      String requestPath = (isDev) ? app.createDevBundleRequest(contentPath, version) : app.createProdBundleRequest(contentPath, version);
      possibleRequests.add( requestPath );
    }
    return possibleRequests;
  }
View Full Code Here

  {
    if (contentPath.formName.equals(APP_META_REQUEST))
    {
      try
      {
        App app = bundleSet.getBundlableNode().app();
        //NOTE: this metadata is used by the BRAppMetaService
        return new CharResponseContent( brjs, "// these variables should not be used directly but accessed via the 'br.app-meta-service' instead\n" +
            "window.$BRJS_APP_VERSION = '"+version+"';\n" +
            "window.$BRJS_VERSIONED_BUNDLE_PATH = '"+AppMetadataUtility.getRelativeVersionedBundlePath(version, "")+"';\n" +
            "window.$BRJS_LOCALE_COOKIE_NAME = '"+app.appConf().getLocaleCookieName()+"';\n" +
            "window.$BRJS_APP_LOCALES = {'" + Joiner.on("':true, '").join(app.appConf().getLocales()) + "':true};\n" );
      }
      catch (ConfigException ex)
      {
        throw new ContentProcessingException(ex);
      }
View Full Code Here

    String sourceAppName = parsedArgs.getString("source-app-name");
    String sourceBladesetName = parsedArgs.getString("source-bladeset-name");
    String targetAppName = parsedArgs.getString("target-app-name");
    String targetBladesetName = (parsedArgs.getString("target-bladeset-name") == null) ? sourceBladesetName : parsedArgs.getString("target-bladeset-name");
   
    App sourceApp = brjs.app(sourceAppName);
    Bladeset sourceBladeset = sourceApp.bladeset(sourceBladesetName);
    App targetApp = brjs.app(targetAppName);
   
    try {
      NameValidator.assertValidPackageName(targetApp, targetBladesetName);
    }
    catch (InvalidPackageNameException e) {
      throw new CommandArgumentsException(e, this);
    }
   
    Bladeset targetBladeset = targetApp.bladeset(targetBladesetName);
   
    if (!sourceApp.dirExists()) throw new NodeDoesNotExistException(sourceApp, this);
    if (!sourceBladeset.dirExists()) throw new NodeDoesNotExistException(sourceBladeset, this);
    if (!targetApp.dirExists()) throw new NodeDoesNotExistException(targetApp, this);
    if (targetBladeset.dirExists()) throw new NodeAlreadyExistsException(targetBladeset, this);
   
    try {
      NodeImporter.importBladeset(sourceBladeset.dir(), sourceApp.appConf().getRequirePrefix(), sourceApp.appConf().getRequirePrefix() + "/" + sourceBladesetName, targetBladeset);
     
View Full Code Here

  public String getApp(String appName) throws Exception
  {
    StringBuilder response = new StringBuilder();
    response.append("{");
   
    App app = brjs.userApp(appName);
    if (!app.dirExists())
    {
      throw new Exception("App " + app.getName() + " does not exist");
    }
   
    List<Bladeset> bladesets = app.bladesets();
    for (int i = 0; i < bladesets.size(); i++)
    {
      Bladeset bladeset = bladesets.get(i);
      response.append("\""+bladeset.getName()+"\"" + ":[");
      List<Blade> blades = bladeset.blades();
View Full Code Here

    if (destinationWar.exists())
    {
      destinationWar.delete();
    }
   
    App app = brjs.userApp(appName);
    if (!app.dirExists()) {
      throw new Exception("Unable to export, the app '" + appName + "' doesn't exist.");
    }
   
    app.buildWar(destinationWar);
  }
View Full Code Here

  }
 
  @Override
  protected int doCommand(JSAPResult parsedArgs) throws CommandArgumentsException, CommandOperationException {
    String appName = parsedArgs.getString("app-name");
    App app = brjs.app(appName);
   
    if(!app.dirExists()) throw new CommandArgumentsException( String.format(Messages.APP_DOES_NOT_EXIST_EXCEPTION, appName), this );
   
    Map<String, String> transformations = new HashMap<>();
    transformations.put("app-name", app.getName());
    try
    {
      TemplateUtility.installTemplate(app, "j2eeify-app", transformations, true );
      String webXmlContents =  IOUtils.toString( ApplicationServerUtils.getDefaultWebXmlResourceLocation() );
      FileUtils.write( app.file("WEB-INF/web.xml") , webXmlContents );
      FileUtils.copyDirectory(brjs.appJars().dir(), app.file("WEB-INF/lib"));
    }
    catch (TemplateInstallationException | IOException ex)
    {
      throw new CommandOperationException(ex);
    }
   
    String relativeWebInf = RelativePathUtility.get(brjs.getFileInfoAccessor(), app.root().dir(), app.file("WEB-INF"));
    logger.println(Messages.SUCCESSFULLY_J2EEIFIED_APP_MESSAGE, appName, relativeWebInf);
   
    return 0;
  }
View Full Code Here

  protected int doCommand(JSAPResult parsedArgs) throws CommandArgumentsException, CommandOperationException {
    String appName = parsedArgs.getString("app-name");
    String aspectName = parsedArgs.getString("aspect-name");
    boolean showAllDependencies = parsedArgs.getBoolean("all");
   
    App app = brjs.app(appName);
    Aspect aspect = app.aspect(aspectName);
   
    if(!app.dirExists()) throw new NodeDoesNotExistException(app, this);
    if(!aspect.dirExists()) throw new NodeDoesNotExistException(aspect, this);
   
    try {
      logger.println(DependencyGraphReportBuilder.createReport(aspect, showAllDependencies)+"\n");
    }
View Full Code Here

  }


  private boolean isAppDirWithDeployFile(File dir)
  {
    App app = brjs.locateAncestorNodeOfClass(dir, App.class);
    return app != null && ApplicationServerUtils.getDeployFileForApp(app).isFile();
  }
View Full Code Here

    return app != null && ApplicationServerUtils.getDeployFileForApp(app).isFile();
  }

  private void deployApp(File appDir)
  {
    App app = brjs.locateAncestorNodeOfClass(appDir, App.class);
    try
    {
      logger.debug(NEW_APP_MESSAGE, this.getClass().getSimpleName(), app.getName());
      appServer.deployApp(app);
    }
    catch (Exception ex)
    {
      logger.warn(ERROR_DEPLOYING_APP_MSG, app.getName(), ex.toString());
    }
  }
View Full Code Here

TOP

Related Classes of org.bladerunnerjs.model.App

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.