Java源码示例:org.apache.axis2.deployment.DeploymentException

示例1
/**
 * Deploy the data service artifacts and add them to data services.
 *
 * @param carbonApp  find artifacts from this CarbonApplication instance.
 * @param axisConfig AxisConfiguration of the current tenant.
 */
@Override
public void deployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig) throws DeploymentException {
    if (log.isDebugEnabled()) {
        log.debug("Deploying data services of carbon application - " + carbonApp.getAppName());
    }
    ApplicationConfiguration appConfig = carbonApp.getAppConfig();
    List<Artifact.Dependency> dependencies = appConfig.getApplicationArtifact().getDependencies();

    List<Artifact> artifacts = new ArrayList<>();
    for (Artifact.Dependency dependency : dependencies) {
        if (dependency.getArtifact() != null) {
            artifacts.add(dependency.getArtifact());
        }
    }
    deployDataSources(artifacts, axisConfig);
}
 
示例2
/**
 * Un-deploy the data services and remove them from data services.
 *
 * @param carbonApp  find artifacts from this CarbonApplication instance.
 * @param axisConfig AxisConfiguration of the current tenant.
 */
@Override
public void undeployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig)
        throws DeploymentException {
    if (log.isDebugEnabled()) {
        log.debug("Un-Deploying data services of carbon application - " + carbonApp.getAppName());
    }
    ApplicationConfiguration appConfig = carbonApp.getAppConfig();
    List<Artifact.Dependency> dependencies = appConfig.getApplicationArtifact().getDependencies();

    List<Artifact> artifacts = new ArrayList<>();
    for (Artifact.Dependency dependency : dependencies) {
        if (dependency.getArtifact() != null) {
            artifacts.add(dependency.getArtifact());
        }
    }
    undeployDataSources(artifacts, axisConfig);
}
 
示例3
/**
 * Deploy the data source artifacts and add them to datasources.
 *
 * @param carbonApp  - store info in this object after deploying
 * @param axisConfig - AxisConfiguration of the current tenant
 */
@Override
public void deployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig) throws DeploymentException {
    if (log.isDebugEnabled()) {
        log.debug("Deploying carbon application - " + carbonApp.getAppName());
    }
    ApplicationConfiguration appConfig = carbonApp.getAppConfig();
    List<Artifact.Dependency> deps = appConfig.getApplicationArtifact().getDependencies();

    List<Artifact> artifacts = new ArrayList<Artifact>();
    for (Artifact.Dependency dep : deps) {
        if (dep.getArtifact() != null) {
            artifacts.add(dep.getArtifact());
        }
    }
    deployUnDeployDataSources(true, artifacts);
}
 
示例4
/**
 * Un-deploy the data sources and remove them from datasources.
 *
 * @param carbonApp  - all information about the existing artifacts are in this instance.
 * @param axisConfig - AxisConfiguration of the current tenant.
 */
@Override
public void undeployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig)
        throws DeploymentException {
    if (log.isDebugEnabled()) {
        log.debug("Un-Deploying carbon application - " + carbonApp.getAppName());
    }
    ApplicationConfiguration appConfig = carbonApp.getAppConfig();
    List<Artifact.Dependency> deps = appConfig.getApplicationArtifact().getDependencies();

    List<Artifact> artifacts = new ArrayList<Artifact>();
    for (Artifact.Dependency dep : deps) {
        if (dep.getArtifact() != null) {
            artifacts.add(dep.getArtifact());
        }
    }
    deployUnDeployDataSources(false, artifacts);
}
 
示例5
/**
 * Undeploys the cApp from system when the .car file is deleted from the repository. Find the relevant cApp using
 * the file path and call the undeploy method on applicationManager.
 *
 * @param filePath - deleted .car file path
 * @throws DeploymentException - error while un-deploying cApp
 */
