private String getArtifactType() {
   if (type != null) {
     return type;
   } else if (parent != null) {
     return parent.getArtifactType();
   }
   return "";
 }
  public void loadComponentsInto(SynapseLibrary library) {
    for (String artifactName : subArtifacts.keySet()) {
      LibraryArtifact artifact = subArtifacts.get(artifactName);
      if (artifact.isLeafArtifact()) {
        delegateClassLoading(artifact, library);
        // this is where actual artifact is constructed to it's ture form
        Object template = artifact.file.build();
        if (artifact.file instanceof TemplateArtifactFile) {

          if (template instanceof TemplateMediator) {
            TemplateMediator templateMediator = (TemplateMediator) template;
            // make template dynamic as it is not directly available to synapse environment
            templateMediator.setDynamic(true);
            String templateName = templateMediator.getName();
            library.addComponent(
                getQualifiedName(
                    library.getPackage(), templateName, library.getQName().getLocalPart()),
                template);
          } else if (template instanceof Template) {
            String templateName = ((Template) template).getName();
            library.addComponent(
                getQualifiedName(
                    library.getPackage(), templateName, library.getQName().getLocalPart()),
                template);
          } else if (template != null) {
            library.addComponent(
                getQualifiedName(
                    library.getPackage(), artifact.getName(), library.getQName().getLocalPart()),
                template);
          } else {
            throw new SynapseArtifactDeploymentException(
                "Cannot load components into "
                    + "Synapse Library. Component "
                    + "cannot be built for "
                    + artifactName);
          }
        }
      } else {
        artifact.loadComponentsInto(library);
      }
    }
  }
 public void addSubArtifact(LibraryArtifact artifact) {
   if (artifact != null) {
     subArtifacts.put(artifact.toString(), artifact);
     unresolvedDeps++;
   }
 }