org.apache.geronimo.kernel.repository.Artifact.toString()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(12.5k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中org.apache.geronimo.kernel.repository.Artifact.toString()方法的一些代码示例,展示了Artifact.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Artifact.toString()方法的具体详情如下:
包路径:org.apache.geronimo.kernel.repository.Artifact
类名称:Artifact
方法名:toString

Artifact.toString介绍

暂无

代码示例

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

public NoSuchConfigException(Artifact configId) {
  super(configId.toString());
  this.configId = configId;
}

代码示例来源:origin: org.apache.geronimo.plugins/console-base-portlets

public ModuleDetails(Artifact configId, ConfigurationModuleType type, State state) {
  this.configId = configId;
  this.type = type;
  this.state = state;
  if (configId.toString().indexOf("org.apache.geronimo.configs/") == 0 || configId.toString().indexOf("org.apache.geronimo.plugins/") == 0) {
    this.expertConfig = true;
  }
}

代码示例来源:origin: org.apache.geronimo.plugins/console-base-portlets

public WebAppData(Artifact parentConfigId, String childName, AbstractName moduleBeanName, boolean enabled, String dynamicPattern, boolean serveStaticContent) {
  this.parentConfigId = parentConfigId.toString();
  this.enabled = enabled;
  this.dynamicPattern = dynamicPattern;
  this.serveStaticContent = serveStaticContent;
  this.moduleBeanName = moduleBeanName == null ? null : moduleBeanName.toString();
  this.childName = childName;
}

代码示例来源:origin: org.apache.geronimo.plugins/console-base-portlets

public String printResults(Set<Artifact> lcresult) {
  StringBuilder sb = new StringBuilder();
  for (Artifact config : lcresult) {
    // TODO might be a hack
    List<String> kidsChild = loadChildren(kernel, config.toString());
    // TODO figure out the web url and show it when appropriate.
    sb.append("<br />").append(config);
    for (String kid : kidsChild) {
      sb.append("<br />-> ").append(kid);
    }
  }
  return sb.toString();
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

private static URI createURI(Artifact artifact, Map name) {
  StringBuffer queryString = new StringBuffer();
  TreeMap treeMap = new TreeMap(name);
  for (Iterator iterator = treeMap.entrySet().iterator(); iterator.hasNext();) {
    Map.Entry entry = (Map.Entry) iterator.next();
    String key = (String) entry.getKey();
    String value = (String) entry.getValue();
    queryString.append(key).append('=').append(value);
    if (iterator.hasNext()) {
      queryString.append(',');
    }
  }
  try {
    return new URI(null, null, artifact.toString(), queryString.toString(), null);
  } catch (URISyntaxException e) {
    IllegalArgumentException illegalArgumentException = new IllegalArgumentException();
    illegalArgumentException.initCause(e);
    throw illegalArgumentException;
  }
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

/**
 * Converts an Artifact to an AbstractName for a configuration.  Does not
 * validate that this is a reasonable or resolved Artifact, or that it
 * corresponds to an actual Configuration.
 */
public static AbstractName getConfigurationAbstractName(Artifact configId) throws InvalidConfigException {
  return new AbstractName(configId, Collections.singletonMap("configurationName", configId.toString()), getConfigurationObjectName(configId));
}

代码示例来源:origin: org.apache.geronimo.plugins/activemq-portlets

public List getDependencies(PortletRequest request) {
    ListableRepository[] repo = PortletManager.getCurrentServer(request).getRepositories();
    List dependencies = new ArrayList();
    for (int i = 0; i < repo.length; i++) {
      ListableRepository repository = repo[i];
      SortedSet artifacts = repository.list();
      for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
        Artifact artifact = (Artifact) iterator.next();
        dependencies.add(artifact.toString());
      }
    }

    return dependencies;
  }
}

代码示例来源:origin: org.apache.geronimo.plugins/plancreator-portlets

protected static List<String> getCommonLibs(PortletRequest request) {
  // TODO this is a duplicate of the code from
  // org.apache.geronimo.console.repository.RepositoryViewPortlet.doView()
  // TODO need to eliminate this duplicate code probably by putting it in a common place
  List<String> list = new ArrayList<String>();
  ListableRepository[] repos = PortletManager.getCurrentServer(request).getRepositories();
  for (int i = 0; i < repos.length; i++) {
    ListableRepository repo = repos[i];
    for (Iterator<Artifact> iterator = repo.list().iterator(); iterator.hasNext();) {
      String fileName = iterator.next().toString();
      list.add(fileName);
    }
  }
  return list;
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

private static ObjectName getConfigurationObjectName(Artifact configId) throws InvalidConfigException {
  try {
    return new ObjectName("geronimo.config:name=" + ObjectName.quote(configId.toString()));
  } catch (MalformedObjectNameException e) {
    throw new InvalidConfigException("Could not construct object name for configuration", e);
  }
}

代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin

private void verifyPrerequisites(PluginType plugin) throws MissingDependencyException {
  List<Dependency> missingPrereqs = getMissingPrerequisites(plugin);
  if (!missingPrereqs.isEmpty()) {
    PluginArtifactType metadata = plugin.getPluginArtifact().get(0);
    Artifact moduleId = toArtifact(metadata.getModuleId());
    StringBuilder buf = new StringBuilder();
    buf.append(moduleId.toString()).append(" requires ");
    Iterator<Dependency> iter = missingPrereqs.iterator();
    while (iter.hasNext()) {
      buf.append(iter.next().getArtifact().toString());
      if (iter.hasNext()) {
        buf.append(", ");
      }
    }
    buf.append(" to be installed");
    throw new MissingDependencyException(buf.toString(), null, (Artifact) null);
  }
}

代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin

private void saveHistory() {
  if (installedPluginsList != null) {
    Properties properties = new Properties();
    for (Artifact artifact : installedArtifacts) {
      properties.setProperty(artifact.toString(), "");
    }
    try {
      File historyFile = serverInfo.resolveServer(installedPluginsList);
      File parentFile = historyFile.getParentFile();
      if (!parentFile.exists()) {
        forceMkdir(parentFile);
      }
      OutputStream out = new FileOutputStream(historyFile);
      try {
        properties.save(out, "All the plugins that have ever been installed on this server");
      } finally {
        out.close();
      }
    } catch (IOException e) {
      //give up
    }
  }
}

代码示例来源:origin: org.apache.geronimo.plugins/activemq-portlets

private void loadRARList(RenderRequest renderRequest) {
    // List the available RARs
    List list = new ArrayList();
    ListableRepository[] repos = PortletManager.getCurrentServer(renderRequest).getRepositories();
    for (int i = 0; i < repos.length; i++) {
      ListableRepository repo = repos[i];
      final SortedSet artifacts = repo.list();
      outer:
      for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
        Artifact artifact = (Artifact)iterator.next();
        String test = artifact.toString();
        if (!test.endsWith("/rar")) { //todo: may need to change this logic if configId format changes
          continue;
        } else if (repo.getLocation(artifact).isDirectory()) {
          continue;
        }
        for (int k = 0; k < SKIP_RARS_CONTAINING.length; k++) {
          String skip = SKIP_RARS_CONTAINING[k];
          if (test.indexOf(skip) > -1) {
            continue outer;
          }
        }
        list.add(test);
      }
    }
    Collections.sort(list);
    renderRequest.setAttribute("rars", list);
  }
}