public void undeploy(String filePath) throws DeploymentException {
    CarbonApplication existingApp = null;
    for (CarbonApplication carbonApp : getCarbonApps()) {
        if (filePath.equals(carbonApp.getAppFilePath())) {
            existingApp = carbonApp;
            break;
        }
    }
    if (existingApp != null) {
        undeployCarbonApp(existingApp, axisConfig);
    } else {
        log.info("Undeploying Faulty Carbon Application On : " + filePath);
        removeFaultyCarbonApp(filePath);
    }
    super.undeploy(filePath);
}
 
示例6
@Override
public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException {
    try {
        DeviceTypeConfiguration deviceTypeConfiguration = getDeviceTypeConfiguration(
                deploymentFileData.getFile().getAbsoluteFile());
        String deviceType = deviceTypeConfiguration.getName();
        String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true);
        if (deviceType != null && !deviceType.isEmpty() && tenantDomain != null
                && !tenantDomain.isEmpty()) {
            DeviceTypeConfigIdentifier deviceTypeConfigIdentifier = new DeviceTypeConfigIdentifier(deviceType,
                                                                                                   tenantDomain);
            ServiceRegistration serviceRegistration = registerDeviceType(deviceTypeConfigIdentifier,
                                                                         deviceTypeConfiguration);
            this.deviceTypeServiceRegistrations.put(deploymentFileData.getAbsolutePath(), serviceRegistration);
            this.deviceTypeConfigurationDataMap.put(deploymentFileData.getAbsolutePath(),
                                                    deviceTypeConfigIdentifier);
        }
    } catch (Throwable e) {
        log.error("Cannot deploy deviceType : " + deploymentFileData.getName(), e);
        throw new DeploymentException("Device type file " + deploymentFileData.getName() + " is not deployed ", e);
    }

}
 
示例7
/**
 * Deploy the data source artifacts and add them to datasources.
 *
 * @param carbonApp  - store info in this object after deploying
 * @param axisConfig - AxisConfiguration of the current tenant
 */
@Override
public void deployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig) throws DeploymentException {
    if (log.isDebugEnabled()) {
        log.debug("Deploying carbon application - " + carbonApp.getAppName());
    }
    ApplicationConfiguration appConfig = carbonApp.getAppConfig();
    List<Artifact.Dependency> deps = appConfig.getApplicationArtifact().getDependencies();

    List<Artifact> artifacts = new ArrayList<Artifact>();
    for (Artifact.Dependency dep : deps) {
        if (dep.getArtifact() != null) {
            artifacts.add(dep.getArtifact());
        }
    }
    deployUnDeployDataSources(true, artifacts);
}
 
示例8
/**
 * Un-deploy the data sources and remove them from datasources.
 *
 * @param carbonApp  - all information about the existing artifacts are in this instance.
 * @param axisConfig - AxisConfiguration of the current tenant.
 */
@Override
public void undeployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig)
        throws DeploymentException {
    if (log.isDebugEnabled()) {
        log.debug("Un-Deploying carbon application - " + carbonApp.getAppName());
    }
    ApplicationConfiguration appConfig = carbonApp.getAppConfig();
    List<Artifact.Dependency> deps = appConfig.getApplicationArtifact().getDependencies();

    List<Artifact> artifacts = new ArrayList<Artifact>();
    for (Artifact.Dependency dep : deps) {
        if (dep.getArtifact() != null) {
            artifacts.add(dep.getArtifact());
        }
    }
    deployUnDeployDataSources(false, artifacts);
}
 
示例9
/**
 * Deploy data services.
 * adding the data service to the data services.
 * there can be multiple data sources as separate xml files.
 *
 * @param artifacts  list of artifacts to be deployed.
 * @param axisConfig axis configuration.
 */
