1 16 17 package org.apache.commons.jelly.tags.core; 18 19 import org.apache.commons.jelly.JellyException; 20 import org.apache.commons.jelly.JellyTagException; 21 import org.apache.commons.jelly.MissingAttributeException; 22 import org.apache.commons.jelly.TagSupport; 23 import org.apache.commons.jelly.XMLOutput; 24 25 36 37 public class ImportTag extends TagSupport { 38 39 43 private String uri; 44 45 48 private boolean inherit; 49 50 54 private String file; 55 56 59 public ImportTag() { 60 } 61 62 63 71 public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException { 72 if (uri == null && file == null) { 73 throw new MissingAttributeException( "uri" ); 74 } 75 76 try { 77 if (uri != null) { 78 context.runScript(uri, output, true, isInherit() ); 81 } else { 82 context.runScript(new java.io.File (file), output, true, 83 isInherit()); 84 } 85 } 86 catch (JellyException e) { 87 throw new JellyTagException("could not import script",e); 88 } 89 } 90 91 94 97 public boolean isInherit() { 98 return inherit; 99 } 100 101 104 public void setInherit(boolean inherit) { 105 this.inherit = inherit; 106 } 107 108 111 public void setUri(String uri) { 112 this.uri = uri; 113 } 114 115 116 120 public void setFile(String file) { 121 this.file = file; 122 } 123 124 } 125 | Popular Tags |