Skip to main content
added 1 character in body
Source Link
Nickoli Roussakov
  • 18.4k
  • 4
  • 31
  • 62

In Tridion 2011 and up, the Broker Storage Layer API took over the deprecated functions. This means classes in com.tridion.storage package. Here is a method that should return the file system location for pages. Note, I've not tested nor compiled this, but it should get you going in the right direction.

String getPageFileSystemStorageLocation(int pubId) throws ClassCastException {
    String fsPath = null;
    StorageManagerFactory storageManagerFactory = StorageManagerFactory.getInstance();
    
    try {
        FSPageDAO fsPageDAO = (FSPageDAO)storageManagerFactory.getDAO(pubId, StorageTypeMapping.PAGE);
        File storageLocationFolder = fsPageDAO.getStorageLocation();
        fsPath = storageLocationFolder.getAbsolutePath();
    }
    catch(ClassCastException cce) {
        // This means you don't have pages configured to go to the file system.
        // Handle it/log it/call the fire department/whatever...
        throw cce;
    }

    return fsPath;
}

-- EDIT --

I just realized that the FSPageDAO.getStorageLocation() is a protected method in the FSBaseDAO, so the above code won't work as is. However, this can be resolved by finding the exact classes/methods which instantiate the FSPageDAO (because its public constructor taketakes the storage location as a parameter), or by extending the FSPageDAO with a custom class inside the com.tridion.storage package.

In Tridion 2011 and up, the Broker Storage Layer API took over the deprecated functions. This means classes in com.tridion.storage package. Here is a method that should return the file system location for pages. Note, I've not tested nor compiled this, but it should get you going in the right direction.

String getPageFileSystemStorageLocation(int pubId) throws ClassCastException {
    String fsPath = null;
    StorageManagerFactory storageManagerFactory = StorageManagerFactory.getInstance();
    
    try {
        FSPageDAO fsPageDAO = (FSPageDAO)storageManagerFactory.getDAO(pubId, StorageTypeMapping.PAGE);
        File storageLocationFolder = fsPageDAO.getStorageLocation();
        fsPath = storageLocationFolder.getAbsolutePath();
    }
    catch(ClassCastException cce) {
        // This means you don't have pages configured to go to the file system.
        // Handle it/log it/call the fire department/whatever...
        throw cce;
    }

    return fsPath;
}

-- EDIT --

I just realized that the FSPageDAO.getStorageLocation() is a protected method in the FSBaseDAO, so the above code won't work as is. However, this can be resolved by finding the exact classes/methods which instantiate the FSPageDAO (because its public constructor take the storage location as a parameter), or by extending the FSPageDAO with a custom class inside the com.tridion.storage package.

In Tridion 2011 and up, the Broker Storage Layer API took over the deprecated functions. This means classes in com.tridion.storage package. Here is a method that should return the file system location for pages. Note, I've not tested nor compiled this, but it should get you going in the right direction.

String getPageFileSystemStorageLocation(int pubId) throws ClassCastException {
    String fsPath = null;
    StorageManagerFactory storageManagerFactory = StorageManagerFactory.getInstance();
    
    try {
        FSPageDAO fsPageDAO = (FSPageDAO)storageManagerFactory.getDAO(pubId, StorageTypeMapping.PAGE);
        File storageLocationFolder = fsPageDAO.getStorageLocation();
        fsPath = storageLocationFolder.getAbsolutePath();
    }
    catch(ClassCastException cce) {
        // This means you don't have pages configured to go to the file system.
        // Handle it/log it/call the fire department/whatever...
        throw cce;
    }

    return fsPath;
}

-- EDIT --

I just realized that the FSPageDAO.getStorageLocation() is a protected method in the FSBaseDAO, so the above code won't work as is. However, this can be resolved by finding the exact classes/methods which instantiate the FSPageDAO (because its public constructor takes the storage location as a parameter), or by extending the FSPageDAO with a custom class inside the com.tridion.storage package.

added 419 characters in body
Source Link
Nickoli Roussakov
  • 18.4k
  • 4
  • 31
  • 62

In Tridion 2011 and up, the Broker Storage Layer API took over the deprecated functions. This means classes in com.tridion.storage package. Here is a method that should return the file system location for pages. Note, I've not tested nor compiled this, but it should get you going in the right direction.