private void deployDataSources(List<Artifact> artifacts, AxisConfiguration axisConfig)
        throws DeploymentException {
    for (Artifact artifact : artifacts) {
        if (DS_TYPE.equals(artifact.getType())) {
            List<CappFile> files = artifact.getFiles();
            if (files == null || files.isEmpty()) {
                throw new DeploymentException("DataServiceCappDeployer::deployDataServices --> "
                                                      + "Error No data services found in the artifact to deploy");
            }
            for (CappFile cappFile : files) {
                String fileName = cappFile.getName();
                String dataServiceConfigPath = artifact.getExtractedPath() + File.separator + fileName;

                File file = new File(dataServiceConfigPath);
                if (!file.exists()) {
                    throw new DeploymentException("DataServiceCappDeployer::deployDataServices --> "
                                                          + "Error Data service file cannot be found in artifact, "
                                                          + "file name - " + fileName);
                }
                // access the deployment engine through axis config
                DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator();
                Deployer deployer = deploymentEngine.getDeployer(DS_DIR, "dbs");

                try {
                    // Call the deploy method of the deployer
                    deployer.deploy(new DeploymentFileData(new File(dataServiceConfigPath), deployer));
                    artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED);
                } catch (DeploymentException e) {
                    artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
                    throw new DeploymentException(
                            "DataServiceCappDeployer::deployDataServices --> "
                                    + "Error in deploying data service: " + e.getMessage(), e);
                }
            }
        }
    }
}
 
示例10
/**
 * Builds a TransportInDescription object from an XML configuration. The expected
    * XML configuration should be as follows.
    *
    * <transportReceiver name="myTransport" class="my.transport.listener.Class">
    *     <parameter name="param1">value 1</parameter>
    *     <parameter name="param1">value 1</parameter>
    * </transportReceiver>
 * 
 * @param transport An OMElement which contains transport configurations.
    * @param init Whether to initialize the receiver or not
 * @return a transport in description
 * @throws DeploymentException on error
 */
public static TransportInDescription processTransportReceiver(
           OMElement transport, boolean init) throws DeploymentException {

       if (!TAG_TRANSPORT_RECEIVER.equals(transport.getLocalName())) {
           throw new DeploymentException("Invalid top level element in the transport receiver " +
                   "configuration");
       }

       String name = transport.getAttributeValue(new QName(ATTRIBUTE_NAME));
       if (name == null || "".equals(name)) {
           throw new DeploymentException("Transport name is not specified in the receiver " +
                   "configuration");
       }

       String className = transport.getAttributeValue(new QName(ATTRIBUTE_CLASS));
       if (className == null || "".equals(className)) {
           throw new DeploymentException("Class name is not specified in the receiver " +
                   "configuration");
       }

       TransportInDescription transportIn = new TransportInDescription(name);
       if (init) {
           try {
               Class clazz = TransportBuilderUtils.class.getClassLoader().loadClass(className);
               TransportListener listener = (TransportListener) clazz.newInstance();
               transportIn.setReceiver(listener);
           } catch (Exception e) {
               throw new DeploymentException("Error while initializing transport receiver", e);
           }
       }

       Iterator itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));
       processParameters(itr, transportIn);
       return transportIn;
   }
 
示例11
/**
* Builds a TransportOutDescription object based on the specified XML configuration.
   * The XML should be as follows.
   *
   * <transportSender name="myTransport" class="my.transport.sender.Class">
   *     <parameter name="param1">value 1</parameter>
   *     <parameter name="param1">value 1</parameter>
   * </transportSender>
*
* @param transport An Iterator of OMElement which contains transport configurations.
   * @param init Whether to initialize the sender or not
* @return an array of transport out descriptions
* @throws DeploymentException on error
*/
  public static TransportOutDescription processTransportSender(
          OMElement transport, boolean init) throws DeploymentException {

      if (!TAG_TRANSPORT_SENDER.equals(transport.getLocalName())) {
          throw new DeploymentException("Invalid top level element in the transport sender " +
                  "configuration");
      }

      String name = transport.getAttributeValue(new QName(ATTRIBUTE_NAME));
      if (name == null || "".equals(name)) {
          throw new DeploymentException("Transport name is not specified in the receiver " +
                  "configuration");
      }

      String className = transport.getAttributeValue(new QName(ATTRIBUTE_CLASS));
      if (className == null || "".equals(className)) {
          throw new DeploymentException("Class name is not specified in the receiver " +
                  "configuration");
      }

      TransportOutDescription transportOut = new TransportOutDescription(name);
      if (init) {
          try {
              Class clazz = TransportBuilderUtils.class.getClassLoader().loadClass(className);
              TransportSender sender = (TransportSender) clazz.newInstance();
              transportOut.setSender(sender);
          } catch (Exception e) {
              throw new DeploymentException("Error while initializing transport sender", e);
          }
      }

      Iterator itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));
      processParameters(itr, transportOut);
      return transportOut;
  }
 
