Oracle Fusion Middleware Java API Reference for Oracle ADF Share
11g Release 1 (11.1.1.6.0)

E10686-07

oracle.adf.share.services
Class DefaultDescriptorContext

java.lang.Object
  extended by oracle.adf.share.services.DefaultDescriptorContext
All Implemented Interfaces:
DescriptorContext

public class DefaultDescriptorContext
extends java.lang.Object
implements DescriptorContext

These are created and managed by the naming Context, and should NOT be created by application code.

See Also:
DescriptorFactory, test.oracle.adf.share.services.DescriptorContextTests

Constructor Summary
DefaultDescriptorContext(javax.naming.Context namingContext)
          The primary constructor called by the factory creation code path.
DefaultDescriptorContext(java.net.URL jarURL)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getJarFileName()
           
 java.lang.String getJarName()
           
 java.net.URL getJarURL()
           
 java.util.jar.Manifest getManifest()
           
 javax.naming.Context getNamingContext()
           
 java.lang.String getString(java.util.Collection<java.lang.String> descriptorNames, java.lang.String suffix)
           
 java.lang.String getString(java.lang.String[] descriptorNames, java.lang.String suffix)
           
 int hashCode()
           
 boolean isDescriptorVisible(java.util.Collection<java.lang.String> names, boolean checkParents)
           
 boolean isDescriptorVisible(java.lang.String[] names, boolean checkParents)
          See overloaded method.
 boolean isPackageVisible(java.lang.String packageName, boolean checkParents)
          Scan all manifest relevant packages (including the main one) and bundles to determine if any rule causes the package to be made explicitly visible or not.
 boolean jarExists()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultDescriptorContext

public DefaultDescriptorContext(java.net.URL jarURL)
Parameters:
jarURL - May be null if the class loader context should be used, but this is actually only used for unit tests.
Throws:
java.lang.RuntimeException

DefaultDescriptorContext

public DefaultDescriptorContext(javax.naming.Context namingContext)
The primary constructor called by the factory creation code path.

Parameters:
namingContext -
Method Detail

getNamingContext

public javax.naming.Context getNamingContext()
Specified by:
getNamingContext in interface DescriptorContext
Returns:
the associated jndi naming context object.

getJarURL

public java.net.URL getJarURL()
Specified by:
getJarURL in interface DescriptorContext
Returns:
the jar URL or null if this context is not associated with a jar (i.e. the 'root' or classloader context).

getJarName

public java.lang.String getJarName()
                            throws java.io.IOException
Specified by:
getJarName in interface DescriptorContext
Returns:
The most appropriate display name for the jar in context. The following algorithm is used (in this order):
  1. If the jar has Bundle-Classes in the main manifest attributes, they will be checked (in declaration order) for the ".name" key.
  2. The main manifest "Implementation-Title" attribute is used.
  3. The main manifest "Specification-Title" attribute is used.
  4. The "base name" of the jar is returned (i.e. no path names).
Throws:
java.io.IOException

getJarFileName

public java.lang.String getJarFileName()
                                throws java.io.IOException
Specified by:
getJarFileName in interface DescriptorContext
Returns:
The name of the jar file excluding the path.
Throws:
java.io.IOException

getString

public java.lang.String getString(java.lang.String[] descriptorNames,
                                  java.lang.String suffix)
                           throws java.io.IOException
Specified by:
getString in interface DescriptorContext
Returns:
Throws:
java.io.IOException - if jar access fails (getLastModified, getManifest, etc)
See Also:
getString(Collection descriptorNames, String suffix)

getString

public java.lang.String getString(java.util.Collection<java.lang.String> descriptorNames,
                                  java.lang.String suffix)
                           throws java.io.IOException
Specified by:
getString in interface DescriptorContext
Parameters:
descriptorNames - components of the bundle key to build
suffix - see oracle.adf.share.services.DescriptorConstants.ALL_SUFFIXES
Returns:
the first non-null matching key value in the Bundle-Classes list.

The key will likely have 2 parts:

"ADF_DataControl", "model/AppModule", and the suffix part (ex: "name")

Throws:
java.io.IOException - if jar access fails (getLastModified, getManifest, etc)

isDescriptorVisible

public boolean isDescriptorVisible(java.lang.String[] names,
                                   boolean checkParents)
                            throws java.io.IOException
Description copied from interface: DescriptorContext
See overloaded method.

Specified by:
isDescriptorVisible in interface DescriptorContext
Returns:
Throws:
java.io.IOException

isDescriptorVisible

public boolean isDescriptorVisible(java.util.Collection<java.lang.String> names,
                                   boolean checkParents)
                            throws java.io.IOException
Specified by:
isDescriptorVisible in interface DescriptorContext
Returns:
Throws:
java.io.IOException

isPackageVisible

public boolean isPackageVisible(java.lang.String packageName,
                                boolean checkParents)
                         throws java.io.IOException
Description copied from interface: DescriptorContext
Scan all manifest relevant packages (including the main one) and bundles to determine if any rule causes the package to be made explicitly visible or not. The default is visible if no matching specifications found.

Specified by:
isPackageVisible in interface DescriptorContext
Parameters:
packageName - null or empty string for the main jar manifest attribute (and resource bundles). Otherwise, the packageName to check for "Design-Visibility" in the jar manifest. If the value has multiple elements (separated by either '/' or '.') then the following rules apply:
  1. 1. If the exact package name is declared in the manifest then it's used
  2. 2. If any parent (in reverse order) has a declared value then it's used
checkParents - Passing false will disable the inheritance checking described here and just check the currently requested package.
Returns:
true if there is no declaration of visibility at all for either the packageName parameter or any of it's parents. If there is an explicit declaration then that value is returned (using the rules in packageName).
Throws:
java.io.IOException

getManifest

public java.util.jar.Manifest getManifest()
                                   throws java.io.IOException
Specified by:
getManifest in interface DescriptorContext
Returns:
the manifest of the current jar file in context. May be null if the jar has no manifest.
Throws:
java.io.IOException

jarExists

public boolean jarExists()
Specified by:
jarExists in interface DescriptorContext
Returns:
true if there is a jar associated, and it's know to exist.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Oracle Fusion Middleware Java API Reference for Oracle ADF Share
11g Release 1 (11.1.1.6.0)

E10686-07

Copyright © 1997, 2011, Oracle. All rights reserved.