Google Data APIs Client Library (1.41.1)



com.google.gdata.data
Class ExtensionProfile

java.lang.Object
  extended by com.google.gdata.data.ExtensionProfile

public class ExtensionProfile
extends java.lang.Object

Specifies a complete extension profile for an extended GData schema. A profile is a set of allowed extensions for each type together with additional properties.

For example, Calendar might allow <gd:who> within <atom:feed>, and <gd:when>, <gd:who>, and <gd:where> within <atom:entry>.


Nested Class Summary
 class ExtensionProfile.ExtensionPointHandler
          Reads the ExtensionPoint XML format
 class ExtensionProfile.Handler
          Reads the ExtensionProfile XML format.
 
Constructor Summary
ExtensionProfile()
           
 
Method Summary
 void addDeclarations(Kind.Adaptor adaptor)
          Adds the extension declarations associated with an Kind.Adaptor instance, if the declaring class has not already added to this profile.
 boolean allowsArbitraryXml()
          Returns whether foreign XML elements will be preserved within any ExtensionPoint.
 void declare(java.lang.Class<? extends ExtensionPoint> extendedType, java.lang.Class<? extends Extension> extClass)
          Specifies that type extendedType can contain an extension described by extClass, as determined by ExtensionDescription.getDefaultDescription(Class).
 void declare(java.lang.Class<? extends ExtensionPoint> extendedType, ExtensionDescription extDescription)
          Specifies that type extendedType can contain an extension described by extDescription.
 void declareAdditionalNamespace(com.google.gdata.util.common.xml.XmlNamespace ns)
          Specifies additional top-level namespace declarations.
 void declareArbitraryXmlExtension(java.lang.Class<? extends ExtensionPoint> extendedType)
          Specifies that type extendedType can contain arbitrary XML.
 void declareArbitraryXmlExtension(java.lang.Class<? extends ExtensionPoint> extendedType, boolean mixedContent)
          Specifies that type extendedType can contain arbitrary XML.
 void declareEntryExtension(java.lang.Class<? extends Extension> extClass)
          Deprecated. Calls to this API should be replaced with calls to declare(Class,ExtensionDescription) where the first argument is a specific BaseEntry subtype. The BaseEntry class should only be used for mix-in types that might appear in multiple entry types. Its use for all entry declarations can result in conflicts when mutiple feed types are declared into a single extension profile, a common practice in client library service initialization for services that return multiple entry types.
 void declareEntryExtension(ExtensionDescription extDesc)
          Deprecated. Calls to this API should be replaced with calls to declare(Class,ExtensionDescription) where the first argument is a specific BaseEntry subtype. The BaseEntry class should only be used for mix-in types that might appear in multiple entry types. Its use for all entry declarations can result in conflicts when mutiple feed types are declared into a single extension profile, a common practice in client library service initialization for services that return multiple entry types.
 void declareEntryLinkProfile(ExtensionProfile profile)
          Specifies the type of entries nested within <gd:entryLink>.
 void declareFeedExtension(java.lang.Class<? extends Extension> extClass)
          Deprecated. Calls to this API should be replaced with calls to declare(Class,ExtensionDescription) where the first argument is a specific BaseFeed subtype. The BaseFeed class should only be used for mix-in types that might appear in multiple feed types. Its use for all feed declarations can result in conflicts when mutiple feed types are declared into a single extension profile, a common practice in client library service initialization for services that return multiple feed types.
 void declareFeedExtension(ExtensionDescription extDesc)
          Deprecated. Calls to this API should be replaced with calls to declare(Class,ExtensionDescription) where the first argument is a specific BaseFeed subtype. The BaseFeed class should only be used for mix-in types that might appear in multiple feed types. Its use for all feed declarations can result in conflicts when mutiple feed types are declared into a single extension profile, a common practice in client library service initialization for services that return multiple feed types.
 void declareFeedLinkProfile(ExtensionProfile profile)
          Specifies the type of feeds nested within <gd:feedLink>.
 void generateConfig(com.google.gdata.util.common.xml.XmlWriter w, ExtensionProfile extProfile)
          Generates XML in the external config format.
 ExtensionProfile getEntryLinkProfile()
          Retrieves the type of entries nested within <gd:entryLink>.
 ExtensionProfile getFeedLinkProfile()
          Retrieves the type of feeds nested within <gd:feedLink>.
 ExtensionManifest getManifest(java.lang.Class<?> extendedType)
          Retrieves an extension manifest for a specific class (or one of its superclasses) or null if not specified.
 java.util.Collection<com.google.gdata.util.common.xml.XmlNamespace> getNamespaceDecls()
          Retrieves a collection of all namespaces used by this profile.
 boolean isAutoExtending()
           
 boolean isDeclared(java.lang.Class<?> extendedType)
          Returns whether the given extended type has already been declared.
 void parseConfig(ExtensionProfile configProfile, java.lang.ClassLoader classLoader, java.io.InputStream stream)
          Parses XML in the ExtensionProfile format.
 void setArbitraryXml(boolean v)
          Configures the extension profile to specify whether any foreign XML elements found when parsing within an ExtensionPoint should be preserved.
 void setAutoExtending(boolean v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtensionProfile

public ExtensionProfile()
Method Detail

addDeclarations

public void addDeclarations(Kind.Adaptor adaptor)
Adds the extension declarations associated with an Kind.Adaptor instance, if the declaring class has not already added to this profile. The method is optimized to reduce the overhead of declaring the same adaptor type multiple times within the same profile.


declare

public void declare(java.lang.Class<? extends ExtensionPoint> extendedType,
                    ExtensionDescription extDescription)
Specifies that type extendedType can contain an extension described by extDescription.


declare

public void declare(java.lang.Class<? extends ExtensionPoint> extendedType,
                    java.lang.Class<? extends Extension> extClass)
Specifies that type extendedType can contain an extension described by extClass, as determined by ExtensionDescription.getDefaultDescription(Class).


declareFeedExtension

@Deprecated
public void declareFeedExtension(ExtensionDescription extDesc)
Deprecated. Calls to this API should be replaced with calls to declare(Class,ExtensionDescription) where the first argument is a specific BaseFeed subtype. The BaseFeed class should only be used for mix-in types that might appear in multiple feed types. Its use for all feed declarations can result in conflicts when mutiple feed types are declared into a single extension profile, a common practice in client library service initialization for services that return multiple feed types.

Declares that extDesc defines a feed extension.


declareFeedExtension

@Deprecated
public void declareFeedExtension(java.lang.Class<? extends Extension> extClass)
Deprecated. Calls to this API should be replaced with calls to declare(Class,ExtensionDescription) where the first argument is a specific BaseFeed subtype. The BaseFeed class should only be used for mix-in types that might appear in multiple feed types. Its use for all feed declarations can result in conflicts when mutiple feed types are declared into a single extension profile, a common practice in client library service initialization for services that return multiple feed types.

Declares that extClass defines a feed extension.


declareEntryExtension

@Deprecated
public void declareEntryExtension(ExtensionDescription extDesc)
Deprecated. Calls to this API should be replaced with calls to declare(Class,ExtensionDescription) where the first argument is a specific BaseEntry subtype. The BaseEntry class should only be used for mix-in types that might appear in multiple entry types. Its use for all entry declarations can result in conflicts when mutiple feed types are declared into a single extension profile, a common practice in client library service initialization for services that return multiple entry types.

Declares that extDesc defines an entry extension.


declareEntryExtension

@Deprecated
public void declareEntryExtension(java.lang.Class<? extends Extension> extClass)
Deprecated. Calls to this API should be replaced with calls to declare(Class,ExtensionDescription) where the first argument is a specific BaseEntry subtype. The BaseEntry class should only be used for mix-in types that might appear in multiple entry types. Its use for all entry declarations can result in conflicts when mutiple feed types are declared into a single extension profile, a common practice in client library service initialization for services that return multiple entry types.

Declares that extClass defines an entry extension.


declareArbitraryXmlExtension

public void declareArbitraryXmlExtension(java.lang.Class<? extends ExtensionPoint> extendedType)
Specifies that type extendedType can contain arbitrary XML.

Parameters:
extendedType - the type being declared for

declareArbitraryXmlExtension

public void declareArbitraryXmlExtension(java.lang.Class<? extends ExtensionPoint> extendedType,
                                         boolean mixedContent)
Specifies that type extendedType can contain arbitrary XML.

Parameters:
extendedType - the type being declared for
mixedContent - if true, permit mixed content in the arbitrary XML.

declareAdditionalNamespace

public void declareAdditionalNamespace(com.google.gdata.util.common.xml.XmlNamespace ns)
Specifies additional top-level namespace declarations.


declareFeedLinkProfile

public void declareFeedLinkProfile(ExtensionProfile profile)
Specifies the type of feeds nested within <gd:feedLink>.


getFeedLinkProfile

public ExtensionProfile getFeedLinkProfile()
Retrieves the type of feeds nested within <gd:feedLink>.


declareEntryLinkProfile

public void declareEntryLinkProfile(ExtensionProfile profile)
Specifies the type of entries nested within <gd:entryLink>.


getEntryLinkProfile

public ExtensionProfile getEntryLinkProfile()
Retrieves the type of entries nested within <gd:entryLink>.


getManifest

public ExtensionManifest getManifest(java.lang.Class<?> extendedType)
Retrieves an extension manifest for a specific class (or one of its superclasses) or null if not specified.


isDeclared

public boolean isDeclared(java.lang.Class<?> extendedType)
Returns whether the given extended type has already been declared. Note that unlike getManifest(Class), it does not check the super classes.


getNamespaceDecls

public java.util.Collection<com.google.gdata.util.common.xml.XmlNamespace> getNamespaceDecls()
Retrieves a collection of all namespaces used by this profile.


setAutoExtending

public void setAutoExtending(boolean v)

isAutoExtending

public boolean isAutoExtending()

setArbitraryXml

public void setArbitraryXml(boolean v)
Configures the extension profile to specify whether any foreign XML elements found when parsing within an ExtensionPoint should be preserved. If false, the presence of foreign XML will result in parsing errors. Arbitrary XML support is enabled by default in a newly created profile.

Parameters:
v - true to enable foreign XML preservation, false otherwise. #see ExtensionPoint.getXmlBlob()

allowsArbitraryXml

public boolean allowsArbitraryXml()
Returns whether foreign XML elements will be preserved within any ExtensionPoint.

Returns:
true if foreign XML elements are preserved, false otherwise.

parseConfig

public void parseConfig(ExtensionProfile configProfile,
                        java.lang.ClassLoader classLoader,
                        java.io.InputStream stream)
                 throws java.io.IOException,
                        ParseException
Parses XML in the ExtensionProfile format.

Parameters:
configProfile - Extension profile description configuration extensions.
classLoader - ClassLoader to load extension classes
stream - InputStream from which to read the description
Throws:
java.io.IOException
ParseException

generateConfig

public void generateConfig(com.google.gdata.util.common.xml.XmlWriter w,
                           ExtensionProfile extProfile)
                    throws java.io.IOException
Generates XML in the external config format.

Parameters:
w - Output writer.
extProfile - Extension profile.
Throws:
java.io.IOException