示例12
/**
 * Axis2 deployment engine will call this method when a .car archive is deployed. So we only have to call the
 * cAppDeploymentManager to deploy it using the absolute path of the deployed .car file.
 *
 * @param deploymentFileData - info about the deployed file
 * @throws DeploymentException - error while deploying cApp
 */
public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException {
    String artifactPath = deploymentFileData.getAbsolutePath();
    try {
        deployCarbonApps(artifactPath);
    } catch (Exception e) {
        log.error("Error while deploying carbon application " + artifactPath, e);
    }

    super.deploy(deploymentFileData);
}
 
示例13
@Override
public void deployArtifacts(CarbonApplication carbonApplication, AxisConfiguration axisConfiguration)
                                                                                        throws DeploymentException {
    ApplicationConfiguration appConfig = carbonApplication.getAppConfig();
    List<Artifact.Dependency> deps = appConfig.getApplicationArtifact().getDependencies();

    List<Artifact> artifacts = new ArrayList<Artifact>();
    for (Artifact.Dependency dep : deps) {
        if (dep.getArtifact() != null) {
            artifacts.add(dep.getArtifact());
        }
    }
    deployRegistryArtifacts(artifacts, carbonApplication.getAppNameWithVersion());
}
 
示例14
@Override
public void undeployArtifacts(CarbonApplication carbonApplication, AxisConfiguration axisConfiguration) throws DeploymentException {
    ApplicationConfiguration appConfig = carbonApplication.getAppConfig();
    List<Artifact.Dependency> deps = appConfig.getApplicationArtifact().getDependencies();

    List<Artifact> artifacts = new ArrayList<Artifact>();
    for (Artifact.Dependency dep : deps) {
        if (dep.getArtifact() != null) {
            artifacts.add(dep.getArtifact());
        }
    }
    undeployRegistryArtifacts(artifacts, carbonApplication.getAppNameWithVersion());
}
 
示例15
/**
 * Deploy the artifacts which can be deployed through this deployer (endpoints, sequences,
 * proxy service etc.).
 *
 * @param carbonApp  - CarbonApplication instance to check for artifacts
 * @param axisConfig - AxisConfiguration of the current tenant
 */
public void deployArtifacts(CarbonApplication carbonApp, AxisConfiguration axisConfig)
        throws DeploymentException{
    List<Artifact.Dependency> artifacts = carbonApp.getAppConfig().getApplicationArtifact()
            .getDependencies();

    deployClassMediators(artifacts, axisConfig);
    deploySynapseLibrary(artifacts, axisConfig);
    Map<String, List<Artifact.Dependency>> artifactTypeMap = getOrderedArtifactsMap(artifacts);

    //deploy artifacts
    for (String artifactType : artifactTypeMap.keySet()) {
        deployArtifactType(artifactTypeMap.get(artifactType), carbonApp, axisConfig);
    }
}
 
示例16
/**
 * Un-deploys Synapse artifacts found in this application. Just delete the files from the
 * hot folders. Synapse hot deployer will do the rest..
 *
 * @param carbonApplication - CarbonApplication instance
 * @param axisConfig - AxisConfiguration of the current tenant
 */
