-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#27 Now loading assets with XCC by default and using XccAssetLoader
- Loading branch information
Showing
4 changed files
with
126 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/com/marklogic/appdeployer/command/modules/LoadAssetsViaXccCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.marklogic.appdeployer.command.modules; | ||
|
||
import com.marklogic.appdeployer.AppConfig; | ||
import com.marklogic.appdeployer.command.AbstractCommand; | ||
import com.marklogic.appdeployer.command.CommandContext; | ||
import com.marklogic.appdeployer.command.SortOrderConstants; | ||
import com.marklogic.clientutil.modulesloader.impl.XccAssetLoader; | ||
|
||
/** | ||
* Command for loading assets via XCC from a directory that doesn't fit the REST API structure, where assets are | ||
* expected to be in a directory named "ext". | ||
*/ | ||
public class LoadAssetsViaXccCommand extends AbstractCommand { | ||
|
||
// The list of asset paths to load modules from | ||
private String[] assetPaths; | ||
|
||
// Default permissions and collections for each module | ||
private String permissions = "rest-admin,read,rest-admin,update,rest-extension-user,execute"; | ||
private String[] collections; | ||
|
||
public LoadAssetsViaXccCommand(String... assetPaths) { | ||
this.assetPaths = assetPaths; | ||
} | ||
|
||
@Override | ||
public Integer getExecuteSortOrder() { | ||
return SortOrderConstants.LOAD_MODULES_ORDER - 10; | ||
} | ||
|
||
@Override | ||
public void execute(CommandContext context) { | ||
AppConfig config = context.getAppConfig(); | ||
|
||
XccAssetLoader loader = new XccAssetLoader(); | ||
loader.setUsername(config.getXdbcUsername()); | ||
loader.setPassword(config.getXdbcPassword()); | ||
loader.setHost(config.getHost()); | ||
loader.setDatabaseName(config.getModulesDatabaseName()); | ||
if (permissions != null) { | ||
loader.setPermissions(permissions); | ||
} | ||
if (collections != null) { | ||
loader.setCollections(collections); | ||
} | ||
|
||
loader.loadAssetsViaXcc(assetPaths); | ||
} | ||
|
||
public void setPermissions(String permissions) { | ||
this.permissions = permissions; | ||
} | ||
|
||
public void setCollections(String[] collections) { | ||
this.collections = collections; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters