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

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

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

Artifact.create介绍

暂无

代码示例

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

private static Artifact toArtifact(String attrValue) {
  try {
    return Artifact.create(attrValue);
  } catch (Exception e) {
    return new Artifact(DEFAULT_GROUPID, attrValue.replace('/', '_'), DEFAULT_VERSION, "car");
  }
}

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

public void newServerInstance(String serverName) throws Exception {
  try {
    PluginListType pluginList = new PluginListType();
    for (String artifactString : defaultPlugins) {
      Artifact artifact = Artifact.create(artifactString);
      PluginType plugin = getPlugin(artifact);
      pluginList.getPlugin().add(plugin);
    }
    Artifact query = Artifact.createPartial("///");
    for (PersistentConfigurationList persistentConfigurationList : persistentConfigurationLists) {
      for (Artifact installed : persistentConfigurationList.getListedConfigurations(query)) {
        PluginType plugin = getPlugin(installed);
        pluginList.getPlugin().add(plugin);
      }
    }
    Kernel kernel = new BasicKernel("assembly", bundleContext);
    try {
      PluginInstallerGBean pluginInstallerGBean = oldPluginInstallerGBean.pluginInstallerCopy(serverName, kernel);
      GeronimoSourceRepository localSourceRepository = new GeronimoSourceRepository(configManager.getRepositories(), configManager.getArtifactResolver());
      DownloadResults downloadPoller = new DownloadResults();
      pluginInstallerGBean.install(pluginList, localSourceRepository, true, null, null, downloadPoller);
    } finally {
      kernel.shutdown();
    }
  } catch (Throwable t) {
    t.printStackTrace();
  }
}

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

private void notifyWatchers(List<String> list) {
  Artifact[] arts = new Artifact[list.size()];
  for (int i = 0; i < list.size(); i++) {
    String s = list.get(i);
    arts[i] = Artifact.create(s);
  }
  for (Iterator<DeploymentWatcher> it = watchers.iterator(); it.hasNext();) {
    DeploymentWatcher watcher = it.next();
    for (int i = 0; i < arts.length; i++) {
      Artifact art = arts[i];
      watcher.deployed(art);
    }
  }
}

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

public static Artifact getConfigurationID(ObjectName objectName) {
  if (isConfigurationObjectName(objectName)) {
    String name = ObjectName.unquote(objectName.getKeyProperty("name"));
    return Artifact.create(name);
  } else {
    throw new IllegalArgumentException("ObjectName " + objectName + " is not a Configuration name");
  }
}

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

private void loadHistory() {
  if (installedPluginsList != null) {
    File historyFile = serverInfo.resolveServer(installedPluginsList);
    Properties properties = new Properties();
    try {
      InputStream in = new FileInputStream(historyFile);
      try {
        properties.load(in);
        for (Object key : properties.keySet()) {
          Artifact artifact = Artifact.create((String) key);
          installedArtifacts.add(artifact);
        }
      } finally {
        in.close();
      }
    } catch (IOException e) {
      //give up
    }
  }
}

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