public void undeployArtifacts(CarbonApplication carbonApplication, AxisConfiguration axisConfig)
        throws DeploymentException{

    List<Artifact.Dependency> artifacts = carbonApplication.getAppConfig()
            .getApplicationArtifact().getDependencies();
    // Reverse artifacts dependency order should be used for un deployment, EI-1737
    Map<String, List<Artifact.Dependency>> artifactTypeMap = getOrderedArtifactsMap(artifacts);
    List<String> artifactTypesList = new ArrayList<String>(artifactTypeMap.keySet());
    Collections.reverse(artifactTypesList);

    for (String artifactType : artifactTypesList) {
        undeployArtifactType(carbonApplication, axisConfig, artifactTypeMap.get(artifactType));
    }
}
 
示例17
/**
 * Deploy class mediators contains in the CApp
 *
 * @param artifacts List of Artifacts contains in the capp
 * @param axisConfig AxisConfiguration of the current tenant
 * @throws DeploymentException if something goes wrong while deployment
 */
private void deployClassMediators(List<Artifact.Dependency> artifacts,
                                 AxisConfiguration axisConfig) throws DeploymentException {
    for (Artifact.Dependency dependency : artifacts) {

        Artifact artifact = dependency.getArtifact();
        if (!validateArtifact(artifact)) {
            continue;
        }

        if (SynapseAppDeployerConstants.MEDIATOR_TYPE.endsWith(artifact.getType())) {

            Deployer deployer = getClassMediatorDeployer(axisConfig);

            if (deployer != null) {
                artifact.setRuntimeObjectName(artifact.getName());
                String fileName = artifact.getFiles().get(0).getName();
                String artifactPath = artifact.getExtractedPath() + File.separator + fileName;

                try {
                    deployer.deploy(new DeploymentFileData(new File(artifactPath), deployer));
                    artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED);
                } catch (DeploymentException e) {
                    artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
                    throw e;
                }
            }
        }
    }
}
 
示例18
/**
 * Function to execute artifact deployment
 */
public void deploy() {

    Set<Map.Entry<String, Deployer>> deploymentEntries = dirToDeployerMap.entrySet();
    for (Map.Entry<String, Deployer> deployerEntry : deploymentEntries) {
        if (log.isDebugEnabled()) {
            log.debug("Deploying artifacts from: " + deployerEntry.getKey());
        }

        File confDirFile = new File(deployerEntry.getKey());
        if (confDirFile.isDirectory() && confDirFile.exists()) {
            File[] configFiles = confDirFile.listFiles();
            if (configFiles == null) {
                if (log.isDebugEnabled()) {
                    log.debug("No configurations found to deploy in: " + deployerEntry.getKey());
                }
                continue;
            }

            // Deploy each config file
            for (File configFile : configFiles) {
                if (configFile.isFile()) {
                    try {
                        deployerEntry.getValue().deploy(new DeploymentFileData(configFile, deployerEntry.getValue()));
                    } catch (DeploymentException e) {
                        log.error("Error occurred while deploying : " + configFile.getName(), e);
                    }
                }
            }
        }
    }
}
 
示例19
/**
 * Function to register deployer
 *
 * @param directoryPath
 * @param deployer
 */
public void registerDeployer(String directoryPath, Deployer deployer) throws DeploymentException {
    if (deployer != null) {
        dirToDeployerMap.put(directoryPath, deployer);
    } else {
        throw new DeploymentException("Registering null deployer for target directory: " + directoryPath);
    }
}
 
示例20
/**
 * Trigger un-deploying of a deployed file. Removes the deleted user store from chain
 *
 * @param fileName: domain name --> file name
 * @throws org.apache.axis2.deployment.DeploymentException for any errors
 */
