public class OfflineDBUtil
extends java.lang.Object
implements oracle.jdevimpl.offlinedb.OfflineDBConstants
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DOT |
static java.lang.String |
ILLEGAL_FILENAME_CHARS
The characters which are illegal in windows file names.
|
BUILT_IN_SCHEMA, DBLINK_REFERENCED_DB, GENERATE_TARGET_CONNECTION, GENERATE_TARGET_ID, GENERATE_TARGET_NAME, GENERATE_TARGET_SCHEMA, IMPORT_SOURCE_CONNECTION, IMPORT_SOURCE_ID, IMPORT_SOURCE_NAME, IMPORT_SOURCE_SCHEMA, NAMESPACE_10_1_3, NAMESPACE_11_1_1, NAMESPACE_11_1_2, NAMESPACE_12_1_1, NAMESPACE_CURRENT, OFFLINE_ONLY
Modifier and Type | Method and Description |
---|---|
static void |
buildView(SQLQueryOwner sqo,
DBObjectProvider pro)
Attemps to build the given view declaratively using the given provider.
|
static void |
buildView(SQLQueryOwner sqo,
DBObjectProvider pro,
java.util.Collection<SystemObject> objs) |
static void |
canCreateFile(SystemObject obj,
OfflineDBObjectProvider pro)
Checks that the user can create the default file URL for the given
object.
|
static void |
canCreateURL(java.net.URL url,
DBObject obj)
Checks that create is available on the given object url.
|
static void |
canUpdateFile(DBObject obj,
OfflineDBObjectProvider pro)
Checks that update is available on the given object.
|
static void |
canUpdateFile(OfflineDBObjectNode node,
OfflineDBObjectProvider pro)
Checks that update is available on the given object.
|
static void |
canUpdateURL(java.net.URL url,
DBObject obj)
Checks that update is available on the given object url.
|
static void |
checkURLIsWritable(java.net.URL url,
DBObject obj,
boolean doit)
Checks that the URL is, or at least can be made, writable.
|
static java.net.URL |
createObjectURL(OfflineDBObjectProvider pro,
Schema schema,
java.lang.String type,
java.lang.String name)
Creates a URL for the given object name, type, schema under the given
provider url (can be the url for the provider file, or directory the
provider is in.
|
static java.net.URL |
createObjectURL(OfflineDBObjectProvider pro,
SystemObject obj)
Creates a URL for the given object in the given project.
|
static java.net.URL |
createObjectURL(OfflineDBObjectProvider pro,
java.net.URL dir,
java.lang.String type,
java.lang.String name)
Creates a URL for the given object name and type in the given directory.
|
static void |
ensureTechScope(Project proj)
Ensures that the database technology scope is added to the given project.
|
static java.net.URL |
findExistingProviderURL(Context c)
Finds a provider URL for the given Context.
|
static java.net.URL |
findExistingProviderURL(Element e)
Finds a provider URL for the given element.
|
static java.net.URL |
findExistingProviderURL(java.net.URL url)
Finds a provider URL above the given url.
|
static java.net.URL |
findExistingSchemaURL(Element e)
Returns a URL for an existing schema file for the given element.
|
static java.util.Collection<java.net.URL> |
getObjectURLs(OfflineDBObjectProvider pro,
Schema schema,
java.lang.String type,
java.lang.String name)
Gets any URLs that exist on the filesystem that could hold an object with
the given details.
|
static java.util.Collection<java.net.URL> |
getObjectURLs(OfflineDBObjectProvider pro,
java.lang.String schemaName,
java.lang.String type,
java.lang.String name)
Gets any URLs that exist on the filesystem that could hold an object with
the given details.
|
static java.net.URL |
getProviderDirURL(java.net.URL baseURL,
java.lang.String providerName)
Creates a URL for the directory for the given provider name under the
given base path (assumed part of a dbpath).
|
static java.net.URL |
getProviderURL(java.net.URL objectURL)
Returns the URL for the provider "parent" of the given object URL.
|
static java.net.URL |
getProviderURL(java.net.URL baseDir,
java.lang.String providerName)
Creates a URL for the a provider underneath the given base directory.
|
static Schema |
getSchema(Context c)
Returns the Schema for the given Ide Context.
|
static Schema |
getSchema(Element e)
Returns the Schema for the given Ide Element.
|
static java.net.URL |
getSchemaDirURL(java.net.URL baseURL,
java.lang.String schemaName)
Returns the URL for the directory for the given schema name under the given
base path (assumed part of a dbpath).
|
static java.net.URL |
getSchemaURL(java.net.URL objectURL)
Returns a URL for the schema file representing the schema for the object
at the given object URL.
|
static java.net.URL |
getSchemaURL(java.net.URL baseURL,
Schema schema)
Returns the URL for the given schema underneath the given base URL.
|
static java.net.URL |
getSchemaURL(java.net.URL baseURL,
java.lang.String schemaName)
Returns the URL for the given schema underneath the given base URL.
|
static java.lang.String |
getShortLabel(java.net.URL url)
Returns the DBObject short label (filename without extension) for the
given URL.
|
static boolean |
hasObjects(OfflineDBObjectProvider provider)
Method to query if the given provider has any schema objects in its content
set.
|
static boolean |
isEmpty(OfflineDBObjectProvider provider)
Method to query if the given provider has any schema objects or schemas in
its content set.
|
static boolean |
isOfflineContentSet(RelativeDirectoryContextFolder f)
Returns true if the given RelativeDirectoryContextFolder is part of the
offline database heirachy for a project.
|
static boolean |
isOfflineElement(Element e)
Returns true if the given element is offline -
either a provider, or a schema folder or a schema object node.
|
static boolean |
isProviderFolder(Element e)
Returns true if the given element is a folder representing a provider
directory, or is a provider node.
|
static boolean |
isSchemaFolder(Element e)
Returns true if the given element is a folder representing a schema
directory, or is a schema node.
|
static boolean |
isValidFilename(java.lang.String name)
Tests whether the given filename contains any of the
ILLEGAL_FILENAME_CHARS.
|
static java.util.Collection<DBObject> |
loadAllObjects(OfflineDBObjectProvider pro)
Loads all the DBObjects in a given provider and returns them in a List.
|
static java.lang.String |
removeIllegalFileChars(java.lang.String name)
Removes characters from the given name that are illegal for use on any
filesystem (windows mostly as it's the most restrictive.
|
public static final java.lang.String DOT
public static final java.lang.String ILLEGAL_FILENAME_CHARS
public static void ensureTechScope(Project proj)
public static java.net.URL getProviderURL(java.net.URL objectURL)
For example /some/path/DATABASE1/MYSCHEMA/EMP.table
will
return /some/path/DATABASE1/DATABASE1.offlinedb
.
public static java.net.URL findExistingProviderURL(Context c)
public static java.net.URL findExistingProviderURL(Element e)
public static java.net.URL findExistingProviderURL(java.net.URL url)
This method creates test URLs to locate the .offlinedb file and can cause the URLFileSystem to log errors if the protocol for the URL does not support that.
public static java.net.URL getProviderURL(java.net.URL baseDir, java.lang.String providerName)
E.g. baseURL /some/path/
and providerName pro1
will return /some/path/pro1/pro1.offlinedb
.
public static java.net.URL getProviderDirURL(java.net.URL baseURL, java.lang.String providerName)
E.g. baseURL /some/path/
and providerName pro1
will return directory URL /some/path/pro1/
.
public static java.net.URL getSchemaURL(java.net.URL baseURL, Schema schema)
public static java.net.URL getSchemaURL(java.net.URL baseURL, java.lang.String schemaName)
public static java.net.URL getSchemaDirURL(java.net.URL baseURL, java.lang.String schemaName)
public static java.net.URL findExistingSchemaURL(Element e)
public static java.net.URL getSchemaURL(java.net.URL objectURL)
public static java.net.URL createObjectURL(OfflineDBObjectProvider pro, SystemObject obj)
public static java.net.URL createObjectURL(OfflineDBObjectProvider pro, Schema schema, java.lang.String type, java.lang.String name)
public static java.util.Collection<java.net.URL> getObjectURLs(OfflineDBObjectProvider pro, Schema schema, java.lang.String type, java.lang.String name)
public static java.util.Collection<java.net.URL> getObjectURLs(OfflineDBObjectProvider pro, java.lang.String schemaName, java.lang.String type, java.lang.String name)
public static java.lang.String getShortLabel(java.net.URL url)
public static java.lang.String removeIllegalFileChars(java.lang.String name)
public static boolean isValidFilename(java.lang.String name)
public static java.net.URL createObjectURL(OfflineDBObjectProvider pro, java.net.URL dir, java.lang.String type, java.lang.String name)
public static boolean isOfflineContentSet(RelativeDirectoryContextFolder f)
public static boolean isSchemaFolder(Element e)
public static boolean isProviderFolder(Element e)
public static boolean isOfflineElement(Element e)
public static Schema getSchema(Context c)
public static Schema getSchema(Element e)
public static java.util.Collection<DBObject> loadAllObjects(OfflineDBObjectProvider pro)
public static void buildView(SQLQueryOwner sqo, DBObjectProvider pro)
public static void buildView(SQLQueryOwner sqo, DBObjectProvider pro, java.util.Collection<SystemObject> objs)
public static void canCreateFile(SystemObject obj, OfflineDBObjectProvider pro) throws DBException
the
- object to testpro
- the containing providerDBException
- if the url is read only and not under version
control.public static void canCreateURL(java.net.URL url, DBObject obj) throws DBException
url
- the object url to test - must not be null.obj
- the object the url is for (can be null).DBException
- if the url is read only and not under version
control.public static void canUpdateURL(java.net.URL url, DBObject obj) throws DBException
url
- the object url to test - must not be null.obj
- the object the url is for (can be null).DBException
- if the url is read only and not under version
control.public static void checkURLIsWritable(java.net.URL url, DBObject obj, boolean doit) throws DBException
url
- the url to checkobj
- the DBObject associated with the url (for any
DBException that will be thrown)doit
- whether to make the url writable if it isn'tDBException
- if the url is not writeable and cannot
be made writable.public static void canUpdateFile(DBObject obj, OfflineDBObjectProvider pro) throws DBException
obj
- the object to testpro
- the offline provider the object is inDBException
- if i) the url for the object is read only and not under
version control or ii) if there are duplicate objects on the database path
for the provider and the given object isn't the first entry.public static void canUpdateFile(OfflineDBObjectNode node, OfflineDBObjectProvider pro) throws DBException
node
- the node to checkpro
- the offline provider the object is inDBException
- if i) the url for the object is read only and not under
version control or ii) if there are duplicate objects on the database path
for the provider and the given object isn't the first entry.public static boolean hasObjects(OfflineDBObjectProvider provider)
Note this is not the same as !OfflineDBUtil.isEmpty(provider)
isEmpty(oracle.jdeveloper.offlinedb.OfflineDBObjectProvider)
public static boolean isEmpty(OfflineDBObjectProvider provider)
Note this is not the same as !OfflineDBUtil.hasObjects(provider)
hasObjects(oracle.jdeveloper.offlinedb.OfflineDBObjectProvider)