private static ConfigurationInfo readConfigurationInfo(String prefix, Properties properties, AbstractName storeName, File inPlaceLocation) throws IOException {
  String id = properties.getProperty(prefix+"id");
  Artifact configId = Artifact.create(id);
    if (name.startsWith(prefix+"owned.")) {
      String value = (String) entry.getValue();
      Artifact ownedConfiguration = Artifact.create(value);
      ownedConfigurations.add(ownedConfiguration);

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

/**
 * Puts the name and ID of a plugin into the argument map of plugins,
 * by reading the values out of the provided plugin descriptor file.
 *
 * @param xml     The geronimo-plugin.xml for this plugin
 * @param plugins The result map to populate
 */
private void readNameAndID(File xml, Map<String, Artifact> plugins) {
  try {
    SAXParserFactory factory = XmlUtil.newSAXParserFactory();
    SAXParser parser = factory.newSAXParser();
    PluginNameIDHandler handler = new PluginNameIDHandler();
    parser.parse(xml, handler);
    if (handler.isComplete()) {
      plugins.put(handler.getName(), Artifact.create(handler.getID()));
    }
  } catch (Exception e) {
    log.warn("Invalid XML at " + xml.getAbsolutePath(), e);
  }
}

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

String startLevel = line.substring(pos + 1).trim();
String mvnLocation = getMvnLocationFromArtifact(Artifact.create(name));
Bundle bundle = findBundle(mvnLocation);
if (bundle == null) {

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

public void deployPlan(File moduleFile, File planFile) {
  try {
    Kernel kernel = KernelRegistry.getSingleKernel();
    List list = (List) kernel.invoke(ObjectNameConstants.DEPLOYER_OBJECT_NAME, DEPLOY_METHOD,
        new Object[] {moduleFile, planFile}, DEPLOYER_ARGS);
    ConfigurationManager configurationManager = ConfigurationUtil
        .getConfigurationManager(kernel);
    for (Iterator iterator = list.iterator(); iterator.hasNext();) {
      Artifact configID = Artifact.create((String)iterator.next());
      if (!configurationManager.isLoaded(configID)) {
        configurationManager.loadConfiguration(configID);
      }
      configurationManager.startConfiguration(configID);
    }
  } catch (DeploymentException e) {
    StringBuilder buf = new StringBuilder(256);
    Throwable cause = e;
    while (cause != null) {
      buf.append(cause.getMessage());
      buf.append(LINE_SEP);
      cause = cause.getCause();
    }
    log.error("Problem deploying the ActiveMQ connector: " + buf);
  } catch (URISyntaxException e) {
    log.error("Newly installed app has invalid config ID", e);
  } catch (Exception e) {
    log.error("Problem creating the datasource", e);
  }
}

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

/**
 * Puts the name and ID of a plugin into the argument map of plugins,
 * by reading the values out of the provided plugin descriptor stream.
 *
 * @param xml     The geronimo-plugin.xml for this plugin
 * @param plugins The result map to populate
 */
private void readNameAndID(InputStream xml, Map plugins) {
  try {
    SAXParserFactory factory = XmlUtil.newSAXParserFactory();
    SAXParser parser = factory.newSAXParser();
    PluginNameIDHandler handler = new PluginNameIDHandler();
    parser.parse(xml, handler);
    if (handler.isComplete()) {
      plugins.put(handler.getName(), Artifact.create(handler.getID()));
    }
  } catch (Exception e) {
    log.warn("Invalid XML", e);
  }
}

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

public void mergeOverrides(String server, AttributesType overrides) throws InvalidGBeanException, IOException {
  ServerInstance serverInstance = servers.get(server);
  if (serverInstance == null) {
    throw new NullPointerException("No such server: " + server + ", known servers: " + servers.keySet());
  }
  PluginAttributeStore attributeStore = serverInstance.getAttributeStore();
  for (ModuleType module : overrides.getModule()) {
    Artifact artifact = Artifact.create(module.getName());
    attributeStore.setModuleGBeans(artifact, module.getGbean(), module.isLoad(), module.getCondition());
    attributeStore.save();
  }
  if (overrides.getConfiguration().size() > 0) {
    throw new UnsupportedOperationException("Use modules, not configurations");
  }
}

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

public JpaPluginInstance(String artifactUri) {
  Artifact artifact = Artifact.create(artifactUri);
  this.groupId = artifact.getGroupId();
  this.artifactId = artifact.getArtifactId();
  this.version = artifact.getVersion().toString();
  this.type = artifact.getType();
}

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

ConfigurationManager configurationManager = ConfigurationUtil
    .getConfigurationManager(kernel);
Artifact destinationConfigArtifact = Artifact.create(destinationConfigURIName);
AbstractName configurationObjectName = Configuration.getConfigurationAbstractName(destinationConfigArtifact);

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

String target = name.substring(0, pos);
String module = name.substring(pos+1);
Artifact artifact = Artifact.create(module);
artifact = new Artifact(artifact.getGroupId() == null && fromPlan ? Artifact.DEFAULT_GROUP_ID : artifact.getGroupId(),
    artifact.getArtifactId(), fromPlan ? (Version)null : artifact.getVersion(), artifact.getType());
  if(allModules[i].getTarget().getName().equals(target) && artifact.matches(Artifact.create(allModules[i].getModuleID()))) {
    list.add(allModules[i]);
artifact = Artifact.create(name);
artifact = new Artifact(artifact.getGroupId() == null && fromPlan ? Artifact.DEFAULT_GROUP_ID : artifact.getGroupId(),
    artifact.getArtifactId(), fromPlan ? (Version)null : artifact.getVersion(), artifact.getType());
if(artifact.matches(Artifact.create(allModules[i].getModuleID()))) {
  list.add(allModules[i]);

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

commandContext.setInPlace(inPlaceConfiguration.booleanValue());
doDeploy(target, false);
Artifact configID = Artifact.create(getResultTargetModuleIDs()[0].getModuleID());
LifecycleResults results = manager.reloadConfiguration(previous, configID.getVersion());

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

private void populateDependency(DependencyType dep, String dependencyString) {
  Artifact artifact = Artifact.create(dependencyString.trim());
  dep.setArtifactId(artifact.getArtifactId());
  if (artifact.getGroupId() != null) {
    dep.setGroupId(artifact.getGroupId());
  }
  if (artifact.getType() != null) {
    dep.setType(artifact.getType());
  }
  if (artifact.getVersion() != null) {
    dep.setVersion(artifact.getVersion().toString());
  }
}

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

public static Bundle getRepositoryEntryBundle(PortletRequest request, String repositoryURI) {
  J2EEServer server = getCurrentServer(request);
  Artifact uri = Artifact.create(repositoryURI);
  if (!uri.isResolved()) {
    Artifact[] all = server.getConfigurationManager().getArtifactResolver().queryArtifacts(uri);
    if (all.length == 0) {
      return null;
    } else {
      uri = all[all.length - 1];
    }
  }
  try {
    Kernel kernel = getKernel();
    BundleContext bundleContext = kernel.getBundleFor(kernel.getKernelName()).getBundleContext();
    //TODO Figure out who should be responsible for uninstalling it, and whether we need to start the bundle
    //Currently, this method is only used for resource reading, seems no need to start the bundle.
    return bundleContext.installBundle("mvn:" + uri.getGroupId() + "/" + uri.getArtifactId() + "/" + uri.getVersion() + ("jar".equals(uri.getType()) ? "" : "/" + uri.getType()));
  } catch (Exception e) {
    return null;
  }
}

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

public static File getRepositoryEntry(PortletRequest request, String repositoryURI) {
  J2EEServer server = getCurrentServer(request);
  Repository[] repos = server.getRepositories();
  Artifact uri = Artifact.create(repositoryURI);
  if (!uri.isResolved()) {
    Artifact[] all = server.getConfigurationManager().getArtifactResolver().queryArtifacts(uri);
    if (all.length == 0) {
      return null;
    } else {
      uri = all[all.length - 1];
    }
  }
  for (int i = 0; i < repos.length; i++) {
    Repository repo = repos[i];
    if (repo.contains(uri)) {
      return repo.getLocation(uri);
    }
  }
  return null;
}

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

ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
String config = getConfigID(actionRequest);
Artifact configId = Artifact.create(config);

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

TargetModuleIDImpl module = (TargetModuleIDImpl) modules[i];
Artifact moduleID = Artifact.create(module.getModuleID());
try {
  if(!configurationManager.isOnline()) {

相关文章