public void undeploy(String fileName) throws DeploymentException {

    if (fileName != null) {
        String ext = FilenameUtils.getExtension(fileName);
        if (!UserStoreConfigurationConstants.ENC_EXTENSION.equalsIgnoreCase(ext)) {
            UserStoreDeploymentManager userStoreDeploymentManager = new UserStoreDeploymentManager();
            userStoreDeploymentManager.undeploy(fileName);
        }
    }
}
 
示例21
@Override
public void deployArtifacts(CarbonApplication carbonApplication, AxisConfiguration axisConfig)
        throws DeploymentException {
    List<Artifact.Dependency> artifacts =
            carbonApplication.getAppConfig().getApplicationArtifact().getDependencies();

    for (Artifact.Dependency dep : artifacts) {
        Artifact artifact = dep.getArtifact();
        if (!validateArtifact(artifact)) {
            continue;
        }
        addArtifact(artifact);
    }

    try {
        deployTypeSpecifiedArtifacts(deviceTypeUIs, axisConfig, null,
                                     DeviceTypePluginConstants.CDMF_UI_TYPE_DIR);
        deployTypeSpecifiedArtifacts(deviceTypePlugins, axisConfig,
                                     DeviceTypePluginConstants.CDMF_PLUGIN_TYPE_EXTENSION,
                                     DeviceTypePluginConstants.CDMF_PLUGIN_TYPE_DIR);

    } catch (Exception e) {
        throw new DeploymentException(e.getMessage(), e);
    } finally {
        deviceTypePlugins.clear();
        deviceTypeUIs.clear();
    }

}
 
示例22
protected void deployTypeSpecifiedArtifacts(List<Artifact> artifacts, AxisConfiguration axisConfig,
                                          String fileType, String directory) throws DeploymentException {
    for (Artifact artifact : artifacts) {
        Deployer deployer = AppDeployerUtils.getArtifactDeployer(axisConfig, directory, fileType);
        if (deployer != null) {
            deploy(deployer, artifact);
        }
    }
}
 
示例23
@Override
public void undeployArtifacts(CarbonApplication carbonApplication, AxisConfiguration axisConfig)
        throws DeploymentException {
    List<Artifact.Dependency> artifacts =
            carbonApplication.getAppConfig().getApplicationArtifact().getDependencies();

    deviceTypePlugins.clear();
    deviceTypeUIs.clear();

    for (Artifact.Dependency dep : artifacts) {
        Artifact artifact = dep.getArtifact();
        if (!validateArtifact(artifact)) {
            continue;
        }
        addArtifact(artifact);
    }

    try {
        undeployTypeSpecifiedArtifacts(deviceTypeUIs, axisConfig, null,
                                       DeviceTypePluginConstants.CDMF_UI_TYPE_DIR);
        undeployTypeSpecifiedArtifacts(deviceTypePlugins, axisConfig,
                                       DeviceTypePluginConstants.CDMF_PLUGIN_TYPE_EXTENSION,
                                       DeviceTypePluginConstants.CDMF_PLUGIN_TYPE_DIR);
    } finally {
        deviceTypePlugins.clear();
        deviceTypeUIs.clear();
    }

}
 
示例24
protected void undeployTypeSpecifiedArtifacts(List<Artifact> artifacts, AxisConfiguration axisConfig, String fileType
        , String directory) throws DeploymentException {
    for (Artifact artifact : artifacts) {
            Deployer deployer = AppDeployerUtils.getArtifactDeployer(axisConfig, directory, fileType);
        if (deployer != null &&
                AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED.equals(artifact.getDeploymentStatus())) {
            undeploy(deployer, artifact);
        }
    }
}
 
示例25
void deploy(Deployer deployer, Artifact artifact) throws DeploymentException {
    String fileName = artifact.getFiles().get(0).getName();
    String artifactPath = artifact.getExtractedPath() + File.separator + fileName;
    try {
        deployer.deploy(new DeploymentFileData(new File(artifactPath)));
        artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED);
    } catch (Exception e) {
        artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
        log.error("Deployment is failed due to " + e.getMessage(), e);
        throw new DeploymentException(e.getMessage(), e);
    }
}
 