代码示例来源:origin: org.apache.geronimo.plugins/debugviews-portlets

public static void addDependencies(TreeEntry curr, Configuration conf) {
  if (curr == null || conf == null)
    return;
  TreeEntry dep = new TreeEntry("dependencies", NOT_LEAF_TYPE);
  curr.addChild(dep);
  for (Iterator<Dependency> iterator = conf.getEnvironment().getDependencies().iterator(); iterator.hasNext();) {
    dep.addChild(new TreeEntry(iterator.next().getArtifact().toString(), NORMAL_TYPE));
  }
  for (Iterator<Artifact> iterator = conf.getDependencyNode().getServiceParents().iterator(); iterator.hasNext();) {
    Artifact artifact = iterator.next();
    dep.addChild(new TreeEntry(artifact.toString(), NORMAL_TYPE));
  }
}

代码示例来源:origin: org.apache.geronimo.plugins/console-base-portlets

private WebModule getWebModule(Configuration config, Configuration child) {
  try {
    Map<String, String> query1 = new HashMap<String, String>();
    String name = config.getId().getArtifactId();
    query1.put("J2EEApplication", config.getId().toString());
    query1.put("j2eeType", "WebModule");
    query1.put("name", child.getId().getArtifactId().substring(name.length()+1));
    AbstractName childName = new AbstractName(config.getAbstractName().getArtifact(), query1);
    return (WebModule)kernel.getGBean(childName);
  } catch(Exception h){
    // No gbean found, will not happen
    // Except if module not started, ignored
  }
  return null;
}

代码示例来源:origin: org.apache.geronimo.framework/geronimo-bundle-recorder

