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

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

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

Artifact.isResolved介绍

暂无

代码示例

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

private RemoteOpenResult(Artifact artifact, InputStream in) {
  if (!artifact.isResolved()) {
    throw new IllegalStateException("Artifact is not resolved: " + artifact);
  }
  this.artifact = artifact;
  this.in = in;
}

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

public void addOwnedConfigurations(Artifact id) {
  if (id == null) throw new NullPointerException("id is null");
  if (!id.isResolved()) throw new IllegalArgumentException("id is not resolved: " + id);
  ownedConfigurations.add(id);
}

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

public LinkedHashSet resolveInClassLoader(Collection artifacts, Collection parentConfigurations) throws MissingDependencyException {
  LinkedHashSet resolvedArtifacts = new LinkedHashSet();
  for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
    Artifact artifact = (Artifact) iterator.next();
    if (!artifact.isResolved()) {
      artifact = resolveInClassLoader(artifact, parentConfigurations);
    }
    resolvedArtifacts.add(artifact);
  }
  return resolvedArtifacts;
}

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

public synchronized boolean isRunning(Artifact configId) {
  if(!configId.isResolved()) {
    throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
  }
  return configurationModel.isStarted(configId);
}

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

public void loadArtifacts(Artifact loader, Set artifacts) {
  if (!loader.isResolved()) throw new IllegalArgumentException("loader is not a resolved artifact: " + loader);
  for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
    Artifact artifact = (Artifact) iterator.next();
    if (!artifact.isResolved()) {
      throw new IllegalArgumentException("artifact is not a resolved artifact: " + artifact);
    }
  }
  synchronized (this) {
    if (artifactsByLoader.containsKey(loader)) throw new IllegalArgumentException("loader has already declared artifacts: "+ loader);
    artifactsByLoader.put(loader, artifacts);
    processArtifact(loader);
    for (Iterator iterator = artifacts.iterator(); iterator.hasNext();) {
      Artifact artifact = (Artifact) iterator.next();
      processArtifact(artifact);
    }
  }
}

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

public synchronized boolean isInstalled(Artifact configId) {
  if(!configId.isResolved()) {
    throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
  }
  List storeSnapshot = getStoreList();
  for (int i = 0; i < storeSnapshot.size(); i++) {
    ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
    if(store.containsConfiguration(configId)) {
      return true;
    }
  }
  return false;
}

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

public ConfigurationStore getStoreForConfiguration(Artifact configId) {
  if(!configId.isResolved()) {
    throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
  }
  List storeSnapshot = getStoreList();
  for (int i = 0; i < storeSnapshot.size(); i++) {
    ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
    if(store.containsConfiguration(configId)) {
      return store;
    }
  }
  return null;
}

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

public synchronized Configuration getConfiguration(Artifact configurationId) {
  if(!configurationId.isResolved()) {
    throw new IllegalArgumentException("Artifact "+configurationId+" is not fully resolved");
  }
  if(reloadingConfiguration != null && reloadingConfiguration.getId().equals(configurationId)) {
    return reloadingConfiguration;
  }
  return (Configuration) configurations.get(configurationId);
}

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

public Artifact resolveInClassLoader(Artifact source, Collection parentConfigurations) throws MissingDependencyException {
    // Some tests break if we acntually try to search for fully-resolved artifacts
    if(source.isResolved()) {
      return source;
    }
//        if (artifact.getType() == null) {
//            throw new IllegalArgumentException("Type not set " + artifact);
//        }
//
//        String groupId = source.getGroupId();
//        if (groupId == null) {
//            groupId = Artifact.DEFAULT_GROUP_ID;
//        }

//        Version version = source.getVersion();

    Artifact working = resolveVersion(parentConfigurations, source);
    if (working == null || !working.isResolved()) {
      throw new MissingDependencyException("Unable to resolve dependency " + source);
    }

    return working;
  }

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

public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException, DeploymentException {
  ApplicationInfo applicationInfo = (ApplicationInfo) plan;
  Artifact test = applicationInfo.getEnvironment().getConfigId();
  if (!test.isResolved()) {
    throw new IllegalStateException("Module ID should be fully resolved by now (not " + test + ")");
  }
  return test;
}

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

public boolean isConfiguration(Artifact artifact) {
  if(!artifact.isResolved()) {
    throw new IllegalArgumentException("Artifact "+artifact+" is not fully resolved");
  }
  synchronized (this) {
    // if it is loaded, it is definitely a configuration
    if (configurations.containsKey(artifact)) {
      return true;
    }
  }
  // see if any stores think it is a configuration
  List storeSnapshot = getStoreList();
  for (int i = 0; i < storeSnapshot.size(); i++) {
    ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
    if (store.containsConfiguration(artifact)) {
      return true;
    }
  }
  return false;
}

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