示例26
private void undeploy(Deployer deployer, Artifact artifact) throws DeploymentException {
    String fileName = artifact.getFiles().get(0).getName();
    String artifactPath = artifact.getExtractedPath() + File.separator + fileName;
    try {
        deployer.undeploy(new DeploymentFileData(new File(artifactPath), deployer).getAbsolutePath());
        artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_PENDING);
    } catch (Exception e) {
        artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED);
        log.error("Undeployment is failed due to " + e.getMessage(), e);
        throw new DeploymentException(e.getMessage(), e);
    }
}
 
示例27
@Override
public void undeploy(String filePath) throws DeploymentException {
    DeviceTypeConfigIdentifier deviceTypeConfigIdentifier = this.deviceTypeConfigurationDataMap.get(filePath);
    unregisterDeviceType(filePath);
    this.deviceTypeConfigurationDataMap.remove(filePath);
    log.info("Device Type undeployed successfully : " + deviceTypeConfigIdentifier.getDeviceType() + " for tenant "
                     + deviceTypeConfigIdentifier.getTenantDomain());
}
 
示例28
@SuppressWarnings("unchecked")
@Test(description = "Testing deviceType deploy method by deploying Android device type")
public void deploy() throws DeploymentException, IllegalAccessException {
    deviceTypePluginDeployer.deploy(deploymentFileData);
    Map<String, ServiceRegistration> tempServiceRegistration = (Map<String, ServiceRegistration>)
            deviceTypeServiceRegistrations.get(deviceTypePluginDeployer);
    Assert.assertEquals(tempServiceRegistration.get(deploymentFileData.getAbsolutePath()), serviceRegistration);
    Map<String, DeviceTypeConfigIdentifier> tempDeviceTypeConfig = (Map<String, DeviceTypeConfigIdentifier>)
            deviceTypeConfigurationDataMap.get(deviceTypePluginDeployer);
    DeviceTypeConfigIdentifier deviceTypeConfigIdentifier = tempDeviceTypeConfig.get(deploymentFileData
            .getAbsolutePath());
    Assert.assertEquals(deviceTypeConfigIdentifier.getDeviceType(), "android");
}
 
示例29
@SuppressWarnings("unchecked")
@Test(dependsOnMethods = {"deploy"} , description = "Testing deviceType undeploy method by un-deploying Android " +
        "device type")
public void unDeploy() throws DeploymentException, IllegalAccessException {
    deviceTypePluginDeployer.undeploy(deploymentFileData.getAbsolutePath());
    Map<String, ServiceRegistration> tempServiceRegistration = (Map<String, ServiceRegistration>)
            deviceTypeServiceRegistrations.get(deviceTypePluginDeployer);
    Assert.assertNull(tempServiceRegistration.get(deploymentFileData.getAbsolutePath()));
    Map<String, DeviceTypeConfigIdentifier> tempDeviceTypeConfig = (Map<String, DeviceTypeConfigIdentifier>)
            deviceTypeConfigurationDataMap.get(deviceTypePluginDeployer);
    Assert.assertNull(tempDeviceTypeConfig.get(deploymentFileData.getAbsolutePath()));
}
 
示例30
/**
 * Trigger un-deploying of a deployed file. Removes the deleted user store from chain
 *
 * @param fileName: domain name --> file name
 * @throws org.apache.axis2.deployment.DeploymentException for any errors
 */
public void undeploy(String fileName) throws DeploymentException {

    if (fileName != null) {
        String ext = FilenameUtils.getExtension(fileName);
        if (!UserStoreConfigurationConstants.ENC_EXTENSION.equalsIgnoreCase(ext)) {
            UserStoreDeploymentManager userStoreDeploymentManager = new UserStoreDeploymentManager();
            userStoreDeploymentManager.undeploy(fileName);
        }
    }
}