本文整理汇总了Java中org.jboss.shrinkwrap.api.ArchivePaths.create方法的典型用法代码示例。如果您正苦于以下问题:Java ArchivePaths.create方法的具体用法?Java ArchivePaths.create怎么用?Java ArchivePaths.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.shrinkwrap.api.ArchivePaths
的用法示例。
在下文中一共展示了ArchivePaths.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addFiles
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
private static void addFiles(WebArchive war, File dir, ArchivePath context) {
if (!dir.isDirectory()) {
throw new RuntimeException(dir.getAbsolutePath()
+ " is not a directory");
}
for (File f : dir.listFiles()) {
if (f.isFile()) {
ArchivePath fileContext = ArchivePaths.create(context,
f.getName());
war.addAsWebResource(f, fileContext);
} else {
addFiles(war, f, ArchivePaths.create(context, f.getName()));
}
}
}
示例2: createTestModule
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
private static void createTestModule() throws Exception {
final File moduleXml = new File(DuplicateExtCommandTestCase.class.getResource(DuplicateExtCommandTestCase.class.getSimpleName() + "-module.xml").toURI());
testModule = new TestModule(MODULE_NAME, moduleXml);
final JavaArchive archive = testModule.addResource("test-cli-duplicate-commands-module.jar")
.addClass(DuplicateExtCommandHandler.class)
.addClass(DuplicateExtCommandHandlerProvider.class)
.addClass(DuplicateExtCommandsExtension.class)
.addClass(CliExtCommandsParser.class)
.addClass(DuplicateExtCommand.class)
.addClass(DuplicateExtCommandSubsystemResourceDescription.class);
ArchivePath services = ArchivePaths.create("/");
services = ArchivePaths.create(services, "services");
final ArchivePath extService = ArchivePaths.create(services, Extension.class.getName());
archive.addAsManifestResource(getResource(DuplicateExtCommandsExtension.class), extService);
final ArchivePath cliCmdService = ArchivePaths.create(services, CommandHandlerProvider.class.getName());
archive.addAsManifestResource(getResource(DuplicateExtCommandHandlerProvider.class), cliCmdService);
final ArchivePath cliAeshCmdService = ArchivePaths.create(services, Command.class.getName());
archive.addAsManifestResource(getResource(DuplicateExtCommand.class), cliAeshCmdService);
testModule.create(true);
}
示例3: createTestModule
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
private static void createTestModule() throws Exception {
File moduleXml = new File(CustomSecurityVault.class.getResource(CustomVaultInModuleTestCase.class.getSimpleName() + "-module.xml").toURI());
testModule = new TestModule(MODULE_NAME, moduleXml);
JavaArchive archive = testModule.addResource("test-custom-vault-in-module.jar")
.addClass(CustomSecurityVault.class)
.addClass(TestVaultExtension.class)
.addClass(TestVaultParser.class)
.addClass(TestVaultRemoveHandler.class)
.addClass(TestVaultResolveExpressionHandler.class)
.addClass(TestVaultSubsystemResourceDescription.class);
ArchivePath path = ArchivePaths.create("/");
path = ArchivePaths.create(path, "services");
path = ArchivePaths.create(path, Extension.class.getName());
archive.addAsManifestResource(CustomSecurityVault.class.getPackage(), Extension.class.getName(), path);
testModule.create(true);
picketLink = PicketBoxModuleUtil.createTestModule();
}
示例4: buildExplicitPar
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
protected File buildExplicitPar() {
String fileName = "explicitpar.par";
JavaArchive archive = ShrinkWrap.create( JavaArchive.class, fileName );
archive.addClasses(
Airplane.class,
Seat.class,
Cat.class,
Kitten.class,
Distributor.class,
Item.class
);
ArchivePath path = ArchivePaths.create( "META-INF/orm.xml" );
archive.addAsResource( "explicitpar/META-INF/orm.xml", path );
path = ArchivePaths.create( "META-INF/persistence.xml" );
archive.addAsResource( "explicitpar/META-INF/persistence.xml", path );
File testPackage = new File( shrinkwrapArchiveDirectory, fileName );
archive.as( ZipExporter.class ).exportTo( testPackage, true );
return testPackage;
}
示例5: buildExplodedPar
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
protected File buildExplodedPar() {
String fileName = "explodedpar";
JavaArchive archive = ShrinkWrap.create( JavaArchive.class,fileName );
archive.addClasses(
Elephant.class,
Carpet.class
);
ArchivePath path = ArchivePaths.create( "META-INF/persistence.xml" );
archive.addAsResource( "explodedpar/META-INF/persistence.xml", path );
path = ArchivePaths.create( "org/hibernate/jpa/test/pack/explodedpar/Elephant.hbm.xml" );
archive.addAsResource( "explodedpar/org/hibernate/jpa/test/pack/explodedpar/Elephant.hbm.xml", path );
path = ArchivePaths.create( "org/hibernate/jpa/test/pack/explodedpar/package-info.class" );
archive.addAsResource( "org/hibernate/jpa/test/pack/explodedpar/package-info.class", path );
File testPackage = new File( shrinkwrapArchiveDirectory, fileName );
archive.as( ExplodedExporter.class ).exportExploded( shrinkwrapArchiveDirectory );
return testPackage;
}
示例6: buildExcludeHbmPar
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
protected File buildExcludeHbmPar() {
String fileName = "excludehbmpar.par";
JavaArchive archive = ShrinkWrap.create( JavaArchive.class,fileName );
archive.addClasses(
Caipirinha.class
);
ArchivePath path = ArchivePaths.create( "META-INF/orm2.xml" );
archive.addAsResource( "excludehbmpar/META-INF/orm2.xml", path );
path = ArchivePaths.create( "META-INF/persistence.xml" );
archive.addAsResource( "excludehbmpar/META-INF/persistence.xml", path );
path = ArchivePaths.create( "org/hibernate/jpa/test/pack/excludehbmpar/Mouse.hbm.xml" );
archive.addAsResource( "excludehbmpar/org/hibernate/jpa/test/pack/excludehbmpar/Mouse.hbm.xml", path );
File testPackage = new File( shrinkwrapArchiveDirectory, fileName );
archive.as( ZipExporter.class ).exportTo( testPackage, true );
return testPackage;
}
示例7: buildCfgXmlPar
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
protected File buildCfgXmlPar() {
String fileName = "cfgxmlpar.par";
JavaArchive archive = ShrinkWrap.create( JavaArchive.class,fileName );
archive.addClasses(
Morito.class,
Item.class
);
ArchivePath path = ArchivePaths.create( "META-INF/persistence.xml" );
archive.addAsResource( "cfgxmlpar/META-INF/persistence.xml", path );
path = ArchivePaths.create( "org/hibernate/jpa/test/pack/cfgxmlpar/hibernate.cfg.xml" );
archive.addAsResource( "cfgxmlpar/org/hibernate/jpa/test/pack/cfgxmlpar/hibernate.cfg.xml", path );
File testPackage = new File( shrinkwrapArchiveDirectory, fileName );
archive.as( ZipExporter.class ).exportTo( testPackage, true );
return testPackage;
}
示例8: buildOverridenPar
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
protected File buildOverridenPar() {
String fileName = "overridenpar.jar";
JavaArchive archive = ShrinkWrap.create( JavaArchive.class, fileName );
archive.addClasses(
org.hibernate.jpa.test.pack.overridenpar.Bug.class
);
ArchivePath path = ArchivePaths.create( "META-INF/persistence.xml" );
archive.addAsResource( "overridenpar/META-INF/persistence.xml", path );
path = ArchivePaths.create( "overridenpar.properties" );
archive.addAsResource( "overridenpar/overridenpar.properties", path );
File testPackage = new File( shrinkwrapArchiveDirectory, fileName );
archive.as( ZipExporter.class ).exportTo( testPackage, true );
return testPackage;
}
示例9: handleDependencies
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
public static void handleDependencies(Archive<?> archive) {
if (archive instanceof ManifestContainer<?> == false) {
throw new IllegalArgumentException("ManifestContainer expected: " + archive);
}
final Manifest manifest = getOrCreateManifest(archive);
ManifestContainer manifestContainer = ManifestContainer.class.cast(archive);
Attributes attributes = manifest.getMainAttributes();
if (attributes.getValue(Attributes.Name.MANIFEST_VERSION.toString()) == null) {
attributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
}
String value = attributes.getValue("Dependencies");
StringBuilder moduleDeps = new StringBuilder(value != null && value.trim().length() > 0 ? value : "");
moduleDeps.append(defaultDependencies[0]);
for (int i = 1; i < defaultDependencies.length; i++) {
moduleDeps.append(",").append(defaultDependencies[i]);
}
attributes.putValue("Dependencies", moduleDeps.toString());
// Add the manifest to the archive
ArchivePath manifestPath = ArchivePaths.create(JarFile.MANIFEST_NAME);
archive.delete(manifestPath);
manifestContainer.addAsManifestResource(new Asset() {
public InputStream openStream() {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
manifest.write(baos);
return new ByteArrayInputStream(baos.toByteArray());
} catch (IOException ex) {
throw new IllegalStateException("Cannot write manifest", ex);
}
}
}, "MANIFEST.MF");
}
示例10: createTestModule
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
private static void createTestModule() throws Exception {
final File moduleXml = new File(CliExtCommandsTestCase.class.getResource(CliExtCommandsTestCase.class.getSimpleName() + "-module.xml").toURI());
testModule = new TestModule(MODULE_NAME, moduleXml);
final JavaArchive archive = testModule.addResource("test-cli-ext-commands-module.jar")
.addClass(CliExtCommandHandler.class)
.addClass(CliExtCommand.class)
.addClass(CliExtCommandHandlerProvider.class)
.addClass(CliExtCommandsExtension.class)
.addClass(CliExtCommandsParser.class)
.addClass(CliExtCommandsSubsystemResourceDescription.class);
ArchivePath services = ArchivePaths.create("/");
services = ArchivePaths.create(services, "services");
ArchivePath help = ArchivePaths.create("/");
help = ArchivePaths.create(help, "help");
final ArchivePath extService = ArchivePaths.create(services, Extension.class.getName());
archive.addAsManifestResource(CliExtCommandHandler.class.getPackage(), Extension.class.getName(), extService);
final ArchivePath cliCmdService = ArchivePaths.create(services, CommandHandlerProvider.class.getName());
archive.addAsManifestResource(CliExtCommandHandler.class.getPackage(), CommandHandlerProvider.class.getName(), cliCmdService);
final ArchivePath cliAeshCmdService = ArchivePaths.create(services, Command.class.getName());
archive.addAsManifestResource(CliExtCommand.class.getPackage(), Command.class.getName(), cliAeshCmdService);
final ArchivePath helpService = ArchivePaths.create(help, CliExtCommandHandler.NAME + ".txt");
archive.addAsResource(CliExtCommandHandler.class.getPackage(), CliExtCommandHandler.NAME + ".txt", helpService);
final ArchivePath help2Service = ArchivePaths.create("/"
+ CliExtCommand.class.getPackage().getName().replaceAll("\\.", "/"), "command_resources.properties");
archive.addAsResource(CliExtCommand.class.getPackage(), "command_resources.properties", help2Service);
testModule.create(true);
}
示例11: addModulesManifestDependencies
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
/**
* Adds the Manifest Attribute "Dependencies" with the required dependencies for JBoss Modules to depend on the Arquillian Service.
*
* @param appArchive The Archive to deploy
*/
private void addModulesManifestDependencies(Archive<?> appArchive) {
if (appArchive instanceof ManifestContainer<?> == false)
throw new IllegalArgumentException("ManifestContainer expected " + appArchive);
final Manifest manifest = ManifestUtils.getOrCreateManifest(appArchive);
Attributes attributes = manifest.getMainAttributes();
if (attributes.getValue(Attributes.Name.MANIFEST_VERSION.toString()) == null) {
attributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
}
String value = attributes.getValue("Dependencies");
StringBuffer moduleDeps = new StringBuffer(value != null && value.trim().length() > 0 ? value : "org.jboss.modules");
for (String dep : defaultDependencies) {
if (moduleDeps.indexOf(dep) < 0) {
moduleDeps.append("," + dep);
}
if(optionalDeps.contains(dep)) {
moduleDeps.append(" optional");
}
}
log.debugf("Add dependencies: %s", moduleDeps);
attributes.putValue("Dependencies", moduleDeps.toString());
// Add the manifest to the archive
ArchivePath manifestPath = ArchivePaths.create(JarFile.MANIFEST_NAME);
appArchive.delete(manifestPath);
appArchive.add(new Asset() {
public InputStream openStream() {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
manifest.write(baos);
return new ByteArrayInputStream(baos.toByteArray());
} catch (IOException ex) {
throw new IllegalStateException("Cannot write manifest", ex);
}
}
}, manifestPath);
}
示例12: buildDefaultPar
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
protected File buildDefaultPar() {
final String fileName = "defaultpar.par";
final File physicalParFile = new File( shrinkwrapArchiveDirectory, fileName );
if ( physicalParFile.exists() ) {
return physicalParFile;
}
JavaArchive archive = ShrinkWrap.create( JavaArchive.class, fileName );
archive.addClasses(
ApplicationServer.class,
Lighter.class,
Money.class,
Mouse.class,
OtherIncrementListener.class,
IncrementListener.class,
Version.class
);
ArchivePath path = ArchivePaths.create( "META-INF/orm.xml" );
archive.addAsResource( "defaultpar/META-INF/orm.xml", path );
path = ArchivePaths.create( "META-INF/persistence.xml" );
archive.addAsResource( "defaultpar/META-INF/persistence.xml", path );
path = ArchivePaths.create( "org/hibernate/jpa/test/pack/defaultpar/Mouse.hbm.xml" );
archive.addAsResource( "defaultpar/org/hibernate/jpa/test/pack/defaultpar/Mouse.hbm.xml", path );
path = ArchivePaths.create( "org/hibernate/jpa/test/pack/defaultpar/package-info.class" );
archive.addAsResource( "org/hibernate/jpa/test/pack/defaultpar/package-info.class", path );
archive.as( ZipExporter.class ).exportTo( physicalParFile, true );
return physicalParFile;
}
示例13: buildSpacePar
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
protected File buildSpacePar() {
String fileName = "space par.par";
JavaArchive archive = ShrinkWrap.create( JavaArchive.class, fileName );
archive.addClasses(
Bug.class
);
ArchivePath path = ArchivePaths.create( "META-INF/persistence.xml" );
archive.addAsResource( "space par/META-INF/persistence.xml", path );
File testPackage = new File( shrinkwrapArchiveDirectory, fileName );
archive.as( ZipExporter.class ).exportTo( testPackage, true );
return testPackage;
}
示例14: buildExternalJar
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
protected File buildExternalJar() {
String fileName = "externaljar.jar";
JavaArchive archive = ShrinkWrap.create( JavaArchive.class, fileName );
archive.addClasses(
Scooter.class
);
ArchivePath path = ArchivePaths.create( "META-INF/orm.xml" );
archive.addAsResource( "externaljar/META-INF/orm.xml", path );
File testPackage = new File( shrinkwrapArchiveDirectory, fileName );
archive.as( ZipExporter.class ).exportTo( testPackage, true );
return testPackage;
}
示例15: buildLargeJar
import org.jboss.shrinkwrap.api.ArchivePaths; //导入方法依赖的package包/类
protected File buildLargeJar() {
final String fileName = "large.jar";
final JavaArchive archive = ShrinkWrap.create( JavaArchive.class, fileName );
// Build a large jar by adding a lorem ipsum file repeatedly.
final File loremipsumTxtFile = new File( testSrcDirectory, "resources/org/hibernate/jpa/test/packaging/loremipsum.txt" );
for ( int i = 0; i < 100; i++ ) {
ArchivePath path = ArchivePaths.create( "META-INF/file" + i );
archive.addAsResource( loremipsumTxtFile, path );
}
File testPackage = new File( shrinkwrapArchiveDirectory, fileName );
archive.as( ZipExporter.class ).exportTo( testPackage, true );
return testPackage;
}