protected ContainerBase(final Class<T> actualType, final Archive<?> archive) { super(archive); Validate.notNull(actualType, "ActualType should be specified"); this.actualType = actualType; }
@Override public T addAsManifestResources(Package resourcePackage, String... resourceNames) throws IllegalArgumentException { Validate.notNull(resourcePackage, "ResourcePackage must be specified"); Validate.notNullAndNoNullValues(resourceNames, "ResourceNames must be specified and can not container null values"); for (String resourceName : resourceNames) { addAsManifestResource(resourcePackage, resourceName); } return covarientReturn(); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#add(org.jboss.shrinkwrap.api.asset.Asset, * org.jboss.shrinkwrap.api.ArchivePath) */ @Override public T add(Asset asset, ArchivePath path) { Validate.notNull(asset, "No asset was specified"); Validate.notNull(path, "No path was specified"); return addAsset(path, asset); }
@Override public T setResourceAdapterXML(Package resourcePackage, String resourceName) throws IllegalArgumentException { Validate.notNull(resourcePackage, "ResourcePackage must be specified"); Validate.notNull(resourceName, "ResourceName must be specified"); return addAsManifestResource(resourcePackage, resourceName, "ra.xml"); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.container.ManifestContainer#addAsManifestResource(java.lang.String, * java.lang.String) */ @Override public T addAsManifestResource(String resourceName, String target) throws IllegalArgumentException { Validate.notNull(resourceName, "ResourceName should be specified"); Validate.notNull(target, "Target should be specified"); return addAsManifestResource(fileFromResource(resourceName), target); }
@Override public T addAsWebResource(String resourceName, String target) throws IllegalArgumentException { Validate.notNull(resourceName, "ResourceName should be specified"); Validate.notNull(target, "Target should be specified"); return addAsWebResource(new ClassLoaderAsset(resourceName), target); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.container.WebContainer#addAsWebInfResource(java.lang.String, java.lang.String) */ @Override public T addAsWebInfResource(final String resourceName, final String target) throws IllegalArgumentException { Validate.notNull(resourceName, "ResourceName should be specified"); Validate.notNull(target, "Target should be specified"); return addAsWebInfResource(new ClassLoaderAsset(resourceName), target); }
@Override public T addAsManifestResource(Package resourcePackage, String resourceName) throws IllegalArgumentException { Validate.notNull(resourcePackage, "ResourcePackage must be specified"); Validate.notNull(resourceName, "ResourceName must be specified"); String classloaderResourceName = AssetUtil.getClassLoaderResourceName(resourcePackage, resourceName); ArchivePath target = ArchivePaths.create(classloaderResourceName); return addAsManifestResource(resourcePackage, resourceName, target); }
@Override public T addAsApplicationResource(Asset resource, ArchivePath target) throws IllegalArgumentException { Validate.notNull(resource, "Resource must be specified"); Validate.notNull(target, "Target must be specified"); ArchivePath location = new BasicPath(getApplicationPath(), target); return add(resource, location); }
@Override public T addAsApplicationResource(File resource) throws IllegalArgumentException { Validate.notNull(resource, "Resource must be specified"); return addAsApplicationResource(new FileAsset(resource), resource.getName()); }
@Override public T addPackages(boolean recursive, Package... packages) throws IllegalArgumentException { Validate.notNull(packages, "Packages must be specified"); return addPackages(recursive, Filters.includeAll(), packages); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#add(NamedAsset)) */ @Override public T add(NamedAsset namedAsset) { Validate.notNull(namedAsset, "No named asset was specified"); return add(namedAsset, namedAsset.getName()); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.Archive#merge(org.jboss.shrinkwrap.api.Archive, java.lang.String, * org.jboss.shrinkwrap.api.Filter) */ @Override public T merge(final Archive<?> source, final String path, final Filter<ArchivePath> filter) throws IllegalArgumentException { Validate.notNull(path, "path must be specified"); return this.merge(source, ArchivePaths.create(path), filter); }
@Override public T addAsApplicationResource(String resourceName) throws IllegalArgumentException { Validate.notNull(resourceName, "ResourceName must be specified"); return addAsApplicationResource(new ClassLoaderAsset(resourceName), resourceName); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.api.container.EnterpriseContainer#addAsModule(java.lang.String) */ @Override public T addAsModule(String resourceName) { Validate.notNull(resourceName, "ResourceName must be specified"); ArchivePath location = new BasicPath(AssetUtil.getNameForClassloaderResource(resourceName)); return addAsModule(resourceName, location); }