congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ShrinkWrap.createDomain
Code IndexAdd Tabnine to your IDE (free)

How to use
createDomain
method
in
org.jboss.shrinkwrap.api.ShrinkWrap

Best Java code snippets using org.jboss.shrinkwrap.api.ShrinkWrap.createDomain (Showing top 20 results out of 315)

origin: org.jboss.shrinkwrap/shrinkwrap-api

/**
 * Creates a new {@link Domain} containing a default {@link Configuration}. {@link ArchiveFactory}s created from
 * this domain will have isolated configuration from archive factories created from other domains. Likewise, all
 * {@link ArchiveFactory}s and {@link Archive}s created from the returned domain will share the same configuration.
 *
 * @return A new {@link Domain} with default configuration
 */
public static Domain createDomain() {
  return createDomain(new ConfigurationBuilder());
}
origin: shrinkwrap/shrinkwrap

/**
 * Creates a new {@link Domain} containing a default {@link Configuration}. {@link ArchiveFactory}s created from
 * this domain will have isolated configuration from archive factories created from other domains. Likewise, all
 * {@link ArchiveFactory}s and {@link Archive}s created from the returned domain will share the same configuration.
 *
 * @return A new {@link Domain} with default configuration
 */
public static Domain createDomain() {
  return createDomain(new ConfigurationBuilder());
}
origin: itesla/ipst

protected static void writeLimits(Network network, EurostagDictionary dictionary, OutputStream os, EurostagEchExportConfig exportConfig) throws IOException {
  writeLimits(network, dictionary, ShrinkWrap.createDomain(), os, exportConfig);
}
origin: itesla/ipst

public GenericArchive writeFaultSeqArchive(List<Contingency> contingencies, Network network, EurostagDictionary dictionary, Function<Integer, String> seqFileNameFct) throws IOException {
  return writeFaultSeqArchive(ShrinkWrap.createDomain(), contingencies, network, dictionary, seqFileNameFct);
}
origin: org.jboss.shrinkwrap/shrinkwrap-api

/**
 * Creates a new {@link Domain} containing configuration properties from the supplied {@link ConfigurationBuilder}.
 * {@link ArchiveFactory}s created from this domain will have isolated configuration from archive factories created
 * from other domains. Likewise, all {@link ArchiveFactory}s and {@link Archive}s created from the returned domain
 * will share the same configuration.
 *
 * @param builder
 *            Builder with which we should create a {@link Configuration} for this {@link Domain}
 * @return A new {@link Domain} with default configuration
 * @throws IllegalArgumentException
 *             If the builder is not supplied
 */
public static Domain createDomain(final ConfigurationBuilder builder) throws IllegalArgumentException {
  if (builder == null) {
    throw new IllegalArgumentException("builder must be supplied");
  }
  return createDomain(builder.build());
}
origin: shrinkwrap/shrinkwrap

/**
 * Creates a new {@link Domain} containing configuration properties from the supplied {@link ConfigurationBuilder}.
 * {@link ArchiveFactory}s created from this domain will have isolated configuration from archive factories created
 * from other domains. Likewise, all {@link ArchiveFactory}s and {@link Archive}s created from the returned domain
 * will share the same configuration.
 *
 * @param builder
 *            Builder with which we should create a {@link Configuration} for this {@link Domain}
 * @return A new {@link Domain} with default configuration
 * @throws IllegalArgumentException
 *             If the builder is not supplied
 */
public static Domain createDomain(final ConfigurationBuilder builder) throws IllegalArgumentException {
  if (builder == null) {
    throw new IllegalArgumentException("builder must be supplied");
  }
  return createDomain(builder.build());
}
origin: io.thorntail/arquillian-daemon

Server(final InetSocketAddress bindAddress) {
  // Precondition checks
  assert bindAddress != null : "Bind address must be specified";
  // Determine the ClassLoader to use in creating the SW Domain
  final ClassLoader thisCl = Server.class.getClassLoader();
  final Set<ClassLoader> classloaders = new HashSet<>(1);
  classloaders.add(thisCl);
  if (Server.log.isLoggable(Level.FINEST)) {
    Server.log.finest("Using ClassLoader for ShrinkWrap Domain: " + thisCl);
  }
  this.shrinkwrapDomain = ShrinkWrap.createDomain(new ConfigurationBuilder().classLoaders(classloaders));
  // Set
  this.bindAddress = bindAddress;
}
origin: wildfly-swarm-archive/ARCHIVE-wildfly-swarm

