@@ -58,6 +58,18 @@ public interface ManagedRepositoryContent extends RepositoryContent | |||
*/ | |||
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. |
@@ -81,6 +81,12 @@ public class ManagedRepositoryContentMock implements ManagedRepositoryContent | |||
} | |||
@Override | |||
public ContentItem getItem( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public Namespace getNamespace( ItemSelector namespaceSelector ) throws ContentAccessException, IllegalArgumentException | |||
{ |
@@ -97,6 +97,12 @@ public class ManagedRepositoryContentMock implements ManagedRepositoryContent | |||
} | |||
@Override | |||
public ContentItem getItem( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public Namespace getNamespace( ItemSelector namespaceSelector ) throws ContentAccessException, IllegalArgumentException | |||
{ | |||
@@ -181,6 +187,18 @@ public class ManagedRepositoryContentMock implements ManagedRepositoryContent | |||
} | |||
@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 | |||
{ |
@@ -101,6 +101,12 @@ public class ManagedRepositoryContentMock implements ManagedRepositoryContent | |||
} | |||
@Override | |||
public ContentItem getItem( ItemSelector selector ) throws ContentAccessException, IllegalArgumentException | |||
{ | |||
return null; | |||
} | |||
@Override | |||
public Namespace getNamespace( ItemSelector namespaceSelector ) throws ContentAccessException, IllegalArgumentException | |||
{ |
@@ -58,6 +58,11 @@ public abstract class AbstractDefaultRepositoryContent implements RepositoryCont | |||
private PathParser defaultPathParser = new DefaultPathParser(); | |||
PathParser getPathParser() { | |||
return defaultPathParser; | |||
} | |||
/** | |||
* |
@@ -199,6 +199,20 @@ public class ManagedDefaultRepositoryContent | |||
} | |||
} | |||
@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 | |||
{ | |||
@@ -620,13 +634,14 @@ public class ManagedDefaultRepositoryContent | |||
@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 ****************** |