Examples of Bladeset


Examples of org.bladerunnerjs.model.Bladeset

    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);
     
      logger.println("Successfully copied " + sourceAppName + "/" + sourceBladesetName + " to " + targetAppName + "/" + targetBladesetName);
View Full Code Here

Examples of org.bladerunnerjs.model.Bladeset

    }
   
    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();
      response.append(joinListOfNodes( new ArrayList<NamedNode>(blades),", " ));
      response.append("]");
      if (i < bladesets.size()-1)
      {
        response.append(", ");
View Full Code Here

Examples of org.bladerunnerjs.model.Bladeset

      CopyBladesetCommand cmd = new CopyBladesetCommand();
      cmd.setBRJS(brjs);
      String[] args = new String[]{ sourceApp, bladeset, targetApp, newBladesetName };   
      doCommand( cmd, args );
     
      Bladeset bladesetNode = brjs.app(targetApp).bladeset(newBladesetName);
      for (Blade bladeNode : bladesetNode.blades())
      {
        if (!blades.contains(bladeNode.getName()))
        {           
          FileUtils.deleteDirectory(bladeNode.dir());
        }
View Full Code Here

Examples of org.bladerunnerjs.model.Bladeset

      Aspect aspect =  bundlableNode.app().aspect(aspectName);
      resourceFile = aspect.file(resourcePath);
    }
    else if (contentPath.formName.equals(BLADESET_THEME_REQUEST))
    {
      Bladeset bladeset = bundlableNode.app().bladeset(contentPath.properties.get("bladeset"));
      ThemedAssetLocation location = getThemedResourceLocation(bladeset, theme);
      resourceFile = location.file(resourcePath);
    }
    else if (contentPath.formName.equals(BLADESET_RESOURCE_REQUEST))
    {
      Bladeset bladeset = bundlableNode.app().bladeset(contentPath.properties.get("bladeset"));
      resourceFile = bladeset.file(resourcePath);
    }
    else if (contentPath.formName.equals(BLADE_THEME_REQUEST))
    {
      Bladeset bladeset = bundlableNode.app().bladeset(contentPath.properties.get("bladeset"));
      Blade blade = bladeset.blade(contentPath.properties.get("blade"));
      ThemedAssetLocation location = getThemedResourceLocation(blade, theme);
      resourceFile = location.file(resourcePath);
    }
    else if (contentPath.formName.equals(BLADE_RESOURCE_REQUEST))
    {
      Bladeset bladeset = bundlableNode.app().bladeset(contentPath.properties.get("bladeset"));
      Blade blade = bladeset.blade(contentPath.properties.get("blade"));
      resourceFile = blade.file(resourcePath);
    }
    else if (contentPath.formName.equals(WORKBENCH_THEME_REQUEST))
    {
      //TODO: this needs implementing
      // Workbenches dont have themes ?
    }
    else if (contentPath.formName.equals(WORKBENCH_RESOURCE_REQUEST))
    {
      Bladeset bladeset = bundlableNode.app().bladeset(contentPath.properties.get("bladeset"));
      Blade blade = bladeset.blade(contentPath.properties.get("blade"));
      Workbench workbench = blade.workbench();
      resourceFile = workbench.file(resourcePath);
    }
    else if (contentPath.formName.equals(LIB_REQUEST))
    {
View Full Code Here

Examples of org.bladerunnerjs.model.Bladeset

      resourcesRequestName = ASPECT_RESOURCE_REQUEST;
      requestArgs = new String[] { aspect.getName() };
    }
    else if (assetContainer instanceof Bladeset)
    {
      Bladeset bladeset = (Bladeset) assetContainer;
      themeRequestName = BLADESET_THEME_REQUEST;
      resourcesRequestName = BLADESET_RESOURCE_REQUEST;
      requestArgs = new String[] { bladeset.getName() };
    }
    else if (assetContainer instanceof Blade)
    {
      Blade blade = (Blade) assetContainer;
      Bladeset bladeset = brjs.locateAncestorNodeOfClass(blade, Bladeset.class);
      themeRequestName = BLADE_THEME_REQUEST;
      resourcesRequestName = BLADE_RESOURCE_REQUEST;
      requestArgs = new String[] { bladeset.getName(), blade.getName() };
    }
    else if (assetContainer instanceof Workbench)
    {
      Workbench workbench = (Workbench) assetContainer;
      Blade blade = brjs.locateAncestorNodeOfClass(workbench, Blade.class);
      Bladeset bladeset = brjs.locateAncestorNodeOfClass(blade, Bladeset.class);
      themeRequestName = WORKBENCH_THEME_REQUEST;
      resourcesRequestName = WORKBENCH_RESOURCE_REQUEST;
      requestArgs = new String[] { bladeset.getName(), blade.getName() };
    }
    else if (assetContainer instanceof JsLib)
    {
      JsLib lib = (JsLib) assetContainer;
      themeRequestName = null;
View Full Code Here

Examples of org.bladerunnerjs.model.Bladeset

      .and(brjs).usedForServletModel();
   
    // generate the app structure
    App app = brjs.app("app");
    Aspect aspect = app.defaultAspect();
    Bladeset bs = app.bladeset("bs");
    Blade b1 = bs.blade("b1");
    Workbench workbench = b1.workbench();
   
    given(app).hasBeenPopulated()
      .and(aspect).hasClass("appns/Class1")
      .and(aspect).indexPageRefersTo("appns.Class1")
View Full Code Here

Examples of org.bladerunnerjs.model.Bladeset

  protected int doCommand(JSAPResult parsedArgs) throws CommandArgumentsException, CommandOperationException {
    String appName = parsedArgs.getString("target-app-name");
    String bladesetName = parsedArgs.getString("new-bladeset-name");
   
    App app = brjs.app(appName);
    Bladeset bladeset = app.bladeset(bladesetName);
   
    if(!app.dirExists()) throw new NodeDoesNotExistException(app, this);
    if(bladeset.dirExists()) throw new NodeAlreadyExistsException(bladeset, this);
   
    try {
      bladeset.populate();
    }
    catch(InvalidNameException e) {
      throw new CommandArgumentsException(e, this);
    }
    catch(ModelUpdateException e) {
      throw new CommandOperationException("Cannot create bladeset '" + bladeset.dir().getPath() + "'", e);
    }
   
    logger.println(Messages.BLADESET_CREATE_SUCCESS_CONSOLE_MSG, bladesetName);
    logger.println(Messages.BLADESET_PATH_CONSOLE_MSG, bladeset.dir().getPath());
   
    return 0;
  }
View Full Code Here

Examples of org.bladerunnerjs.model.Bladeset

          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);
View Full Code Here

Examples of org.bladerunnerjs.model.Bladeset

    String appName = parsedArgs.getString(Parameters.APP_NAME);
    String bladesetName = parsedArgs.getString(Parameters.BLADESET_NAME);
    String bladeName = parsedArgs.getString(Parameters.BLADE_NAME);
   
    App app = brjs.app(appName);
    Bladeset bladeset = getBladeset(app, bladesetName);
    Blade blade = bladeset.blade(bladeName);
   
    if(!app.dirExists()) throw new NodeDoesNotExistException(app, this);
    if(!bladeset.dirExists()) throw new NodeDoesNotExistException(bladeset, this);
    if(blade.dirExists()) throw new NodeAlreadyExistsException(blade, this);
   
    try {
      blade.populate();
    }
View Full Code Here

Examples of org.bladerunnerjs.model.Bladeset

    return 0;
  }
 
  private Bladeset getBladeset(App app, String bladesetName) throws CommandOperationException
  {
    Bladeset bladeset = (bladesetName.equals(App.DEFAULT_CONTAINER_NAME)) ? app.defaultBladeset() : app.bladeset(bladesetName);
    if (bladeset == app.defaultBladeset()) {
        try
        {
          if (!bladeset.dirExists()) {
            bladeset.create();
          }
        }
        catch (InvalidNameException | ModelUpdateException e)
        {
          throw new CommandOperationException(e);
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.