String recordKey = artifact.toString();
if (Utils.findLineByKeyword(startupFile, recordKey) != null) {

代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel

private Dependency resolveDependency(Collection parents, Dependency dependency, Stack<Dependency> parentStack) throws MissingDependencyException {
  Artifact artifact = dependency.getArtifact();
  // if it is already resolved we are done
  if (artifact.isResolved()) {
    return dependency;
  }
  // we need an artifact resolver at this point
  if (artifactResolver == null) {
    throw new MissingDependencyException("Artifact is not resolved and there no artifact resolver available: " + artifact);
  }
  
  // resolve the artifact
  try {
    artifact = artifactResolver.resolveInClassLoader(artifact, parents);
  } catch (MissingDependencyException e) {
    // I'm throwing away the original error as the new message is lost on the stack as
    // most folks will drill down to the message on the bottom of the stack.
    StringBuffer sb = new StringBuffer();
    sb.append(e.getMessage().trim()+"\n"+"  Parent stack:\n");
    boolean first = true;
    for (Dependency d  : parentStack) {
      sb.append("         "+d.getArtifact().toString().trim()+(first?" (top)":"")+"\n");
      first = false;
    }
    throw new MissingDependencyException(sb.toString());
  }
  // build a new dependency object to contain the resolved artifact
  Dependency resolvedDependency = new Dependency(artifact, dependency.getImportType());
  return resolvedDependency;
}

代码示例来源:origin: org.apache.geronimo.framework/geronimo-deploy-tool

private static PluginListType getPluginsFromIds(List<String> configIds, PluginListType list) throws IllegalStateException {
  PluginListType installList = new PluginListType();
  for (String configId : configIds) {
    PluginType plugin = null;
    for (PluginType metadata : list.getPlugin()) {
      for (PluginArtifactType testInstance : metadata.getPluginArtifact()) {
        if (PluginInstallerGBean.toArtifact(testInstance.getModuleId()).toString().equals(configId)) {
          plugin = PluginInstallerGBean.copy(metadata, testInstance);
          installList.getPlugin().add(plugin);
          break;
        }
      }
    }
    // if plugin value is null here, means the configId is not a geronimo plugin - ignore
  }
  return installList;
}

代码示例来源:origin: org.apache.geronimo.plugins/plancreator-portlets

protected static List<ReferredData> getJDBCConnectionPools(PortletRequest request) {
  // TODO this is a duplicate of the code from
  // org.apache.geronimo.console.databasemanager.wizard.DatabasePoolPortlet.populatePoolList()
  // TODO need to eliminate this duplicate code probably by putting it in a common place
  List<ReferredData> list = new ArrayList<ReferredData>();
  ResourceAdapterModule[] modules = PortletManager.getOutboundRAModules(request, "javax.sql.DataSource");
  for (int i = 0; i < modules.length; i++) {
    ResourceAdapterModule module = modules[i];
    JCAManagedConnectionFactory[] databases = PortletManager.getOutboundFactoriesForRA(request, module,
        "javax.sql.DataSource");
    for (int j = 0; j < databases.length; j++) {
      JCAManagedConnectionFactory db = databases[j];
      AbstractName dbName = PortletManager.getManagementHelper(request).getNameFor(db);
      String poolName = (String) dbName.getName().get(NameFactory.J2EE_NAME);
      String configurationName = dbName.getArtifact().toString() + "/";
      ReferredData data = new ReferredData(poolName + " (" + configurationName + ")", 
          configurationName + "/" + poolName);
      list.add(data);
    }
  }
  return list;
}

代码示例来源:origin: org.apache.geronimo.plugins/plancreator-portlets

public EnvironmentConfigData(EnvironmentType environment) {
  this.environment = environment;
  DependenciesType dependencies = environment.getDependencies();
  if(dependencies != null) {
    DependencyType[] depArray = dependencies.getDependencyArray();
    for(int i = 0; i < depArray.length; i++) {
      DependencyType d = depArray[i];
      Artifact artifact = new Artifact(d.getGroupId(), d.getArtifactId(), d.getVersion(), d.getType());
      dependenciesSet.add(artifact.toString());
    }
  }
}

代码示例来源:origin: org.apache.geronimo.framework/geronimo-deploy-tool

public PluginListType getLocalApplicationPlugins(GeronimoDeploymentManager mgr, ConsoleReader consoleReader) throws DeploymentException, IOException {
  PluginListType data = getLocalPluginCategories(mgr, consoleReader);
  List<String> appList = getApplicationModuleLists(mgr);
  PluginListType appPlugin = getPluginsFromIds(appList, data);
  // let's add framework plugin group manually so that users can choose it
  for (PluginType metadata : data.getPlugin()) {
    for (PluginArtifactType testInstance : metadata.getPluginArtifact()) {
      if (PluginInstallerGBean.toArtifact(testInstance.getModuleId()).toString().indexOf("plugingroups/framework") > 0) {
        PluginType plugin = PluginInstallerGBean.copy(metadata, testInstance);
        appPlugin.getPlugin().add(plugin);
        break;
      }
    }
  }
  return appPlugin;
}

相关文章