Examples of BRJS


Examples of org.bladerunnerjs.model.BRJS

public class RelativePathUtilityTest extends TestModelAccessor {
 
  @Test
  public void testRelativePaths() throws InvalidSdkDirectoryException, IOException {
    BRJS brjs = createModel( FileUtility.createTemporaryDirectory(this.getClass()) );
    assertEquals("child", RelativePathUtility.get(brjs.getFileInfoAccessor(), new File("."), new File("child")));
    assertEquals("child/grandchild", RelativePathUtility.get(brjs.getFileInfoAccessor(), new File("."), new File("child/grandchild")));
    assertEquals("../child/grandchild", RelativePathUtility.get(brjs.getFileInfoAccessor(), new File("."), new File("../child/grandchild")));
  }
View Full Code Here

Examples of org.bladerunnerjs.model.BRJS

    return byteStreamOutputStream.toString().trim();
  }
 
  public int run(String[] args) throws CommandArgumentsException, CommandOperationException, InvalidNameException, ModelUpdateException {
    AbstractRootNode.allowInvalidRootDirectories = false;
    BRJS brjs = null;
   
    try {
      if (args.length < 1 || args[0] == null) throw new NoSdkArgumentException("No SDK base directory was provided");
     
      File sdkBaseDir = new File(args[0]);
      args = ArrayUtils.subarray(args, 1, args.length);
     
      if (!sdkBaseDir.exists() || !sdkBaseDir.isDirectory()) throw new InvalidDirectoryException("'" + sdkBaseDir.getPath() + "' is not a directory");
      sdkBaseDir = sdkBaseDir.getCanonicalFile();
     
      args = processGlobalCommandFlags(args);
     
      try {
        brjs = ThreadSafeStaticBRJSAccessor.initializeModel(sdkBaseDir);
      }
      catch(InvalidSdkDirectoryException e) {
        throw new CommandOperationException(e);
      }
     
      brjs.populate();
     
      injectLegacyCommands(brjs);
      return brjs.runUserCommand(new CommandConsoleLogLevelAccessor(getLoggerStore()), args);
    }
    catch(IOException e) {
      throw new RuntimeException(e);
    }
    finally {
      AbstractRootNode.allowInvalidRootDirectories = true;
     
      if(brjs != null) {
        brjs.close();
      }
    }
  }
View Full Code Here

