Class MetadataBuilder<T extends MetadataInterface,J extends com.sas.metadata.remote.PrimaryType,B extends MetadataBuilder<T,J,B>>
java.lang.Object
com.sas.services.information.metadata.MetadataBuilder<T,J,B>
- Type Parameters:
T- Information service object class created by this builderJ- Metadata object class used to represent this objectB- Concrete builder class
public abstract class MetadataBuilder<T extends MetadataInterface,J extends com.sas.metadata.remote.PrimaryType,B extends MetadataBuilder<T,J,B>>
extends Object
Abstract base class for a metadata object builder. The object builder pattern supports defining
metadata objects using a simple sequence of methods specifying attributes. See
LASRServerUtil for an example of a concrete
builder class.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Jprotected Tprotected Stringprotected OMIServerprotected Stringprotected Map<String, String> protected static final Stringprotected com.sas.metadata.remote.Prototypeprotected Stringprotected Map<String, com.sas.metadata.remote.Property> protected RepositoryInterfaceprotected Stringprotected UserContextInterface -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMetadataBuilder(Class<J> metadataType, String publicType, double usageVersion) -
Method Summary
Modifier and TypeMethodDescriptionprotected TBuild the object.protected final voidprotected final <M extends com.sas.metadata.remote.Root>
McreateMetadata(String name, Class<M> type) protected voidprotected final com.sas.metadata.remote.PropertycreateProperty(String name, String propertyName, String delimiter, String value) protected final com.sas.metadata.remote.PropertycreatePropertyFromPrototype(com.sas.metadata.remote.Property prototype, String value) desc(String desc) Defines descriptive text.extendedAttribute(String name, String value, String description) Defines an extended attribute.protected final <M extends com.sas.metadata.remote.Root>
MfindMetadata(String search, Class<M> type) protected final <M extends com.sas.metadata.remote.Root>
MfindMetadataByName(String name, Class<M> type) keyword(String keyword) Defines a keyword.protected voidname(String name) Defines object name.option(String optionName) Defines a valueless option on the object.option(String optionName, String optionValue) Defines an option on the object.voidvalidate(UserContextInterface user) Validates the builder state without building the object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
prototypeName
protected String prototypeName -
prototype
protected com.sas.metadata.remote.Prototype prototype -
prototypeProperties
protected Map<String,com.sas.metadata.remote.Property> prototypeProperties -
user
-
metadataServer
-
repository
-
repositoryName
protected String repositoryName -
name
protected String name -
desc
protected String desc -
options
protected Map<String,String> options -
OTHER_OPTIONS_PROPERTY
protected static final String OTHER_OPTIONS_PROPERTY- See Also:
-
built
-
builtSmartObject
-
-
Constructor Details
-
MetadataBuilder
-
-
Method Details
-
name
Defines object name.- Parameters:
name- object name- Returns:
- builder
- Throws:
IllegalArgumentException- for invalid namesNullPointerException
-
desc
Defines descriptive text.- Parameters:
desc- description- Returns:
- builder
- Throws:
NullPointerException- if desc is null
-
keyword
Defines a keyword. May be called multiple times to define multiple keywords.- Parameters:
keyword- keyword- Returns:
- builder
-
option
Defines a valueless option on the object. May be called multiple times to define multiple options- Parameters:
optionName- option name- Returns:
- builder
-
option
Defines an option on the object. May be called multiple times to define multiple options- Parameters:
optionName- option nameoptionValue- option value- Returns:
- builder
-
extendedAttribute
Defines an extended attribute. May be called multiple times to define multiple attributes.- Parameters:
name- attribute namevalue- attribute valuedescription- optional attribute description- Returns:
- builder
- Throws:
NullPointerException- if name or value is null
-
validate
public void validate(UserContextInterface user) throws IllegalArgumentException, IllegalStateException, ItemAlreadyExistsException, ServiceException Validates the builder state without building the object. Throws an exception if the builder is not ready to create a valid object. This method is called by #build(UserContextInterface) before attempting to create the object. This method is typically overridden by any concrete builder class.- Parameters:
user- user context- Throws:
IllegalArgumentException- illegal value was specified to the builderIllegalStateException- the builder has conflicting or missing definitionsItemAlreadyExistsException- an object with the same name or path already existsServiceException
-
buildInternal
protected T buildInternal(UserContextInterface user) throws IllegalArgumentException, IllegalStateException, ItemAlreadyExistsException, ServiceException Build the object.- Parameters:
user- user context- Returns:
- the new object
- Throws:
IllegalArgumentException- illegal value was specified to the builderIllegalStateException- the builder has conflicting or missing definitionsItemAlreadyExistsException- an object with the same name or path already existsServiceException
-
buildSetup
- Throws:
ServiceException
-
createObject
protected void createObject() throws RemoteException, com.sas.metadata.remote.MdException, ServiceException- Throws:
RemoteExceptioncom.sas.metadata.remote.MdExceptionServiceException
-
loadPrototypeProperties
protected void loadPrototypeProperties() throws RemoteException, com.sas.metadata.remote.MdException- Throws:
RemoteExceptioncom.sas.metadata.remote.MdException
-
createMetadata
protected final <M extends com.sas.metadata.remote.Root> M createMetadata(String name, Class<M> type) throws RemoteException - Throws:
RemoteException
-
createProperty
protected final com.sas.metadata.remote.Property createProperty(String name, String propertyName, String delimiter, String value) throws RemoteException - Throws:
RemoteException
-
createPropertyFromPrototype
protected final com.sas.metadata.remote.Property createPropertyFromPrototype(com.sas.metadata.remote.Property prototype, String value) throws RemoteException - Throws:
RemoteException
-
findMetadataByName
protected final <M extends com.sas.metadata.remote.Root> M findMetadataByName(String name, Class<M> type) throws RemoteException, com.sas.metadata.remote.MdException - Throws:
RemoteExceptioncom.sas.metadata.remote.MdException
-
findMetadata
protected final <M extends com.sas.metadata.remote.Root> M findMetadata(String search, Class<M> type) throws RemoteException, com.sas.metadata.remote.MdException - Throws:
RemoteExceptioncom.sas.metadata.remote.MdException
-