本文整理了Java中org.apache.geronimo.kernel.repository.Artifact
类的一些代码示例,展示了Artifact
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Artifact
类的具体详情如下:
包路径:org.apache.geronimo.kernel.repository.Artifact
类名称:Artifact
暂无
代码示例来源: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.modules/geronimo-kernel
public NoSuchConfigException(Artifact configId) {
super(configId.toString());
this.configId = configId;
}
代码示例来源: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());
} else {
artifact = new Artifact(fromPlan ? Artifact.DEFAULT_GROUP_ID : null, name, (Version)null, null);
if(artifact.matches(Artifact.create(allModules[i].getModuleID()))) {
list.add(allModules[i]);
代码示例来源:origin: org.apache.geronimo.modules/geronimo-deploy-farm
protected Artifact newArtifact(Artifact configId, String artifactId) {
return new Artifact(configId.getGroupId(), artifactId, configId.getVersion(), configId.getType());
}
代码示例来源: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-bundle-recorder
private String getMvnLocationFromArtifact(Artifact artifact){
if (artifact == null) return null;
StringBuilder bundleLocation = new StringBuilder();
bundleLocation.append("mvn:");
bundleLocation.append(artifact.getGroupId()).append('/').append(artifact.getArtifactId()).append('/').append(artifact.getVersion());
return bundleLocation.toString();
}
代码示例来源:origin: org.apache.geronimo.framework/geronimo-deployment
/**
* Creates a new artifact using entirely default values.
*
* @param defaultArtifact The artifactId to use for the new Artifact
* @param defaultType The type to use for the new Artifact
*/
public Artifact createDefaultArtifact(String defaultArtifact, String defaultType) {
return new Artifact(defaultGroup, defaultArtifact, defaultVersion, defaultType);
}
代码示例来源: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-deploy-farm
public boolean isMasterConfigurationName(Artifact configId) {
return configId.getArtifactId().endsWith(ARTIFACT_SUFFIX);
}
代码示例来源: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-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.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.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.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());
Artifact name = (Artifact) it.next();
updateStatus("Started "+name);
if(configID.matches(name)) {
newStarted = true;
代码示例来源: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.modules/geronimo-kernel
public SortedSet getLoadedArtifacts(Artifact query) {
List values = (List) artifactsByArtifact.get(query.getArtifactId());
SortedSet results = new TreeSet();
if (values != null) {
for (int i = 0; i < values.size(); i++) {
Artifact test = (Artifact) values.get(i);
if(query.matches(test)) {
results.add(test);
}
}
}
return results;
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel
public void copyToRepository(InputStream source, int size, Artifact destination, FileWriteMonitor monitor) throws IOException {
if(!destination.isResolved()) {
throw new IllegalArgumentException("Artifact "+destination+" is not fully resolved");
}
// is this a writable repository
if (!rootFile.canWrite()) {
throw new IllegalStateException("This repository is not writable: " + rootFile.getAbsolutePath() + ")");
}
// where are we going to install the file
File location = getLocation(destination);
// assure that there isn't already a file installed at the specified location
if (location.exists()) {
throw new IllegalArgumentException("Destination " + location.getAbsolutePath() + " already exists!");
}
ArtifactTypeHandler typeHandler = (ArtifactTypeHandler) typeHandlers.get(destination.getType());
if (typeHandler == null) typeHandler = DEFAULT_TYPE_HANDLER;
typeHandler.install(source, size, destination, monitor, location);
if (destination.getType().equalsIgnoreCase("car")) {
log.debug("Installed module configuration; id=" + destination + "; location=" + location);
}
}
}
代码示例来源:origin: org.apache.geronimo.framework/geronimo-deployment
/**
* Guarantees that the argument Environment will have a present and fully
* qualified module ID when this method returns. If the Environment is
* missing a module ID, or has a partial module ID (isResolved() == false)
* then this method will fill in any missing values. If the module ID is
* present and resolved, then this method does nothing.
*
* @param environment The Environment to check and populate
* @param defaultArtifactId The artifactId to use if the Envrionment does
* not have a module ID at all
* @param defaultType The type to use if the Environment is lacking
* a module ID or the module ID is lacking a type
*/
public void resolve(Environment environment, String defaultArtifactId, String defaultType) {
if(environment.getConfigId() == null) {
environment.setConfigId(resolve(new Artifact(null, defaultArtifactId, (Version)null, defaultType), defaultType));
} else if(!environment.getConfigId().isResolved()) {
environment.setConfigId(resolve(environment.getConfigId(), defaultType));
}
}
}
代码示例来源: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.modules/geronimo-kernel
private boolean hasHardDependency(Artifact configurationId, ConfigurationData configurationData) {
for (Iterator iterator = configurationData.getEnvironment().getDependencies().iterator(); iterator.hasNext();) {
Dependency dependency = (Dependency) iterator.next();
Artifact artifact = dependency.getArtifact();
if (artifact.getVersion() != null && artifact.matches(configurationId)) {
return true;
}
}
for (Iterator iterator = configurationData.getChildConfigurations().values().iterator(); iterator.hasNext();) {
ConfigurationData childConfigurationData = (ConfigurationData) iterator.next();
if (hasHardDependency(configurationId, childConfigurationData)) {
return true;
}
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!