public void deploy(DeploymentUnit unit) throws DeploymentException { if (accepts(unit) == false) return; if (hasSingleName()) createMetaData(unit, getName(), suffix); else createMetaData(unit, names, suffix); }
/** * Create some meta data. Calls createMetaData(unit, name, suffix, getDeploymentType().getName()). * * @param unit the deployment unit * @param name the name * @param suffix the suffix * @throws DeploymentException for any error */ protected void createMetaData(DeploymentUnit unit, String name, String suffix) throws DeploymentException { createMetaData(unit, name, suffix, getAttachmentKey()); }
T result = getMetaData(unit, key); if (result != null && allowsReparse() == false) return; if (hasSingleName()) result = parse(unit, getName(), result); else result = parse(unit, names, result); if (hasSingleName()) result = parse(unit, getName(), suffix, result); else result = parse(unit, names, suffix, result); unit.getTransientManagedObjects().addAttachment(key, result, getOutput());
/** * Create a new AbstractParsingDeployerWithOutput. * * @param output the type of output * @throws IllegalArgumentException for null output */ public AbstractParsingDeployerWithOutput(Class<T> output) { if (output == null) throw new IllegalArgumentException("Null output"); setOutput(output); // check for attachment key AttachmentKey ak = output.getAnnotation(AttachmentKey.class); String aks = ak != null ? ak.value() : output.getName(); setAttachmentKey(aks); }
/** * Create some meta data. Invokes parse(unit, name, suffix) if there is not already a * metadata * * @param unit the deployment unit * @param name the name * @param suffix the suffix * @param key the key into the managed objects * @throws DeploymentException for any error */ protected void createMetaData(DeploymentUnit unit, String name, String suffix, String key) throws DeploymentException { createMetaData(unit, Collections.singleton(name), suffix, key); }
/** * Get some meta data * * @param unit the deployment unit * @param key the key into the managed objects * @return the metadata or null if it doesn't exist */ protected T getMetaData(DeploymentUnit unit, String key) { return unit.getAttachment(key, getOutput()); }
/** * Create some meta data. Calls createMetaData(unit, name, suffix, getDeploymentType().getName()). * * @param unit the deployment unit * @param names the names * @param suffix the suffix * @throws DeploymentException for any error */ protected void createMetaData(DeploymentUnit unit, Set<String> names, String suffix) throws DeploymentException { createMetaData(unit, names, suffix, getAttachmentKey()); }