use of org.jboss.as.controller.descriptions.ModelDescriptionConstants.URL in project teiid by teiid.
the class TeiidAdd method deployResources.
private void deployResources(OperationContext context) throws OperationFailedException {
if (requiresRuntime(context)) {
try {
Module module = Module.forClass(getClass());
if (module == null) {
// during testing
return;
}
// $NON-NLS-1$
URL deployments = module.getExportedResource("deployments.properties");
if (deployments == null) {
// no deployments
return;
}
BufferedReader in = new BufferedReader(new InputStreamReader(deployments.openStream()));
String deployment;
while ((deployment = in.readLine()) != null) {
PathAddress deploymentAddress = PathAddress.pathAddress(PathElement.pathElement(DEPLOYMENT, deployment));
ModelNode op = new ModelNode();
op.get(OP).set(ADD);
op.get(OP_ADDR).set(deploymentAddress.toModelNode());
op.get(ENABLED).set(true);
// prevents writing this deployment out to standalone.xml
op.get(PERSISTENT).set(false);
URL url = module.getExportedResource(deployment);
String urlString = url.toExternalForm();
ModelNode contentItem = new ModelNode();
contentItem.get(URL).set(urlString);
op.get(CONTENT).add(contentItem);
ImmutableManagementResourceRegistration rootResourceRegistration = context.getRootResourceRegistration();
OperationStepHandler handler = rootResourceRegistration.getOperationHandler(deploymentAddress, ADD);
context.addStep(op, handler, OperationContext.Stage.MODEL);
}
in.close();
} catch (IOException e) {
throw new OperationFailedException(e.getMessage(), e);
}
}
}
Aggregations