Search in sources :

Example 1 with StoredObject

use of net.sf.webdav.StoredObject in project indy by Commonjava.

the class ArtifactStoreSubStore method getStoredObject.

@Override
public StoredObject getStoredObject(final ITransaction transaction, final String uri) throws WebdavException {
    final StoredObject so = new StoredObject();
    final StoreURIMatcher matcher = new StoreURIMatcher(uri);
    if (matcher.hasStorePath()) {
        final Transfer item = getTransfer(matcher);
        if (item == null) {
            return null;
        }
        so.setCreationDate(new Date(item.lastModified()));
        so.setLastModified(new Date(item.lastModified()));
        so.setFolder(item.isDirectory());
        so.setResourceLength(item.length());
    } else {
        final Date d = new Date();
        so.setCreationDate(d);
        so.setLastModified(d);
        so.setFolder(true);
    }
    return so;
}
Also used : StoredObject(net.sf.webdav.StoredObject) StoreURIMatcher(org.commonjava.indy.dotmaven.util.StoreURIMatcher) Transfer(org.commonjava.maven.galley.model.Transfer) Date(java.util.Date)

Example 2 with StoredObject

use of net.sf.webdav.StoredObject in project indy by Commonjava.

the class DotMavenStore method getStoredObject.

@Override
public StoredObject getStoredObject(final ITransaction transaction, final String uri) throws WebdavException {
    // final HttpSession session = requestInfo.getRequest()
    // .getSession();
    // if ( session != null )
    // {
    // logger.info( "mount point: {}", session.getAttribute( RequestInfo.MOUNT_POINT ) );
    // }
    // else
    // {
    // logger.info( "No session available" );
    // }
    logger.info("get stored object: {}, {}", transaction, uri);
    final SubStore store = select(uri);
    if (store != null) {
        logger.info("Returning stored object from sub-store: {}", store);
        return store.getStoredObject(transaction, uri);
    }
    final StoredObject so = new StoredObject();
    so.setFolder(true);
    final Date d = new Date();
    so.setCreationDate(d);
    so.setLastModified(d);
    return so;
}
Also used : StoredObject(net.sf.webdav.StoredObject) Date(java.util.Date)

Example 3 with StoredObject

use of net.sf.webdav.StoredObject in project indy by Commonjava.

the class SettingsSubStore method getStoredObject.

@Override
public StoredObject getStoredObject(final ITransaction transaction, final String uri) throws WebdavException {
    final StoredObject so = new StoredObject();
    final Date d = new Date();
    so.setCreationDate(d);
    so.setLastModified(d);
    final SettingsURIMatcher matcher = new SettingsURIMatcher(uri);
    if (matcher.isSettingsFileResource()) {
        so.setFolder(false);
        final SettingsTemplate st = getSettingsTemplate(matcher);
        so.setResourceLength(st.getLength());
    } else {
        so.setFolder(true);
    }
    return so;
}
Also used : SettingsURIMatcher(org.commonjava.indy.dotmaven.util.SettingsURIMatcher) StoredObject(net.sf.webdav.StoredObject) SettingsTemplate(org.commonjava.indy.dotmaven.util.SettingsTemplate) Date(java.util.Date)

Aggregations

Date (java.util.Date)3 StoredObject (net.sf.webdav.StoredObject)3 SettingsTemplate (org.commonjava.indy.dotmaven.util.SettingsTemplate)1 SettingsURIMatcher (org.commonjava.indy.dotmaven.util.SettingsURIMatcher)1 StoreURIMatcher (org.commonjava.indy.dotmaven.util.StoreURIMatcher)1 Transfer (org.commonjava.maven.galley.model.Transfer)1