oracle.toplink.tools.ejbjar
Class XMLManager
java.lang.Object
oracle.toplink.tools.ejbjar.XMLManager
- All Implemented Interfaces:
- EjbJarConstants
- public class XMLManager
- extends java.lang.Object
- implements EjbJarConstants
XMLManager manages
- Reading and writing of ejb-jar.xml
- Converting ejb-jar.xml to a DOM Document object
Fields inherited from interface oracle.toplink.tools.ejbjar.EjbJarConstants |
ABSTRACT_SCHEMA_NAME, ACKNOWLEDGE_MODE, APPLICATION_AUTH, ASSEMBLY_DESCRIPTOR, AUTO_ACKNOWLEDGE, BEAN_MANAGED, BOOLEAN_TYPE, BYTE_TYPE, CASCADE_DELETE, CMP_FIELD, CMP_VERSION, CMP_VERSION_1, CMP_VERSION_2, CMR_FIELD, CMR_FIELD_NAME, CMR_FIELD_TYPE, COLLECTION_TYPE, CONTAINER_AUTH, CONTAINER_MANAGED, CONTAINER_TRANSACTION, DESCRIPTION, DESTINATION_TYPE, DISPLAY_NAME, DOUBLE_TYPE, DUPS_OK_ACKNOWLEDGE, DURABLE, EJB_CLASS, EJB_CLIENT_JAR, EJB_JAR, EJB_LINK, EJB_LOCAL_REF, EJB_NAME, EJB_QL, EJB_REF, EJB_REF_NAME, EJB_REF_TYPE, EJB_RELATION, EJB_RELATION_NAME, EJB_RELATIONSHIP_ROLE, EJB_RELATIONSHIP_ROLE_NAME, ENTERPRISE_BEANS, ENTITY, ENTITY_REF_TYPE, ENV_ENTRY, ENV_ENTRY_NAME, ENV_ENTRY_TYPE, ENV_ENTRY_VALUE, EXCLUDE_LIST, FALSE_VALUE, FIELD_NAME, FLOAT_TYPE, HOME, INTEGER_TYPE, LARGE_ICON, LOCAL, LOCAL_HOME, LONG_TYPE, MANDATORY, MESSAGE_DRIVEN, MESSAGE_DRIVEN_DESTINATION, MESSAGE_SELECTOR, METHOD, METHOD_INTF, METHOD_NAME, METHOD_PARAM, METHOD_PARAMS, METHOD_PERMISSION, MULTIPLICITY, MULTIPLICITY_MANY, MULTIPLICITY_ONE, NEVER, NONDURABLE, NOT_SUPPORTED, PERSISTENCE_TYPE, PRIM_KEY_CLASS, PRIMKEY_FIELD, QUERY, QUERY_METHOD, QUEUE_TYPE, REENTRANT, RELATIONSHIP_ROLE_SOURCE, RELATIONSHIPS, REMOTE, REQUIRED, REQUIRES_NEW, RES_AUTH, RES_REF_NAME, RES_SHARING_SCOPE, RES_TYPE, RESOURCE_ENV_REF, RESOURCE_ENV_REF_NAME, RESOURCE_ENV_REF_TYPE, RESOURCE_REF, RESULT_TYPE_MAPPING, ROLE_LINK, ROLE_NAME, RUN_AS, SECURITY_IDENTITY, SECURITY_ROLE, SECURITY_ROLE_REF, SESSION, SESSION_REF_TYPE, SESSION_TYPE, SET_TYPE, SHAREABLE_SCOPE, SHORT_TYPE, SMALL_ICON, STATEFUL_TYPE, STATELESS_TYPE, STRING_TYPE, SUBSCRIPTION_DURABILITY, SUPPORTS, TOPIC_TYPE, TRANS_ATTRIBUTE, TRANSACTION_TYPE, TRUE_VALUE, UNCHECKED, UNSHAREABLE_SCOPE, USE_CALLER_IDENTITY |
Method Summary |
static void |
copy(java.io.InputStream in, java.io.OutputStream out)
Copies the given inputStream to an outputStream |
static void |
createDirectoryStructure(java.io.File file)
|
static void |
createEjbJarFile(java.lang.String fileLocation)
|
static void |
createEjbJarXmlFile(java.lang.String fileLocation)
|
static java.io.File |
createFile(java.lang.String fileLocation)
|
static java.lang.StringBuffer |
generateXML(org.w3c.dom.Node node, java.lang.String indent)
|
static java.util.jar.JarEntry |
getEjbJarXmlEntry(java.util.jar.JarFile ejbJarFile)
|
static java.lang.StringBuffer |
getXML(EjbJar ejbJar, boolean isEjb2_0)
|
static void |
move(java.io.File src, java.io.File dst, boolean overwrite)
Moves a given file to a given destination, and overwrites it if necessary. |
static org.w3c.dom.Document |
readEjbXmlFile(EjbJarXMLDocument ejbDocument, java.lang.String fileName)
Creates a DOM Document from a either a) a Jar file that contains ejb-jar.xml OR b)from an ejb-jar.xml file at a given location |
static void |
writeEjbXmlFile(EjbJarXMLDocument ejbJarXmlDocument, java.lang.String outFile, boolean isEjb_2_0)
|
static void |
writeEjbXmlFileFromEjbJar(EjbJar ejbJar, java.lang.String fileName, boolean isEjb_2_0)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EJB_JAR_FILE_NAME
public static final java.lang.String EJB_JAR_FILE_NAME
-
- See Also:
- Constant Field Values
EJB_JAR_2_0_DTD_FILE_NAME
public static java.lang.String EJB_JAR_2_0_DTD_FILE_NAME
EJB_JAR_1_1_DTD_FILE_NAME
public static java.lang.String EJB_JAR_1_1_DTD_FILE_NAME
EJB_JAR_DTD_LOCAL_DIR_PATH
public static java.lang.String EJB_JAR_DTD_LOCAL_DIR_PATH
EJB_JAR_DTD_2_0_LOCAL_RESOURCE
public static java.lang.String EJB_JAR_DTD_2_0_LOCAL_RESOURCE
EJB_JAR_DOC_NAME
public static final java.lang.String EJB_JAR_DOC_NAME
-
- See Also:
- Constant Field Values
EJB_JAR_2_0_DOCTYPE_DESC
public static final java.lang.String EJB_JAR_2_0_DOCTYPE_DESC
-
- See Also:
- Constant Field Values
EJB_JAR_1_1_DOCTYPE_DESC
public static final java.lang.String EJB_JAR_1_1_DOCTYPE_DESC
-
- See Also:
- Constant Field Values
EJB_JAR_2_0_DTD_URL
public static final java.lang.String EJB_JAR_2_0_DTD_URL
-
- See Also:
- Constant Field Values
EJB_JAR_1_1_DTD_URL
public static final java.lang.String EJB_JAR_1_1_DTD_URL
-
- See Also:
- Constant Field Values
EJB_JAR_XML_ENTRY_NAME
public static final java.lang.String EJB_JAR_XML_ENTRY_NAME
-
- See Also:
- Constant Field Values
XMLManager
public XMLManager()
readEjbXmlFile
public static org.w3c.dom.Document readEjbXmlFile(EjbJarXMLDocument ejbDocument,
java.lang.String fileName)
throws java.io.FileNotFoundException,
java.lang.NullPointerException,
EJBJarXMLException
- Creates a DOM Document from a either a) a Jar file that contains ejb-jar.xml OR b)from an ejb-jar.xml file at a given location
-
- Returns:
- Document the DOM object
- Throws:
java.io.FileNotFoundException
java.lang.NullPointerException
EJBJarXMLException
writeEjbXmlFile
public static void writeEjbXmlFile(EjbJarXMLDocument ejbJarXmlDocument,
java.lang.String outFile,
boolean isEjb_2_0)
throws java.io.FileNotFoundException,
java.io.IOException,
javax.xml.parsers.ParserConfigurationException
-
- Parameters:
outFile
- is the full file name or directory where the ejb-jar.xml file is written If the output file is the same as the last read one then the last modified time of ejbJarXMLDocument is updated after the ouput file was written.
- Throws:
java.io.FileNotFoundException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
writeEjbXmlFileFromEjbJar
public static void writeEjbXmlFileFromEjbJar(EjbJar ejbJar,
java.lang.String fileName,
boolean isEjb_2_0)
throws java.io.FileNotFoundException,
java.io.IOException,
javax.xml.parsers.ParserConfigurationException
-
- Parameters:
ejbJar
- that contains the ejb-jar.xml DOM
fileName
- which could either be a .jar or a .xml. If the fileName is .jar then the function tries to update the .jar file. If the fileName is .xml then the function will create a .xml file. If the .xml already exists, the function will attempt to overwrite it.
- Throws:
java.io.FileNotFoundException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
getEjbJarXmlEntry
public static java.util.jar.JarEntry getEjbJarXmlEntry(java.util.jar.JarFile ejbJarFile)
getXML
public static java.lang.StringBuffer getXML(EjbJar ejbJar,
boolean isEjb2_0)
throws javax.xml.parsers.ParserConfigurationException
-
- Parameters:
ejbJar
- the ejbjar object
- Returns:
- StringBuffer the buffer containing a String representation (ejb-jar.xml contents) of the EjbJar object Note that this returns PI and DOCTYPE hardoded in this method. Compare this method with generateXML() which does not return PI and DOCTYPE.
- Throws:
javax.xml.parsers.ParserConfigurationException
createDirectoryStructure
public static void createDirectoryStructure(java.io.File file)
createEjbJarFile
public static void createEjbJarFile(java.lang.String fileLocation)
throws java.io.IOException
-
- Throws:
java.io.IOException
createEjbJarXmlFile
public static void createEjbJarXmlFile(java.lang.String fileLocation)
throws java.io.IOException
-
- Throws:
java.io.IOException
createFile
public static java.io.File createFile(java.lang.String fileLocation)
throws java.io.IOException
-
- Throws:
java.io.IOException
generateXML
public static java.lang.StringBuffer generateXML(org.w3c.dom.Node node,
java.lang.String indent)
-
- Parameters:
indent
- the indenting string
- Returns:
- StringBuffer the buffer containing a String representation (ejb-jar.xml contents) of the DOM Document object Note that this DOES NOT return PI and DOCTYPE Compare this method with getXML() which returns PI and DOCTYPE (hardcoded there).
move
public static void move(java.io.File src,
java.io.File dst,
boolean overwrite)
throws java.io.IOException
- Moves a given file to a given destination, and overwrites it if necessary.
-
- Parameters:
src
- the source fileName
overwrite
- the overwrite flag
- Throws:
java.io.IOException
copy
public static void copy(java.io.InputStream in,
java.io.OutputStream out)
throws java.io.IOException
- Copies the given inputStream to an outputStream
-
- Parameters:
in
- the inputStream
out
- the outputStream
- Throws:
java.io.IOException