本文整理了Java中org.apache.geronimo.kernel.repository.Artifact.getGroupId()
方法的一些代码示例,展示了Artifact.getGroupId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Artifact.getGroupId()
方法的具体详情如下:
包路径:org.apache.geronimo.kernel.repository.Artifact
类名称:Artifact
方法名:getGroupId
暂无
代码示例来源: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.modules/geronimo-kernel
public File getLocation(Artifact artifact) {
File path = new File(rootFile, artifact.getGroupId());
path = new File(path, artifact.getType() + "s");
String ext = artifact.getType();
if(ext.equals("ejb")) {
ext = "jar";
}
path = new File(path, artifact.getArtifactId() + "-" + artifact.getVersion() + "." + ext);
return path;
}
代码示例来源: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 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-deploy-farm
protected Artifact newArtifact(Artifact configId, String artifactId) {
return new Artifact(configId.getGroupId(), artifactId, configId.getVersion(), configId.getType());
}
代码示例来源:origin: org.apache.geronimo.framework/geronimo-deployment
/**
* Translates the argument Artifact to a fully-resolved Artifact, which is
* returned. If the argument was fully-resolved to begin with it is
* returned as is. Otherwise, a new Artifact is returned with any missing
* values populated.
*
* @param argument The artifact to review
* @param defaultType The type to use if the artifact to review has no
* type specified
*
* @return A fully resolved Artifact
*
* @throws IllegalArgumentException Occurs when the argument artifact does
* not have an artifactId
*/
public Artifact resolve(Artifact argument, String defaultType) {
if(argument.isResolved()) {
return argument;
}
if(argument.getArtifactId() == null || argument.getArtifactId().equals("")) {
throw new IllegalArgumentException("Incoming Artifact must have an ArtifactID (not "+argument+")");
}
return new Artifact(argument.getGroupId() == null || argument.getGroupId().equals("") ? defaultGroup : argument.getGroupId(),
argument.getArtifactId(),
argument.getVersion() == null ? defaultVersion : argument.getVersion(),
argument.getType() == null || argument.getType().equals("") ? defaultType : argument.getType());
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-kernel
public SortedSet list(Artifact query) {
if(query.getGroupId() != null) { // todo: see if more logic can be shared with the other case
File path = new File(rootFile, query.getGroupId().replace('.', File.separatorChar));
path = new File(path, query.getArtifactId());
if(!path.canRead() || !path.isDirectory()) {
artifacts.add(new Artifact(query.getGroupId(), query.getArtifactId(), version, end));
代码示例来源:origin: org.apache.geronimo.framework/geronimo-deployment
private Artifact resolve(Artifact configID) throws DeploymentException {
String group = configID.getGroupId();
if (group == null) {
group = Artifact.DEFAULT_GROUP_ID;
}
String artifactId = configID.getArtifactId();
if (artifactId == null) {
throw new DeploymentException("Every configuration to deploy must have a ConfigID with an ArtifactID (not " + configID + ")");
}
Version version = configID.getVersion();
if (version == null) {
version = new Version(Long.toString(System.currentTimeMillis()));
}
String type = configID.getType();
if (type == null) {
type = "car";
}
return new Artifact(group, artifactId, version, type);
}
代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin
private URL getURL(Artifact configId) throws MalformedURLException {
String qualifiedVersion = configId.getVersion().toString();
if (configId.getVersion() instanceof SnapshotVersion) {
SnapshotVersion ssVersion = (SnapshotVersion) configId.getVersion();
String timestamp = ssVersion.getTimestamp();
int buildNumber = ssVersion.getBuildNumber();
if (timestamp != null && buildNumber != 0) {
qualifiedVersion = qualifiedVersion.replaceAll("SNAPSHOT", timestamp + "-" + buildNumber);
}
}
return base.resolve(configId.getGroupId().replace('.', '/') + "/"
+ configId.getArtifactId() + "/" + configId.getVersion()
+ "/" + configId.getArtifactId() + "-"
+ qualifiedVersion + "." + configId.getType()).toURL();
}
代码示例来源: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.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.framework/geronimo-service-builder
private static void fillArtifactType(Artifact artifact, ArtifactType artifactType) {
if (artifact.getGroupId() != null) {
artifactType.setGroupId(artifact.getGroupId());
}
if (artifact.getArtifactId() != null) {
artifactType.setArtifactId(artifact.getArtifactId());
}
if (artifact.getVersion() != null) {
artifactType.setVersion(artifact.getVersion().toString());
}
if (artifact.getType() != null) {
artifactType.setType(artifact.getType());
}
}
代码示例来源:origin: org.apache.geronimo.framework/geronimo-naming
@Override
protected Name createBindingName(AbstractName abstractName, Object value) throws NamingException {
String name = abstractName.getNameProperty("name");
if (namePattern != null) {
Matcher matcher = namePattern.matcher(name);
if (!matcher.matches()) {
return null;
}
}
Map<String, String> map = new HashMap<String, String>(abstractName.getName());
Artifact artifact = abstractName.getArtifact();
map.put("groupId", artifact.getGroupId());
map.put("artifactId", artifact.getArtifactId());
map.put("version", artifact.getVersion().toString());
map.put("type", artifact.getType());
String fullName = format(format, map);
Name parsedName = getContext().getNameParser("").parse(getNameInNamespace()+"/" + fullName);
// create intermediate contexts
for (int i = 1; i < parsedName.size(); i++) {
Name contextName = parsedName.getPrefix(i);
if (!bindingExists(getContext(), contextName)) {
getContext().createSubcontext(contextName);
}
}
return parsedName;
}
代码示例来源:origin: org.apache.geronimo.framework/geronimo-deployment
private void createTempManifest() throws DeploymentException, IOException {
Environment env = new Environment(environment);
Artifact id = env.getConfigId();
env.setConfigId(new Artifact(id.getGroupId(), id.getArtifactId() + "-DEPLOYMENT", id.getVersion(), id.getType()));
env.addToBundleClassPath(bundleClassPath);
env.setBundleActivator(null);
env.addDynamicImportPackage("*");
OSGiMetaDataBuilder osgiMetaDataBuilder = new OSGiMetaDataBuilder(bundleContext, new DummyExportPackagesSelector());
try {
osgiMetaDataBuilder.build(env);
} catch (IllegalConfigurationException e) {
throw new DeploymentException(e);
}
Manifest manifest;
try {
manifest = env.getManifest();
} catch (ManifestException e) {
throw new DeploymentException(e);
}
File metaInf = new File(getConfigurationDir(), "META-INF");
metaInf.mkdirs();
FileWriter fw = new FileWriter(new File(metaInf, "MANIFEST.MF"));
PrintWriter pw = new PrintWriter(fw);
try {
manifest.write(pw);
} finally {
pw.close();
fw.close();
}
}
代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin
public PluginType getPlugin(Artifact sourceArtifact) {
PluginType plugin = new PluginType();
PluginArtifactType pluginArtifact = new PluginArtifactType();
ArtifactType artifact = new ArtifactType();
artifact.setGroupId(sourceArtifact.getGroupId());
artifact.setArtifactId(sourceArtifact.getArtifactId());
artifact.setVersion(sourceArtifact.getVersion().toString());
artifact.setType(sourceArtifact.getType());
pluginArtifact.setModuleId(artifact);
plugin.getPluginArtifact().add(pluginArtifact);
return plugin;
}
代码示例来源: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/plancreator-portlets
public void parseEnvironment(Environment env) {
ArtifactType moduleId = environment.addNewModuleId();
Artifact configId = env.getConfigId();
moduleId.setGroupId(configId.getGroupId());
moduleId.setArtifactId(configId.getArtifactId());
moduleId.setVersion(configId.getVersion().toString());
moduleId.setType(configId.getType());
//List<Dependency> deps = env.getDependencies();
//for (int i = 0; i < deps.size(); i++) {
// String depString = deps.get(i).toString();
// dependenciesSet.add(depString.substring(6, depString.length() - 1));
//}
}
代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin
public static ArtifactType toArtifactType(Artifact id) {
ArtifactType artifact = new ArtifactType();
artifact.setGroupId(id.getGroupId());
artifact.setArtifactId(id.getArtifactId());
artifact.setVersion(id.getVersion() == null ? null : id.getVersion().toString());
artifact.setType(id.getType());
return artifact;
}
代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin
public static DependencyType toDependencyType(Dependency dep, boolean includeVersion) {
Artifact id = dep.getArtifact();
DependencyType dependency = new DependencyType();
dependency.setGroupId(id.getGroupId());
dependency.setArtifactId(id.getArtifactId());
if (includeVersion) {
dependency.setVersion(id.getVersion() == null ? null : id.getVersion().toString());
}
dependency.setType(id.getType());
return dependency;
}
代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin
meta.setCategory("Unknown");
instance.getGeronimoVersion().add(serverInfo.getVersion());
instance.getObsoletes().add(toArtifactType(new Artifact(moduleId.getGroupId(),
moduleId.getArtifactId(),
(Version) null,
内容来源于网络,如有侵权,请联系作者删除!