String getPageFileSystemStorageLocation(int pubId) throws ClassCastException {
    String fsPath = null;
    StorageManagerFactory storageManagerFactory = StorageManagerFactory.getInstance();
    
    try {
        FSPageDAO fsPageDAO = (FSPageDAO)storageManagerFactory.getDAO(pubId, StorageTypeMapping.PAGE);
        File storageLocationFolder = fsPageDAO.getStorageLocation();
        fsPath = storageLocationFolder.getAbsolutePath();
    }
    catch(ClassCastException cce) {
        // This means you don't have pages configured to go to the file system.
        // Handle it/log it/call the fire department/whatever...
        throw cce;
    }

    return fsPath;
}

-- EDIT --

I just realized that the FSPageDAO.getStorageLocation() is a protected method in the FSBaseDAO, so the above code won't work as is. However, this can be resolved by finding the exact classes/methods which instantiate the FSPageDAO (because its public constructor take the storage location as a parameter), or by extending the FSPageDAO with a custom class inside the com.tridion.storage package.

In Tridion 2011 and up, the Broker Storage Layer API took over the deprecated functions. This means classes in com.tridion.storage package. Here is a method that should return the file system location for pages. Note, I've not tested nor compiled this, but it should get you going in the right direction.

String getPageFileSystemStorageLocation(int pubId) throws ClassCastException {
    String fsPath = null;
    StorageManagerFactory storageManagerFactory = StorageManagerFactory.getInstance();
    
    try {
        FSPageDAO fsPageDAO = (FSPageDAO)storageManagerFactory.getDAO(pubId, StorageTypeMapping.PAGE);
        File storageLocationFolder = fsPageDAO.getStorageLocation();
        fsPath = storageLocationFolder.getAbsolutePath();
    }
    catch(ClassCastException cce) {
        // This means you don't have pages configured to go to the file system.
        // Handle it/log it/call the fire department/whatever...
        throw cce;
    }

    return fsPath;
}

In Tridion 2011 and up, the Broker Storage Layer API took over the deprecated functions. This means classes in com.tridion.storage package. Here is a method that should return the file system location for pages. Note, I've not tested nor compiled this, but it should get you going in the right direction.

String getPageFileSystemStorageLocation(int pubId) throws ClassCastException {
    String fsPath = null;
    StorageManagerFactory storageManagerFactory = StorageManagerFactory.getInstance();
    
    try {
        FSPageDAO fsPageDAO = (FSPageDAO)storageManagerFactory.getDAO(pubId, StorageTypeMapping.PAGE);
        File storageLocationFolder = fsPageDAO.getStorageLocation();
        fsPath = storageLocationFolder.getAbsolutePath();
    }
    catch(ClassCastException cce) {
        // This means you don't have pages configured to go to the file system.
        // Handle it/log it/call the fire department/whatever...
        throw cce;
    }

    return fsPath;
}

-- EDIT --

I just realized that the FSPageDAO.getStorageLocation() is a protected method in the FSBaseDAO, so the above code won't work as is. However, this can be resolved by finding the exact classes/methods which instantiate the FSPageDAO (because its public constructor take the storage location as a parameter), or by extending the FSPageDAO with a custom class inside the com.tridion.storage package.

Source Link
Nickoli Roussakov
  • 18.4k
  • 4
  • 31
  • 62

In Tridion 2011 and up, the Broker Storage Layer API took over the deprecated functions. This means classes in com.tridion.storage package. Here is a method that should return the file system location for pages. Note, I've not tested nor compiled this, but it should get you going in the right direction.

String getPageFileSystemStorageLocation(int pubId) throws ClassCastException {
    String fsPath = null;
    StorageManagerFactory storageManagerFactory = StorageManagerFactory.getInstance();
    
    try {
        FSPageDAO fsPageDAO = (FSPageDAO)storageManagerFactory.getDAO(pubId, StorageTypeMapping.PAGE);
        File storageLocationFolder = fsPageDAO.getStorageLocation();
        fsPath = storageLocationFolder.getAbsolutePath();
    }
    catch(ClassCastException cce) {
        // This means you don't have pages configured to go to the file system.
        // Handle it/log it/call the fire department/whatever...
        throw cce;
    }

    return fsPath;
}