Server(final InetSocketAddress bindAddress, ClassLoader classLoader) {
  // Precondition checks
  assert bindAddress != null : "Bind address must be specified";
  // Determine the ClassLoader to use in creating the SW Domain
  final ClassLoader thisCl = Server.class.getClassLoader();
  final Set<ClassLoader> classloaders = new HashSet<>(1);
  classloaders.add(thisCl);
  if (Server.log.isLoggable(Level.FINEST)) {
    Server.log.finest("Using ClassLoader for ShrinkWrap Domain: " + thisCl);
  }
  final Domain shrinkwrapDomain = ShrinkWrap.createDomain(new ConfigurationBuilder().classLoaders(classloaders));
  // Set
  this.bindAddress = bindAddress;
  this.deployedArchives = new ConcurrentHashMap<>();
  this.shrinkwrapDomain = shrinkwrapDomain;
  this.classLoader = classLoader;
}
origin: org.jboss.arquillian.daemon/arquillian-daemon-server

/**
 * Creates a new instance, to be bound on start at the specified, required {@link InetSocketAddress}
 *
 * @param bindAddress
 */
public ServerBase(final InetSocketAddress bindAddress) {
  // Precondition checks
  assert bindAddress != null : "Bind address must be specified";
  // Determine the ClassLoader to use in creating the SW Domain
  final ClassLoader thisCl = NettyServer.class.getClassLoader();
  final Set<ClassLoader> classloaders = new HashSet<ClassLoader>(1);
  classloaders.add(thisCl);
  if (log.isLoggable(Level.FINEST)) {
    log.finest("Using ClassLoader for ShrinkWrap Domain: " + thisCl);
  }
  final Domain shrinkwrapDomain = ShrinkWrap.createDomain(new ConfigurationBuilder().classLoaders(classloaders));
  // Set
  this.bindAddress = bindAddress;
  this.deployedArchives = new ConcurrentHashMap<String, GenericArchive>();
  this.shrinkwrapDomain = shrinkwrapDomain;
}
origin: shrinkwrap/shrinkwrap

/**
 * Ensures we cannot create a new {@link Domain} with null {@link Configuration} specified
 */
@Test(expected = IllegalArgumentException.class)
public void newDomainRequiresConfiguration() {
  ShrinkWrap.createDomain((Configuration) null);
}
origin: shrinkwrap/shrinkwrap

/**
 * Ensures we cannot create a new {@link Domain} with null {@link ConfigurationBuilder} specified
 */
@Test(expected = IllegalArgumentException.class)
public void newDomainRequiresConfigurationBuilder() {
  ShrinkWrap.createDomain((ConfigurationBuilder) null);
}
origin: itesla/ipst

@Override
public void init(SimulationParameters parameters, Map<String, Object> context) throws Exception {
  Objects.requireNonNull(parameters, "parameters is null");
  Objects.requireNonNull(context, "context is null");
  this.parameters = parameters;
  // exportConfig = new EurostagEchExportConfig(config.isLfNoGeneratorMinMaxQ());
  // isLfNoGeneratorMinMaxQ must now be configured in eurostag-ech-export section
  exportConfig = EurostagEchExportConfig.load();
  fakeNodes = EurostagFakeNodes.build(network, exportConfig);
  parallelIndexes = BranchParallelIndexes.build(network, exportConfig, fakeNodes);
  // fill iTesla id to Esg id dictionary
  dictionary = EurostagDictionary.create(network, parallelIndexes, exportConfig, fakeNodes);
  if (config.isUseBroadcast()) {
    Domain domain = ShrinkWrap.createDomain();
    try (OutputStream ddbOs = computationManager.newCommonFile(DDB_ZIP_FILE_NAME);
       OutputStream dictGensOs = computationManager.newCommonFile(DDB_DICT_GENS_CSV)) {
      writeDtaAndControls(domain, ddbOs, dictGensOs);
    }
    try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(computationManager.newCommonFile(PRE_FAULT_SEQ_FILE_NAME), StandardCharsets.UTF_8))) {
      writePreFaultSeq(writer);
    }
  }
  context.put("dictionary", dictionary);
}
origin: org.teiid/thorntail-runtime