public OpenResult open(Artifact artifact, FileWriteMonitor monitor) throws IOException, FailedLoginException {
  if (!artifact.isResolved()) {
    try {
      artifact = artifactResolver.resolveInClassLoader(artifact);
    } catch (MissingDependencyException e) {
      throw (IOException)new IOException("Could not resolve artifact " + artifact + " in repo " + rootFile).initCause(e);
    }
  }
  File location = getLocation(artifact);
  return new LocalOpenResult(artifact, location);
}

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

public File getLocation(Artifact artifact) {
  if(!artifact.isResolved()) {
    throw new IllegalArgumentException("Artifact "+artifact+" is not fully resolved");
  }
  File path = new File(rootFile, artifact.getGroupId().replace('.', File.separatorChar));
  path = new File(path, artifact.getArtifactId());
  path = new File(path, artifact.getVersion().toString());
  path = new File(path, artifact.getArtifactId() + "-" + artifact.getVersion() + "." + artifact.getType());
  return path;
}

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

public synchronized boolean isLoaded(Artifact configId) {
  if(!configId.isResolved()) {
    throw new IllegalArgumentException("Artifact "+configId+" is not fully resolved");
  }
  if(reloadingConfiguration != null && reloadingConfiguration.getId().equals(configId)) {
    return true;
  }
  return configurationModel.isLoaded(configId);
}

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

public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException, DeploymentException {
  ModuleType configType = (ModuleType) plan;
  EnvironmentType environmentType = configType.getEnvironment();
  Environment environment = EnvironmentBuilder.buildEnvironment(environmentType, defaultEnvironment);
  idBuilder.resolve(environment, module == null ? "" : new File(module.getName()).getName(), "car");
  if(!environment.getConfigId().isResolved()) {
    throw new IllegalStateException("Service Module ID is not fully populated ("+environment.getConfigId()+")");
  }
  return environment.getConfigId();
}

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

public void installLibrary(File libFile, Artifact artifact) throws IOException {
  if (artifact == null || !artifact.isResolved())
    throw new IllegalArgumentException("Artifact is not valid when install library");
  
  if (identifyOSGiBundle(libFile) != null) {
    writeableRepo.copyToRepository(libFile, artifact, new RepoFileWriteMonitor());
  } else {
    // convert to osgi bundle jars using wrap url handler
    URL wrap = new URL("wrap", null, libFile.toURI().toURL().toExternalForm() 
        + "$Bundle-SymbolicName=" + artifact.getArtifactId() 
        + "&Bundle-Version=" + artifact.getVersion().toString().replace("-", ".")+"&DynamicImport-Package=*"); //need improve the version processing
    InputStream in = null;
    try {
      in = wrap.openStream();
      writeableRepo.copyToRepository(in, (int) libFile.getTotalSpace(), artifact, new RepoFileWriteMonitor());
    } finally {
      if (in != null)
        in.close();
    }
  }
}

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

public Artifact generateArtifact(Artifact source, String defaultType) {
  if(source.isResolved()) {
    Artifact deAliased = (Artifact) explicitResolution.get(source);
    if (deAliased !=  null) {
      return deAliased;
    }
    return source;
  }
  String groupId = source.getGroupId() == null ? Artifact.DEFAULT_GROUP_ID : source.getGroupId();
  String artifactId = source.getArtifactId();
  String type = source.getType() == null ? defaultType : source.getType();
  Version version = source.getVersion() == null ? new Version(Long.toString(System.currentTimeMillis())) : source.getVersion();
  return new Artifact(groupId, artifactId, version, type);
}

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

public synchronized LifecycleResults stopConfiguration(Artifact id, LifecycleMonitor monitor) throws NoSuchConfigException {
  if(!id.isResolved()) {
    throw new IllegalArgumentException("Artifact "+id+" is not fully resolved");
  }
  LinkedHashSet stopList = configurationModel.stop(id);
  addConfigurationsToMonitor(monitor, stopList);
  LifecycleResults results = new LifecycleResults();
  for (Iterator iterator = stopList.iterator(); iterator.hasNext();) {
    Artifact configurationId = (Artifact) iterator.next();
    Configuration configuration = getConfiguration(configurationId);
    monitor.stopping(configurationId);
    stop(configuration);
    monitor.succeeded(configurationId);
    results.addStopped(configurationId);
  }
  monitor.finished();
  return results;
}

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

private Artifact getConfigID(JarFile module,
    ModuleIDBuilder idBuilder,
    Object plan,
    ConfigurationBuilder builder) throws IOException, DeploymentException, InvalidConfigException {
  Artifact configID = builder.getConfigurationID(plan, module, idBuilder);
  // If the Config ID isn't fully resolved, populate it with defaults
  if (!configID.isResolved()) {
    configID = idBuilder.resolve(configID, "car");
  }
  // Make sure this configuration doesn't already exist
  try {
    kernel.getGBeanState(Configuration.getConfigurationAbstractName(configID));
    throw new DeploymentException("Module " + configID + " already exists in the server.  Try to undeploy it first or use the redeploy command.");
  } catch (GBeanNotFoundException e) {
    // this is good
  }
  return configID;
}

代码示例来源: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;
}

相关文章