*/
void deleteItem( ContentItem item) throws ItemNotFoundException, ContentAccessException;
+
+ /**
+ * Returns a item for the given selector. The type of the returned item depends on the
+ * selector.
+ *
+ * @param selector the item selector
+ * @return the content item that matches the given selector
+ * @throws ContentAccessException if an error occured while accessing the backend
+ * @throws IllegalArgumentException if the selector does not select a valid content item
+ */
+ ContentItem getItem(ItemSelector selector) throws ContentAccessException, IllegalArgumentException;
+
/**
* Returns the namespace for the given selected coordinates. The selector must specify a namespace. All other
* coordinates are ignored.
}
+ @Override
+ public ContentItem getItem( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException
+ {
+ return null;
+ }
+
@Override
public Namespace getNamespace( ItemSelector namespaceSelector ) throws ContentAccessException, IllegalArgumentException
{
}
+ @Override
+ public ContentItem getItem( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException
+ {
+ return null;
+ }
+
@Override
public Namespace getNamespace( ItemSelector namespaceSelector ) throws ContentAccessException, IllegalArgumentException
{
}
+ @Override
+ public ContentItem toItem( String path ) throws LayoutException
+ {
+ return null;
+ }
+
+ @Override
+ public ContentItem toItem( StorageAsset assetPath ) throws LayoutException
+ {
+ return null;
+ }
+
@Override
public void deleteVersion( VersionedReference reference ) throws ContentNotFoundException, ContentAccessException
{
}
+ @Override
+ public ContentItem getItem( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException
+ {
+ return null;
+ }
+
@Override
public Namespace getNamespace( ItemSelector namespaceSelector ) throws ContentAccessException, IllegalArgumentException
{
private PathParser defaultPathParser = new DefaultPathParser();
+ PathParser getPathParser() {
+ return defaultPathParser;
+ }
+
+
/**
*
}
}
+ @Override
+ public ContentItem getItem( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException
+ {
+ if (selector.hasVersion() && selector.hasArtifactId()) {
+ return getArtifact( selector );
+ } else if (selector.hasProjectId() && selector.hasVersion()) {
+ return getVersion( selector );
+ } else if (selector.hasProjectId()) {
+ return getProject( selector );
+ } else {
+ return getNamespace( selector );
+ }
+ }
+
@Override
public Namespace getNamespace( final ItemSelector namespaceSelector ) throws ContentAccessException, IllegalArgumentException
{
@Override
public ContentItem toItem( String path ) throws LayoutException
{
- return getItemFromPath( getAssetByPath( path ) );
+ ItemSelector selector = getPathParser( ).toItemSelector( path );
+ return getItem( selector );
}
@Override
public ContentItem toItem( StorageAsset assetPath ) throws LayoutException
{
- return getItemFromPath( assetPath );
+ return toItem( assetPath.getPath( ) );
}
/// ************* End of new generation interface ******************