public static VDBArchive archiveFromCurrentApp() throws Exception {
  Configuration config = ShrinkWrap.getDefaultDomain().getConfiguration();
  ArrayList<ClassLoader> existing = new ArrayList<>();
  Iterator<ClassLoader> it = config.getClassLoaders().iterator();
  while (it.hasNext()) {
    existing.add(it.next());
  }
  existing.add(VDBArchive.class.getClassLoader());
  ConfigurationBuilder builder = new ConfigurationBuilder();
  builder.classLoaders(existing);
  builder.extensionLoader(new ServiceExtensionLoader(existing));
  Domain domain = ShrinkWrap.createDomain(builder);
  final VDBArchive archive = domain.getArchiveFactory().create(VDBArchive.class, determineName());
  //final VDBArchive archive = ShrinkWrap.create(VDBArchive.class, determineName());
  final DefaultDeploymentFactory factory = new DefaultVDBDeploymentFactory();
  factory.setup(archive);
  archive.addAllDependencies();
  return archive;
}
origin: itesla/ipst

@Override
public void init(SimulationParameters parameters, Map<String, Object> context) throws Exception {
  Objects.requireNonNull(parameters, "parameters is null");
  Objects.requireNonNull(context, "context is null");
  this.parameters = parameters;
  dictionary = getDictionary(context);
  // read all contingencies
  allContingencies.addAll(contingenciesProvider.getContingencies(network));
  if (config.isUseBroadcast()) {
    Domain domain = ShrinkWrap.createDomain();
    try (OutputStream os = computationManager.newCommonFile(ALL_SCENARIOS_ZIP_FILE_NAME)) {
      writeAllScenarios(domain, os);
    }
    try (OutputStream os = computationManager.newCommonFile(WP43_ALL_CONFIGS_ZIP_FILE_NAME)) {
      writeAllWp43Configs(domain, os);
    }
    try (OutputStream os = computationManager.newCommonFile(LIMITS_ZIP_FILE_NAME)) {
      writeLimits(network, dictionary, domain, os, exportConfig);
    }
  }
}
origin: shrinkwrap/shrinkwrap

@Before
public void setUp() throws IOException {
  Archive<?> archive = buildArchive();
  
  tempFile = File.createTempFile("test", archive instanceof WebArchive ? ".war" : ".jar");
  archive.as(ZipExporter.class).exportTo(tempFile, true);
  URL archiveUrl = tempFile.toURI().toURL();
  URLClassLoader archiveCl = buildArchiveClassLoader(archiveUrl);
  ClassLoader shrinkwrapCl = new FilteringClassLoader(this.getClass().getClassLoader());
  ConfigurationBuilder builder = new ConfigurationBuilder();
  builder.classLoaders(Arrays.asList(archiveCl, shrinkwrapCl));
  // Create a domain that includes the `donotchange` classes within a .jar/.war
  // and the rest, excluding `donotchange` from the regular app classloader.
  this.domain = ShrinkWrap.createDomain(builder.build());
}
origin: shrinkwrap/shrinkwrap

/**
 * Ensures that we can create a new {@link Domain} with explicit {@link ConfigurationBuilder}
 */
@Test
public void createDomainWithExplicitConfigurationBuilder() {
  // Define configuration properties
  final ExecutorService service = Executors.newSingleThreadExecutor();
  final ExtensionLoader loader = new MockExtensionLoader();
  // Create a new domain using these config props in a builder
  final Domain domain = ShrinkWrap.createDomain(new ConfigurationBuilder().executorService(service)
    .extensionLoader(loader));
  // Test
  TestCase.assertEquals(ExecutorService.class.getSimpleName() + " specified was not contained in resultant "
    + Domain.class.getSimpleName(), service, domain.getConfiguration().getExecutorService());
  TestCase.assertEquals(ExtensionLoader.class.getSimpleName() + " specified was not contained in resultant "
    + Domain.class.getSimpleName(), loader, domain.getConfiguration().getExtensionLoader());
}
origin: shrinkwrap/shrinkwrap

/**
 * Ensures that we can create a new {@link Domain} with explicit {@link Configuration}
 */
