Content Transport: Install an existing server available feature
Author: daniel_philippi
Publication Date: 12/6/2024 14:47
Hi all.
I tried a few things that could be found in some community entries and documentations but nothing helped me.
I want to install an existing feature that is available on the FS server like I can do it in a schedule entry.
I found the featureInstallAgent but here I need to have a featureFile. But I do not want to create a new one but to use an existing one.
Please help
Greetings,
Daniel
This is what I have so far:
import de.espirit.firstspirit.feature.*;
import de.espirit.firstspirit.agency.*;
SpecialistsBroker broker = connection.getBroker();
BrokerAgent brokerAgent = broker.requireSpecialist(BrokerAgent.TYPE);
broker = brokerAgent.getBrokerByProjectName(context.project.getName());
FeatureInstallAgent featureAgent = broker.requireSpecialist(FeatureInstallAgent.TYPE);
context.logInfo("Project " + context.project.getName());
Tags: Content Transport, firstspirit
-
Author: hoebbel - 12/9/2024 7:58
Hello Daniel,
maybe this example code will help you ("/path/to/feature/feature.zip" has to be an existing feature)
import de.espirit.firstspirit.io.FileSystemsAgent; import de.espirit.firstspirit.feature.FeatureInstallAgent; import de.espirit.firstspirit.transport.LayerMapper; fileSystemsAgent = context.requireSpecialist(FileSystemsAgent.TYPE); featureFile = new File("/path/to/feature/feature.zip"); fileInput = new FileInputStream(featureFile); featureInstallagent = context.requireSpecialist(FeatureInstallAgent.TYPE); featureFile = featureInstallagent.uploadFeatureFile(fileInput); layerMapper = de.espirit.firstspirit.transport.LayerMapper.CREATE_NEW_DEFAULT_LAYER_MAPPER; sah = featureInstallagent.installFeature(featureFile, layerMapper); result = sah.getResult(); context.logInfo("Feature installed. Updated elements: " + result.getUpdatedElements());Best regards
Holger0 -
Author: daniel_philippi - 12/10/2024 14:01
No
I would like to use an existing feature zip that is available in the server storage.
I know the name and I would like to have access like it is possible with FeatureAgent.getFeatureFiles().
I want to do the same as I can do in a schedule task: content transport --> storage
0 -
Author: hoebbel - 12/10/2024 15:06
As the feature storages are not part of the API as far as I know, this is unfortunately not possible.
If this access is desired, please create a corresponding idea.0 -
Author: daniel_philippi - 12/10/2024 15:34
Too bad. That would have beed just nice to have and would make my life a bit easier. But ok, I will go another way.
Thanks!
0 -
Author: daniel_philippi - 12/12/2024 16:31
I figured out a workaround.
As the features are stored in the filesystem of the firstspirit server (we mounted another filesystem to that folder so we can access it with multiple FS servers (d, q and p)) the only option I need to put into the script Holger mentioned is the path to the features folder.
To get the latest feature zip file I had to search for it inside the folder and then I was able to install it with the script. Not as I expected it, but it is solving my problem perfectly!
Now I can offer now various action templates that install different feature ZIPs into various projects and I can control the feature to be installed in one place inside the server manager! Perfect!0
Please sign in to leave a comment.
Comments
5 comments