本文整理了Java中com.sun.enterprise.deployment.Application.getModules()
方法的一些代码示例,展示了Application.getModules()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Application.getModules()
方法的具体详情如下:
包路径:com.sun.enterprise.deployment.Application
类名称:Application
方法名:getModules
[英]Obtain a full set of module descriptors
[中]获取一整套模块描述符
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* Add all the deployment information about the given application to me.
*/
public void addApplication(Application application) {
for (ModuleDescriptor md : application.getModules()) {
addModule(md);
}
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* Add all the deployment information about the given application to me.
*/
public void addApplication(Application application) {
for (ModuleDescriptor md : application.getModules()) {
addModule(md);
}
}
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* Lookup module by uri.
*
* @param uri the module path in the application archive
* @return a bundle descriptor in this application identified by uri
* or null if not found.
*/
public ModuleDescriptor<BundleDescriptor> getModuleDescriptorByUri(String uri) {
for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) {
if (aModule.getArchiveUri().equals(uri)) {
return aModule;
}
}
return null;
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* Lookup module by uri.
*
* @param uri the module path in the application archive
* @return a bundle descriptor in this application identified by uri
* or null if not found.
*/
public ModuleDescriptor<BundleDescriptor> getModuleDescriptorByUri(String uri) {
for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) {
if (aModule.getArchiveUri().equals(uri)) {
return aModule;
}
}
return null;
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* if this application object is virtual, return the standalone
* bundle descriptor it is wrapping otherwise return null
*
* @return the wrapped standalone bundle descriptor
*/
public BundleDescriptor getStandaloneBundleDescriptor() {
if (isVirtual()) {
if (getModules().size()>1) {
// this is an error, the application is virtual,
// which mean a wrapper for a standalone module and
// it seems I have more than one module in my list...
throw new IllegalStateException("Virtual application contains more than one module");
}
return getModules().iterator().next().getDescriptor();
} else {
return null;
}
}
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* if this application object is virtual, return the standalone
* bundle descriptor it is wrapping otherwise return null
*
* @return the wrapped standalone bundle descriptor
*/
public BundleDescriptor getStandaloneBundleDescriptor() {
if (isVirtual()) {
if (getModules().size()>1) {
// this is an error, the application is virtual,
// which mean a wrapper for a standalone module and
// it seems I have more than one module in my list...
throw new IllegalStateException("Virtual application contains more than one module");
}
return getModules().iterator().next().getDescriptor();
} else {
return null;
}
}
代码示例来源:origin: org.glassfish.connectors/connectors-internal-api
private String getModuleName(BundleDescriptor bundleDesc, Application app) {
Set<ModuleDescriptor<BundleDescriptor>> moduleDescriptors = app.getModules();
if(moduleDescriptors != null){
for(ModuleDescriptor moduleDesc : moduleDescriptors){
if(bundleDesc.equals(moduleDesc.getDescriptor())){
return moduleDesc.getModuleName();
}
}
}
return null;
}
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* Lookup module by uri.
*
* @return a bundle descriptor in this application identified by uri
* or null if not found.
*/
public Collection<ModuleDescriptor<BundleDescriptor>> getModuleDescriptorsByType(ArchiveType type) {
if (type==null) {
throw new IllegalArgumentException("type cannot be null");
}
LinkedList<ModuleDescriptor<BundleDescriptor>> results = new LinkedList<ModuleDescriptor<BundleDescriptor>>();
for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) {
if (type.equals(aModule.getModuleType())) {
results.add(aModule);
}
}
return results;
}
代码示例来源:origin: org.glassfish.deployment/dol
@Override
public boolean isProbablePuRootJar(String jarName) {
return super.isProbablePuRootJar(jarName) &&
// component roots are not scanned while scanning ear. They will be handled
// while scanning the component.
!isComponentJar(jarName,(app.getModules()));
}
}
代码示例来源:origin: org.glassfish.main.deployment/dol
@Override
public boolean isProbablePuRootJar(String jarName) {
return super.isProbablePuRootJar(jarName) &&
// component roots are not scanned while scanning ear. They will be handled
// while scanning the component.
!isComponentJar(jarName,(app.getModules()));
}
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* Lookup module by uri.
*
* @param uri the module path in the application archive
* @return a bundle descriptor in this application identified by uri
* or null if not found.
*/
public Collection<ModuleDescriptor<BundleDescriptor>> getModuleDescriptorsByType(XModuleType type) {
if (type==null) {
throw new IllegalArgumentException("type cannot be null");
}
LinkedList<ModuleDescriptor<BundleDescriptor>> results = new LinkedList<ModuleDescriptor<BundleDescriptor>>();
for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) {
if (type.equals(aModule.getModuleType())) {
results.add(aModule);
}
}
return results;
}
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* A formatted String representing my state.
*/
public void print(StringBuffer toStringBuffer) {
toStringBuffer.append("Application");
toStringBuffer.append("\n");
super.print(toStringBuffer);
toStringBuffer.append("\n smallIcon ").append(super.getSmallIconUri());
for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) {
toStringBuffer.append("\n Module : ");
aModule.print(toStringBuffer);
}
toStringBuffer.append("\n Bundles: \n");
printDescriptorSet(this.getBundleDescriptors(), toStringBuffer);
toStringBuffer.append("\n roles ").append(getRoles());
toStringBuffer.append("\n RoleMapper ").append(this.getRoleMapper());
toStringBuffer.append("\n Realm ").append(realm);
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* @param type the module type
* @param uri the module path in the application archive
* @return a bundle descriptor in this application identified by
* its type and uri
*/
public <T extends BundleDescriptor> T getModuleByTypeAndUri(Class<T> type, String uri) {
for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) {
try {
T descriptor = type.cast(aModule.getDescriptor());
if (descriptor.getModuleDescriptor().getArchiveUri().equals(uri)) {
return descriptor;
}
} catch(ClassCastException e) {
// ignore
}
}
return null;
}
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* @param type the module type
* @param uri the module path in the application archive
* @return a bundle descriptor in this application identified by
* its type and uri
*/
public <T extends BundleDescriptor> T getModuleByTypeAndUri(Class<T> type, String uri) {
for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) {
try {
T descriptor = type.cast(aModule.getDescriptor());
if (descriptor.getModuleDescriptor().getArchiveUri().equals(uri)) {
return descriptor;
}
} catch(ClassCastException e) {
// ignore
}
}
return null;
}
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* Obtain a set of all bundle descriptors, regardless of type
*
* @return the set of bundle descriptors
*/
public Set<BundleDescriptor> getBundleDescriptors() {
Set<BundleDescriptor> bundleSet = new OrderedSet<BundleDescriptor>();
for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) {
BundleDescriptor bundleDesc = aModule.getDescriptor();
if (bundleDesc != null) {
bundleSet.add(bundleDesc);
for (RootDeploymentDescriptor rd :
bundleDesc.getExtensionsDescriptors()) {
if (rd instanceof BundleDescriptor) {
bundleSet.add((BundleDescriptor)rd);
}
}
} else {
DOLUtils.getDefaultLogger().fine("Null descriptor for module " + aModule.getArchiveUri());
}
}
return bundleSet;
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* Obtain a set of all bundle descriptors, regardless of type
*
* @return the set of bundle descriptors
*/
public Set<BundleDescriptor> getBundleDescriptors() {
Set<BundleDescriptor> bundleSet = new OrderedSet<BundleDescriptor>();
for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) {
if (aModule.getDescriptor() != null) {
bundleSet.add(aModule.getDescriptor());
} else {
DOLUtils.getDefaultLogger().fine("Null descriptor for module " + aModule.getArchiveUri());
}
}
return bundleSet;
}
代码示例来源:origin: org.glassfish.main.deployment/deployment-javaee-core
private Collection<ModuleDescriptor<BundleDescriptor>> getSubModuleListForEar(com.sun.enterprise.deployment.Application application, String type) {
Collection<ModuleDescriptor<BundleDescriptor>> modules =
new ArrayList<ModuleDescriptor<BundleDescriptor>>();
if (type == null) {
modules = application.getModules();
} else if (type.equals("servlets")) {
modules = application.getModuleDescriptorsByType(
DOLUtils.warType());
} else if (type.equals("ejbs")) {
modules = application.getModuleDescriptorsByType(
DOLUtils.ejbType());
// ejb in war case
Collection<ModuleDescriptor<BundleDescriptor>> webModules =
application.getModuleDescriptorsByType(DOLUtils.warType());
for (ModuleDescriptor webModule : webModules) {
if (webModule.getDescriptor().getExtensionsDescriptors(EjbBundleDescriptor.class).size() > 0) {
modules.add(webModule);
}
}
}
return modules;
}
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* Perform Optional packages dependencies checking on an archive
*/
@Override
public boolean performOptionalPkgDependenciesCheck(ReadableArchive archive) throws IOException {
if (!super.performOptionalPkgDependenciesCheck(archive))
return false;
// now check sub modules
if (descriptor==null) {
throw new IOException("Application object not set on archivist");
}
boolean returnValue = true;
for (ModuleDescriptor md : descriptor.getModules()) {
ReadableArchive sub = archive.getSubArchive(md.getArchiveUri());
if (sub!=null) {
Archivist subArchivist = archivistFactory.get().getArchivist(md.getModuleType());
if (!subArchivist.performOptionalPkgDependenciesCheck(sub))
returnValue = false;
}
}
return returnValue;
}
代码示例来源:origin: org.glassfish.main.deployment/dol
/**
* writes an application deployment descriptors
* @param the application object
* @param the abstract archive
*/
public void write(Application application, ReadableArchive in,
WritableArchive out) throws IOException {
if (application.isVirtual()) {
ModuleDescriptor aModule = (ModuleDescriptor) application.getModules().iterator().next();
Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType());
write((BundleDescriptor)aModule.getDescriptor(), moduleArchivist, in, out);
} else {
// this is a real application.
// let's start by writing out all submodules deployment descriptors
for (ModuleDescriptor aModule : application.getModules()) {
Archivist moduleArchivist = archivistFactory.getArchivist(aModule.getModuleType());
WritableArchive moduleArchive = out.createSubArchive(aModule.getArchiveUri());
ReadableArchive moduleArchive2 = in.getSubArchive(aModule.getArchiveUri());
write((BundleDescriptor)aModule.getDescriptor(), moduleArchivist, moduleArchive2, moduleArchive);
}
// now let's write the application descriptor
ApplicationArchivist archivist = archivistProvider.get();
archivist.setDescriptor(application);
archivist.writeDeploymentDescriptors(in, out);
}
}
代码示例来源:origin: org.glassfish.deployment/dol
/**
* Perform Optional packages dependencies checking on an archive
*/
@Override
public boolean performOptionalPkgDependenciesCheck(ReadableArchive archive) throws IOException {
if (!super.performOptionalPkgDependenciesCheck(archive))
return false;
// now check sub modules
if (descriptor==null) {
throw new IOException("Application object not set on archivist");
}
boolean returnValue = true;
for (ModuleDescriptor md : descriptor.getModules()) {
ReadableArchive sub = archive.getSubArchive(md.getArchiveUri());
if (sub!=null) {
Archivist subArchivist = archivistFactory.get().getPrivateArchivistFor(md.getModuleType());
if (!subArchivist.performOptionalPkgDependenciesCheck(sub))
returnValue = false;
}
}
return returnValue;
}
内容来源于网络,如有侵权,请联系作者删除!