@Test
public void createDomainWithExplicitConfiguration() {
  // Define configuration properties
  final ExecutorService service = Executors.newSingleThreadExecutor();
  final ExtensionLoader loader = new MockExtensionLoader();
  // Create a new domain using these config props in a config
  final Domain domain = ShrinkWrap.createDomain(new ConfigurationBuilder().executorService(service)
    .extensionLoader(loader).build());
  // Test
  TestCase.assertEquals(ExecutorService.class.getSimpleName() + " specified was not contained in resultant "
    + Domain.class.getSimpleName(), service, domain.getConfiguration().getExecutorService());
  TestCase.assertEquals(ExtensionLoader.class.getSimpleName() + " specified was not contained in resultant "
    + Domain.class.getSimpleName(), loader, domain.getConfiguration().getExtensionLoader());
}
origin: shrinkwrap/shrinkwrap

/**
 * Ensures that we may add extension overrides via the {@link ExtensionLoader} through some new {@link Domain}
 *
 * @throws Exception
 */
@Test
public void shouldBeAbleToAddOverride() throws Exception {
  final Domain domain = ShrinkWrap.createDomain();
  domain.getConfiguration().getExtensionLoader().addOverride(JavaArchive.class, MockJavaArchiveImpl.class);
  final JavaArchive archive = domain.getArchiveFactory().create(JavaArchive.class, "test.jar");
  Assert.assertEquals("Should have overridden normal JavaArchive impl", MockJavaArchiveImpl.class,
    archive.getClass());
}
origin: shrinkwrap/shrinkwrap

/**
 * {@inheritDoc}
 *
 * @see org.jboss.shrinkwrap.api.Archive#shallowCopy(Filter)
 */
@Override
public Archive<T> shallowCopy(Filter<ArchivePath> filter) {
  Validate.notNull(filter, "Filter must be specified");
  // Get the actual class type and make a shallow copy of the the underlying archive,
  // using the same underlying configuration
  final Class<T> actualClass = this.getActualClass();
  final Archive<?> underlyingArchive = this.getArchive();
  final Configuration existingConfig = ((Configurable) underlyingArchive).getConfiguration();
  final Domain domain = ShrinkWrap.createDomain(existingConfig);
  final ArchiveFactory factory = domain.getArchiveFactory();
  final Archive<T> newArchive = factory.create(actualClass, this.getName());
  final Map<ArchivePath, Node> contents = underlyingArchive.getContent();
  for (final ArchivePath path : contents.keySet()) {
    Asset asset = contents.get(path).getAsset();
    if (asset != null) {
      if(!filter.include(path)) {
        continue;
      }
      newArchive.add(asset, path);
    }
  }
  return newArchive;
}
origin: shrinkwrap/shrinkwrap

/**
 * Ensures that we can create isolated {@link Domain}s
 */
@Test
public void createIsolatedDomains() {
  // Make a couple domains
  final Domain domain1 = ShrinkWrap.createDomain();
  final Domain domain2 = ShrinkWrap.createDomain();
  // Ensure they exist
  TestCase.assertNotNull("Domain should exist", domain1);
  TestCase.assertNotNull("Domain should exist", domain2);
  // Ensure they're not equal
  TestCase.assertNotSame("Creation of domains should return new instances", domain1, domain2);
  // Ensure the underlying configs are not equal
  TestCase.assertNotSame("Creation of domains should have unique / isolated configurations",
    domain1.getConfiguration(), domain2.getConfiguration());
}
org.jboss.shrinkwrap.apiShrinkWrapcreateDomain

Javadoc

Creates a new Domain containing a default Configuration. ArchiveFactorys created from this domain will have isolated configuration from archive factories created from other domains. Likewise, all ArchiveFactorys and Archives created from the returned domain will share the same configuration.

Popular methods of ShrinkWrap

  • create
  • createFromZipFile
    Creates a new archive of the specified type as imported from the specified File. The file is expecte
  • getDefaultDomain
    Returns a single domain with default configuration for use in applications with no explicit configur

Popular in Java

  • Creating JSON documents from java classes using gson
  • getResourceAsStream (ClassLoader)
  • runOnUiThread (Activity)
  • getContentResolver (Context)
  • Permission (java.security)
    Legacy security code; do not use.
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Option (scala)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now