Examples of org.bladerunnerjs.model.BRJS

      assetLocation = assetContainer.assetLocation(".");
    }
    String targetPath = null;
   
    File assetLocationParentDir = assetLocation.dir().getParentFile();
    BRJS root = assetContainer.root();
    try {
      if(assetContainer instanceof Aspect) {
        Aspect aspect = (Aspect) assetContainer;
        if (assetLocation instanceof ThemedAssetLocation && assetLocationParentDir.getName().equals("themes")) {
          ThemedAssetLocation theme = (ThemedAssetLocation) assetLocation;
          String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), theme.dir(), imageFile);
          targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.ASPECT_THEME_REQUEST, ((Aspect) assetContainer).getName(), theme.dir().getName(), resourcePath);
        } else {
          String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), assetContainer.dir(), imageFile);
          targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.ASPECT_RESOURCE_REQUEST, aspect.getName(), resourcePath);
        }
      }
      else if(assetContainer instanceof Bladeset) {
        Bladeset bladeset = (Bladeset) assetContainer;
        if (assetLocation instanceof ThemedAssetLocation && assetLocationParentDir.getName().equals("themes")) {
            ThemedAssetLocation theme = (ThemedAssetLocation) assetLocation;
            String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), theme.dir(), imageFile);
           
            targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.BLADESET_THEME_REQUEST, bladeset.getName(), theme.dir().getName(), resourcePath);
        } else {
          String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), bladeset.dir(), imageFile);
          targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.BLADESET_RESOURCE_REQUEST, bladeset.getName(), resourcePath);
        }
      }
      else if(assetContainer instanceof Blade) {
        Blade blade = (Blade) assetContainer;
        Bladeset bladeset = blade.parent();
        if (assetLocation instanceof ThemedAssetLocation && assetLocationParentDir.getName().equals("themes")) {
            ThemedAssetLocation theme = (ThemedAssetLocation) assetLocation;
            String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), theme.dir(), imageFile);
           
            targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.BLADE_THEME_REQUEST, bladeset.getName(), blade.getName(), theme.dir().getName(), resourcePath);
        } else {
          String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), blade.dir(), imageFile);
          targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.BLADE_RESOURCE_REQUEST, bladeset.getName(), blade.getName(), resourcePath);
        }
      }
      else if(assetContainer instanceof Workbench) {
        Workbench workbench = (Workbench) assetContainer;
        Blade blade = workbench.parent();
        Bladeset bladeset = blade.parent();
       
        if (assetLocation instanceof ThemedAssetLocation && assetLocationParentDir.getName().equals("themes")) {
          String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), assetLocation.file("resources"), imageFile);
          targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.WORKBENCH_RESOURCE_REQUEST, bladeset.getName(), blade.getName(), resourcePath);
        } else {
          String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), workbench.dir(), imageFile);
          targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.WORKBENCH_RESOURCE_REQUEST, bladeset.getName(), blade.getName(), resourcePath);
        }
      }
      else if(assetContainer instanceof JsLib) {
        JsLib jsLib = (JsLib) assetContainer;
        String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), jsLib.dir(), imageFile);
       
        targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.LIB_REQUEST, jsLib.getName(), resourcePath);
      }
      else {
        throw new ContentFileProcessingException(imageFile, "File does not exist in a known scope");
View Full Code Here

Examples of org.bladerunnerjs.model.BRJS

    if(!targetContainer.isDirectory()) throw new ModelOperationException("'" + targetContainer.getPath() + "' is not a directory.");
   
    try {
      String version = app.root().getAppVersionGenerator().getProdVersion();
      Map<String,List<String>> contentPluginProdRequestsMap = new HashMap<>();
      BRJS brjs = app.root();
      AppRequestHandler appRequestHandler = new AppRequestHandler(app);
      UrlContentAccessor urlContentAccessor = new StaticContentAccessor(app);
      Locale[] locales = app.appConf().getLocales();
     
      filterAppWebXml(app, targetDir, version);
     
      for (Aspect aspect : app.aspects()) {
        BundleSet bundleSet = aspect.getBundleSet();
        String aspectRequestPrefix = (aspect.getName().equals("default")) ? "" : aspect.getName() + "/";       
               
        writeLocaleForwardingFileForAspect(bundleSet, targetDir, appRequestHandler, aspectRequestPrefix, urlContentAccessor, version);
       
        for (Locale locale : locales) {
          outputAspectIndexPage(aspect, locale, bundleSet, targetDir, appRequestHandler, aspectRequestPrefix, urlContentAccessor, version);
          calculateUsedContentPlugins(aspect, locale, bundleSet, appRequestHandler, urlContentAccessor, version, contentPluginProdRequestsMap);
        }
       
        for (ContentPlugin contentPlugin : brjs.plugins().contentPlugins()) {
          outputContentPluginBundles(contentPlugin, bundleSet, locales, targetDir, version, appRequestHandler, aspectRequestPrefix, urlContentAccessor, contentPluginProdRequestsMap);
        }
      }
    }
    catch(Exception e) {
View Full Code Here

Examples of org.bladerunnerjs.model.BRJS

    assertTrue(indexFile.exists());
  }
 
  private void setupService(File sdkRoot) throws InvalidSdkDirectoryException
  {
    BRJS brjs = createModel(sdkRoot);
    ThreadSafeStaticBRJSAccessor.destroy();
    ThreadSafeStaticBRJSAccessor.initializeModel(brjs);
    service = new RestApiService(brjs);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.