Package org.bladerunnerjs.aliasing

Examples of org.bladerunnerjs.aliasing.AliasDefinition


    try {
      List<LinkedAsset> linkedAssets = new ArrayList<>();
     
      fixIncompleteAliases(browsableNode);
     
      AliasDefinition alias = browsableNode.getAlias(aliasName);
      SourceModule sourceModule =  (SourceModule)browsableNode.getLinkedAsset(alias.getRequirePath());
      linkedAssets.add(sourceModule);
     
      return "Alias '" + aliasName + "' dependencies found:\n" +
      new DependencyGraphReportBuilder(linkedAssets, DependencyInfoFactory.buildReverseDependencyMap(browsableNode, sourceModule), showAllDependencies).createReport();
    }
View Full Code Here


        addOutboundAliasDependency(dependencyAdder, dependencies, bundlableNode, bundlableNode.getAlias(aliasOverride.getName()));
      }
     
      for(AliasDefinitionsFile aliasDefinitionFile : bundlableNode.aliasDefinitionFiles()) {
        for(AliasDefinition aliasDefinition : aliasDefinitionFile.aliases()) {
          AliasDefinition alias = bundlableNode.getAlias(aliasDefinition.getName());
          addOutboundAliasDependency(dependencyAdder, dependencies, bundlableNode, alias);
        }
      }
    }
    catch(ContentFileProcessingException | RequirePathException | AliasException e) {
View Full Code Here

  }
 
  private static void addInboundAliasDependencies(DependencyAdder dependencyAdder, DependencyInfo dependencies, BundlableNode bundlableNode, LinkedAsset linkedAsset) throws ModelOperationException {
    try {
      for(String aliasName : linkedAsset.getAliasNames()) {
        AliasDefinition alias = bundlableNode.getAlias(aliasName);
        // TODO remove when we get rid of the 'SERVICE!' hack
        if (alias == null)
        {
          throw new AliasException("Alias '" + aliasName + "' could not be found as a defined alias inside:\n '" + bundlableNode.dir().getPath() + "'");
        }
        AliasAsset aliasAsset = dependencies.aliasAssets.get(alias.getName());
        dependencyAdder.add(dependencies, linkedAsset, aliasAsset);
      }
    }
    catch(AliasException | ContentFileProcessingException e) {
      throw new ModelOperationException(e);
View Full Code Here

      throw new AliasNameIsTheSameAsTheClassException(aliasDefinitionsFile, aliasName);
    }
   
    assetLocation.assertIdentifierCorrectlyNamespaced(aliasName);
   
    data.aliasDefinitions.add(new AliasDefinition(aliasName, aliasClass, aliasInterface));
   
    XmlStreamCursor cursor = new XmlStreamCursor(streamReader);
    while(cursor.isWithinInitialNode()) {
      if(streamReader.getEventType() == XMLStreamReader.START_ELEMENT) {
        switch(streamReader.getLocalName()) {
View Full Code Here

  private List<AliasDefinition> getAliases(List<String> aliasNames) throws ModelOperationException {
    List<AliasDefinition> aliases = new ArrayList<>();
   
    try {
      for(String aliasName : aliasNames) {
        AliasDefinition alias = bundlableNode.getAlias(aliasName);
       
        // TODO: get rid of this guard once we remove the 'SERVICE!' hack
        if (alias != null) {
          SourceModule sourceModule =  (SourceModule)bundlableNode.getLinkedAsset(alias.getRequirePath());
          addSourceModule(sourceModule);
         
          if(alias.getInterfaceName() != null) {
            SourceModule aliasInterface = (SourceModule) bundlableNode.getLinkedAsset(alias.getInterfaceRequirePath());
           
            if(sourceModule != aliasInterface) {
              addSourceModule(aliasInterface);
            }
          }
View Full Code Here

    persistentAliasesData.getData().aliasOverrides = aliasOverrides;
  }
 
  public AliasDefinition getAlias(String aliasName) throws AliasException, ContentFileProcessingException {
    AliasOverride aliasOverride = getLocalAliasOverride(aliasName);
    AliasDefinition aliasDefinition = getAliasDefinition(aliasName);
    AliasOverride groupAliasOverride = getGroupAliasOverride(aliasName);
   
    if ((aliasOverride == null) && (groupAliasOverride != null)) {
      aliasOverride = groupAliasOverride;
    }
   
    if((aliasDefinition == null) && (aliasOverride == null)) {
      throw new UnresolvableAliasException(this, aliasName);
    }
   
    if(aliasDefinition == null) {
      aliasDefinition = new AliasDefinition(aliasOverride.getName(), aliasOverride.getClassName(), null);
    }
    else if(aliasOverride != null) {
      aliasDefinition = new AliasDefinition(aliasOverride.getName(), aliasOverride.getClassName(), aliasDefinition.getInterfaceName());
    }
   
    if((aliasDefinition.getClassName() == null)) {
      aliasDefinition = new AliasDefinition(aliasDefinition.getName(), BR_UNKNOWN_CLASS_NAME, aliasDefinition.getInterfaceName());
    }
   
    return aliasDefinition;
  }
View Full Code Here

   
    return hasAlias;
  }
 
  public AliasDefinition getAliasDefinition(String aliasName) throws ContentFileProcessingException, AliasException {
    AliasDefinition aliasDefinition = null;
    String scenarioName = scenarioName();
    List<String> groupNames = groupNames();
   
    for(AliasDefinitionsFile aliasDefinitionsFile : bundlableNode.aliasDefinitionFiles()) {
      AliasDefinition nextAliasDefinition = aliasDefinitionsFile.getAliasDefinition(aliasName, scenarioName, groupNames);

      if (nextAliasDefinition != null)
      {         
          if (aliasDefinition != null && nextAliasDefinition != null) {
            throw new AmbiguousAliasException(getUnderlyingFile(), aliasName, scenarioName);
View Full Code Here

    this.aspect = aspect;
    assetContainerVerifier = new AssetContainerVerifier(aspect);
  }
 
  public VerifierChainer hasAlias(String aliasName, String classRef, String interfaceRef) throws Exception {
    AliasDefinition alias = aspect.aliasesFile().getAlias(aliasName);
   
    assertEquals("Class not as expected for alias '" + aliasName + "'", classRef, alias.getClassName());
    assertEquals("Interface not as expected for alias '" + aliasName + "'", interfaceRef, alias.getInterfaceName());
   
    return verifierChainer;
  }
View Full Code Here

  public List<AliasOverride> groupAliases(String groupName) throws ContentFileProcessingException {
    return ((persistentAliasDefinitionsData.getData().groupAliases.containsKey(groupName)) ? persistentAliasDefinitionsData.getData().groupAliases.get(groupName) : new ArrayList<AliasOverride>());
  }
 
  public AliasDefinition getAliasDefinition(String aliasName, String scenarioName, List<String> groupNames) throws ContentFileProcessingException {
    AliasDefinition aliasDefinition = null;
   
    try {
      for(AliasDefinition nextAliasDefinition : aliases()) {
        if(nextAliasDefinition.getName().equals(aliasName)) {
          if(scenarioName != null) {
            AliasOverride scenarioAlias = persistentAliasDefinitionsData.getData().getScenarioAliases(nextAliasDefinition.getName()).get(scenarioName);
           
            if(scenarioAlias != null) {
              nextAliasDefinition = new AliasDefinition(nextAliasDefinition.getName(), scenarioAlias.getClassName(), nextAliasDefinition.getInterfaceName());
            }
          }
         
          if(aliasDefinition != null) {
            throw new AmbiguousAliasException(aliasDefinitionsFile, aliasName, scenarioName);
View Full Code Here

   
    return builderChainer;
  }
 
  public BuilderChainer hasAlias(String aliasName, String classRef, String interfaceRef) throws Exception {
    aliasDefinitionsFile.addAlias(new AliasDefinition(aliasName, classRef, interfaceRef));
    aliasDefinitionsFile.write();
   
    return builderChainer;
  }
View Full Code Here

TOP

Related Classes of org.bladerunnerjs.aliasing.AliasDefinition

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.