org.gcube.contentmanagement.gcubedocumentlibrary.views
Class BaseCollectionView<E extends GCubeElement,P extends Property>

java.lang.Object
  extended by org.gcube.contentmanagement.gcubedocumentlibrary.views.BaseCollectionView<E,P>
Type Parameters:
E - the type of GCubeElements characterised by the view.
P - the type of the properties of the GCubeElements characterised by the view.
All Implemented Interfaces:
CollectionView<E,P>
Direct Known Subclasses:
GenericView, SimpleView

public abstract class BaseCollectionView<E extends GCubeElement,P extends Property>
extends java.lang.Object
implements CollectionView<E,P>

Partial implementation of CollectionView that act as a wrapper around View proxies of the View Manager service.

Document views may be created bound to remote views, or else unbound (cf. isBound()).

Author:
Fabio Simeoni (University of Strathclyde)

Method Summary
 void addProperty(javax.xml.namespace.QName name, java.lang.String value)
          Adds a property.
 void addProperty(ViewProperty p)
          Adds a property to the view.
 long cardinality()
          Returns the cardinality of the view.
 java.lang.String collectionId()
          Returns the identifier of target collection of the view.
 void delete()
          Delete the view and un-publish it.
 java.lang.String description()
          Returns the description of the view.
 java.lang.String id()
          Returns the identifier of the view.
 View inner()
          Returns the untyped proxy of the view.
 boolean isBound()
          Returns true if this proxy is bound.
 java.util.Calendar lastUpdate()
          Returns the time in which the view was last updated.
 java.lang.String name()
          Returns the name of the view.
 java.util.Map<javax.xml.namespace.QName,ViewProperty> properties()
          Returns the generic properties of the view.
 void publish()
          Publishes this proxy as a remote view.
 void publishAndBroadcast()
          Publishes this proxy as a remote view and broadcasts the publication.
 ViewReader reader()
          Returns a Reader for retrieving the elements of the view.
 GCUBEScope scope()
          Returns the scope of the view.
 GCUBESecurityManager securityManager()
          Returns the SecurityManager to use view discovery and view-based access.
 void setCollectionId(java.lang.String id)
          Sets the identifier of the target collection.
 void setDescription(java.lang.String d)
          Sets the description of the view.
 void setId(java.lang.String id)
          Sets the identifier of the view.
 void setName(java.lang.String n)
          Sets the name of the view.
 java.lang.String toString()
          
 javax.xml.namespace.QName type()
          Returns the type of the view.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.gcube.contentmanagement.gcubedocumentlibrary.views.CollectionView
findSimilar, projection
 

Method Detail

isBound

public boolean isBound()
Returns true if this proxy is bound.

Specified by:
isBound in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
true if this proxy is bound.

id

public java.lang.String id()
Returns the identifier of the view.

Specified by:
id in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
the identifier.

setId

public void setId(java.lang.String id)
           throws java.lang.IllegalStateException
Sets the identifier of the view.

Parameters:
id - the identifier.
Throws:
java.lang.IllegalStateException - if the view is already bound to a remote view.

type

public javax.xml.namespace.QName type()
Returns the type of the view.

Specified by:
type in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
the type.

setCollectionId

public void setCollectionId(java.lang.String id)
Sets the identifier of the target collection.

Parameters:
id - the identifier.

collectionId

public java.lang.String collectionId()
Returns the identifier of target collection of the view.

Specified by:
collectionId in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
the identifier.

name

public java.lang.String name()
Returns the name of the view.

Specified by:
name in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
the name.

setName

public void setName(java.lang.String n)
Sets the name of the view.

Parameters:
n - the name.

description

public java.lang.String description()
Returns the description of the view.

Specified by:
description in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
the description.

setDescription

public void setDescription(java.lang.String d)
Sets the description of the view.

Parameters:
d - the description.

lastUpdate

public java.util.Calendar lastUpdate()
Returns the time in which the view was last updated.

Specified by:
lastUpdate in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
the last update time.

cardinality

public long cardinality()
Returns the cardinality of the view.

Specified by:
cardinality in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
the cardinality.

scope

public GCUBEScope scope()
Returns the scope of the view.

Specified by:
scope in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
the scope.

securityManager

public GCUBESecurityManager securityManager()
Returns the SecurityManager to use view discovery and view-based access.

Specified by:
securityManager in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
the manager.

publish

public void publish()
             throws java.lang.IllegalStateException,
                    GCUBEException,
                    java.lang.Exception
Publishes this proxy as a remote view.

Specified by:
publish in interface CollectionView<E extends GCubeElement,P extends Property>
Throws:
java.lang.IllegalStateException - if the view is bound.
GCUBEException - if the operation fails due to remote errors.
java.lang.Exception - if the operation fails due to local errors.

publishAndBroadcast

public void publishAndBroadcast()
                         throws java.lang.IllegalStateException,
                                GCUBEException,
                                java.lang.Exception
Publishes this proxy as a remote view and broadcasts the publication.

Specified by:
publishAndBroadcast in interface CollectionView<E extends GCubeElement,P extends Property>
Throws:
java.lang.IllegalStateException - if the view is bound.
GCUBEException - if the operation fails due to remote errors.
java.lang.Exception - if the operation fails due to local errors.

delete

public void delete()
            throws java.lang.Exception
Delete the view and un-publish it.

Specified by:
delete in interface CollectionView<E extends GCubeElement,P extends Property>
Throws:
java.lang.IllegalStateException - if the view is unbound.
java.lang.Exception - if the operation fails due to local errors.

reader

public ViewReader reader()
                  throws java.lang.IllegalStateException,
                         java.lang.Exception
Returns a Reader for retrieving the elements of the view.

Specified by:
reader in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
the Reader.
Throws:
java.lang.IllegalStateException - if the view is unbound.
java.lang.Exception - if the Reader could not be instantiated.

addProperty

public void addProperty(ViewProperty p)
Adds a property to the view.

Parameters:
p - the property.

addProperty

public void addProperty(javax.xml.namespace.QName name,
                        java.lang.String value)
Adds a property.

Parameters:
name - the property name.
value - the property value

properties

public java.util.Map<javax.xml.namespace.QName,ViewProperty> properties()
Returns the generic properties of the view.

Specified by:
properties in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
the properties.

inner

public View inner()
Returns the untyped proxy of the view.

Specified by:
inner in interface CollectionView<E extends GCubeElement,P extends Property>
Returns:
the untyped proxy.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object