mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fixing issues in resolving the configuration resolving.
This commit is contained in:
parent
242cf06f42
commit
fd18ab711c
@ -80,19 +80,11 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<!--<plugin>-->
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<!--<groupId>org.apache.maven.plugins</groupId>-->
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<!--<artifactId>maven-surefire-plugin</artifactId>-->
|
||||||
<version>2.18</version>
|
<!--<version>2.18</version>-->
|
||||||
<configuration>
|
<!--</plugin>-->
|
||||||
<systemPropertyVariables>
|
|
||||||
<log4j.configuration>file:src/test/resources/log4j.properties</log4j.configuration>
|
|
||||||
</systemPropertyVariables>
|
|
||||||
<suiteXmlFiles>
|
|
||||||
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
|
|
||||||
</suiteXmlFiles>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
@ -114,6 +106,11 @@
|
|||||||
<groupId>org.testng</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>testng</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wso2.carbon</groupId>
|
<groupId>org.wso2.carbon</groupId>
|
||||||
<artifactId>org.wso2.carbon.logging</artifactId>
|
<artifactId>org.wso2.carbon.logging</artifactId>
|
||||||
|
|||||||
@ -18,17 +18,19 @@
|
|||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.application.mgt.core.config;
|
package org.wso2.carbon.device.application.mgt.core.config;
|
||||||
|
|
||||||
import org.wso2.carbon.device.application.mgt.core.config.extensions.Extension;
|
import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@XmlRootElement(name = "ApplicationManagementConfiguration")
|
@XmlRootElement(name = "ApplicationManagementConfiguration")
|
||||||
public class Configurations {
|
public class Configuration {
|
||||||
|
|
||||||
private String datasourceName;
|
private String datasourceName;
|
||||||
|
|
||||||
private List<Extension> extensionsConfig;
|
private List<Extension> extensions;
|
||||||
|
|
||||||
@XmlElement(name = "DatasourceName", required = true)
|
@XmlElement(name = "DatasourceName", required = true)
|
||||||
public String getDatasourceName() {
|
public String getDatasourceName() {
|
||||||
@ -39,13 +41,14 @@ public class Configurations {
|
|||||||
this.datasourceName = datasourceName;
|
this.datasourceName = datasourceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "Extensions", required = false)
|
@XmlElementWrapper(name = "Extensions")
|
||||||
|
@XmlElement(name = "Extension")
|
||||||
public List<Extension> getExtensions() {
|
public List<Extension> getExtensions() {
|
||||||
return extensionsConfig;
|
return extensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExtensionsConfig(List<Extension> extensionsConfig) {
|
public void setExtensions(List<Extension> extensions) {
|
||||||
this.extensionsConfig = extensionsConfig;
|
this.extensions = extensions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,9 +22,7 @@ import org.apache.commons.logging.Log;
|
|||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
|
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException;
|
||||||
import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException;
|
import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException;
|
||||||
import org.wso2.carbon.device.application.mgt.core.config.extensions.Extension;
|
|
||||||
import org.wso2.carbon.device.application.mgt.core.util.Constants;
|
import org.wso2.carbon.device.application.mgt.core.util.Constants;
|
||||||
import org.wso2.carbon.utils.CarbonUtils;
|
|
||||||
|
|
||||||
import javax.xml.bind.JAXBContext;
|
import javax.xml.bind.JAXBContext;
|
||||||
import javax.xml.bind.Unmarshaller;
|
import javax.xml.bind.Unmarshaller;
|
||||||
@ -32,13 +30,11 @@ import java.io.File;
|
|||||||
|
|
||||||
public class ConfigurationManager {
|
public class ConfigurationManager {
|
||||||
|
|
||||||
private final String applicationMgtConfigXMLPath = CarbonUtils.getCarbonConfigDirPath() + File.separator +
|
|
||||||
Constants.APPLICATION_CONFIG_XML_FILE;
|
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(ConfigurationManager.class);
|
private static final Log log = LogFactory.getLog(ConfigurationManager.class);
|
||||||
|
|
||||||
private Configurations configuration;
|
private Configuration configuration;
|
||||||
|
|
||||||
|
private static String configPath;
|
||||||
|
|
||||||
private static ConfigurationManager configurationManager;
|
private static ConfigurationManager configurationManager;
|
||||||
|
|
||||||
@ -62,20 +58,30 @@ public class ConfigurationManager {
|
|||||||
return configurationManager;
|
return configurationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static synchronized void setConfigLocation(String configPath) throws InvalidConfigurationException {
|
||||||
private void initConfig() throws ApplicationManagementException {
|
if (ConfigurationManager.configPath == null) {
|
||||||
try {
|
ConfigurationManager.configPath = configPath;
|
||||||
JAXBContext jaxbContext = JAXBContext.newInstance(Configurations.class);
|
} else {
|
||||||
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
throw new InvalidConfigurationException("Configuration path " + configPath + " is already defined");
|
||||||
this.configuration = (Configurations) unmarshaller.unmarshal(new File(applicationMgtConfigXMLPath));
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e);
|
|
||||||
throw new InvalidConfigurationException("Error occurred while initializing application config: "
|
|
||||||
+ applicationMgtConfigXMLPath, e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Configurations getConfiguration() {
|
private void initConfig() throws ApplicationManagementException {
|
||||||
|
try {
|
||||||
|
JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
|
||||||
|
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||||
|
if (configPath == null) {
|
||||||
|
configPath = Constants.DEFAULT_CONFIG_FILE_LOCATION;
|
||||||
|
}
|
||||||
|
this.configuration = (Configuration) unmarshaller.unmarshal(new File(configPath));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e);
|
||||||
|
throw new InvalidConfigurationException("Error occurred while initializing application config: "
|
||||||
|
+ configPath, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Configuration getConfiguration() {
|
||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,14 +16,10 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.application.mgt.core.config.extensions;
|
package org.wso2.carbon.device.application.mgt.core.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.*;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@XmlRootElement(name = "Extension")
|
@XmlRootElement(name = "Extension")
|
||||||
public class Extension {
|
public class Extension {
|
||||||
@ -43,7 +39,7 @@ public class Extension {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "ClassName", nillable = false)
|
@XmlElement(name = "ClassName")
|
||||||
public String getClassName() {
|
public String getClassName() {
|
||||||
return className;
|
return className;
|
||||||
}
|
}
|
||||||
@ -52,7 +48,8 @@ public class Extension {
|
|||||||
this.className = className;
|
this.className = className;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlElement(name = "Parameters", nillable = true)
|
@XmlElementWrapper(name = "Parameters")
|
||||||
|
@XmlElement(name = "Parameter")
|
||||||
public List<Parameter> getParameters() {
|
public List<Parameter> getParameters() {
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
@ -61,10 +58,10 @@ public class Extension {
|
|||||||
this.parameters = parameters;
|
this.parameters = parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object anotherObj){
|
public boolean equals(Object anotherObj) {
|
||||||
if (anotherObj instanceof Extension){
|
if (anotherObj instanceof Extension) {
|
||||||
Extension anExt = (Extension) anotherObj;
|
Extension anExt = (Extension) anotherObj;
|
||||||
if (anExt.getName().contentEquals(this.getName())){
|
if (anExt.getName().contentEquals(this.getName())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.application.mgt.core.config.extensions;
|
package org.wso2.carbon.device.application.mgt.core.config;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
@ -16,15 +16,14 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.application.mgt.extensions.appupload;
|
package org.wso2.carbon.device.application.mgt.core.impl;
|
||||||
|
|
||||||
|
|
||||||
import org.wso2.carbon.device.application.mgt.common.services.ApplicationUploadManager;
|
import org.wso2.carbon.device.application.mgt.common.services.ApplicationUploadManager;
|
||||||
|
|
||||||
public class AppUploadManagerImpl implements ApplicationUploadManager {
|
public class ApplicationUploadManagerImpl implements ApplicationUploadManager {
|
||||||
|
|
||||||
|
public ApplicationUploadManagerImpl(String uploadPath){
|
||||||
|
|
||||||
public AppUploadManagerImpl(String a, String b){
|
|
||||||
//do a
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.wso2.carbon.device.application.mgt.core.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.application.mgt.common.services.CategoryManager;
|
||||||
|
|
||||||
|
public class CategoryManagerImpl implements CategoryManager {
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.wso2.carbon.device.application.mgt.core.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.application.mgt.common.services.CommentsManager;
|
||||||
|
|
||||||
|
public class CommentsManagerImpl implements CommentsManager {
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.wso2.carbon.device.application.mgt.core.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.application.mgt.common.services.LifecycleStateManager;
|
||||||
|
|
||||||
|
public class LifecycleStateManagerImpl implements LifecycleStateManager {
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.wso2.carbon.device.application.mgt.core.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.application.mgt.common.services.PlatformManager;
|
||||||
|
|
||||||
|
public class PlatformManagerImpl implements PlatformManager {
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.wso2.carbon.device.application.mgt.core.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager;
|
||||||
|
|
||||||
|
public class SubscriptionManagerImpl implements SubscriptionManager {
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.wso2.carbon.device.application.mgt.core.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.application.mgt.common.services.VisibilityManager;
|
||||||
|
|
||||||
|
public class VisibilityManagerImpl implements VisibilityManager{
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.wso2.carbon.device.application.mgt.core.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.application.mgt.common.services.VisibilityTypeManager;
|
||||||
|
|
||||||
|
public class VisibilityTypeManagerImpl implements VisibilityTypeManager {
|
||||||
|
}
|
||||||
@ -23,7 +23,8 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException;
|
import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException;
|
||||||
import org.wso2.carbon.device.application.mgt.common.services.*;
|
import org.wso2.carbon.device.application.mgt.common.services.*;
|
||||||
import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
|
import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
|
||||||
import org.wso2.carbon.device.application.mgt.core.config.extensions.Extension;
|
import org.wso2.carbon.device.application.mgt.core.config.Extension;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
public class ApplicationManagementUtil {
|
public class ApplicationManagementUtil {
|
||||||
@ -90,17 +91,22 @@ public class ApplicationManagementUtil {
|
|||||||
return getInstance(extension, ApplicationUploadManager.class);
|
return getInstance(extension, ApplicationUploadManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> T getInstance(Extension extension, Class<T> cls) throws InvalidConfigurationException {
|
private static <T> T getInstance(Extension extension, Class<T> cls) throws InvalidConfigurationException {
|
||||||
try {
|
try {
|
||||||
Class theClass = Class.forName(extension.getClassName());
|
Class theClass = Class.forName(extension.getClassName());
|
||||||
Class[] types = new Class[extension.getParameters().size()];
|
Class[] types = new Class[extension.getParameters().size()];
|
||||||
Object[] paramValues = new String[extension.getParameters().size()];
|
Object[] paramValues = new String[extension.getParameters().size()];
|
||||||
for (int i = 0; i < extension.getParameters().size(); i++) {
|
if (extension.getParameters() != null && extension.getParameters().size() > 0) {
|
||||||
types[i] = String.class;
|
for (int i = 0; i < extension.getParameters().size(); i++) {
|
||||||
paramValues[i] = extension.getParameters().get(i).getValue();
|
types[i] = String.class;
|
||||||
|
paramValues[i] = extension.getParameters().get(i).getValue();
|
||||||
|
}
|
||||||
|
Constructor<T> constructor = theClass.getConstructor(types);
|
||||||
|
return constructor.newInstance(paramValues);
|
||||||
|
} else {
|
||||||
|
Constructor<T> constructor = theClass.getConstructor(types);
|
||||||
|
return constructor.newInstance();
|
||||||
}
|
}
|
||||||
Constructor<T> constructor = theClass.getConstructor(types);
|
|
||||||
return constructor.newInstance(paramValues);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new InvalidConfigurationException("Unable to get instance of extension - " + extension.getName()
|
throw new InvalidConfigurationException("Unable to get instance of extension - " + extension.getName()
|
||||||
+ " , for class - " + extension.getClassName(), e);
|
+ " , for class - " + extension.getClassName(), e);
|
||||||
|
|||||||
@ -18,14 +18,22 @@
|
|||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.application.mgt.core.util;
|
package org.wso2.carbon.device.application.mgt.core.util;
|
||||||
|
|
||||||
|
import org.wso2.carbon.utils.CarbonUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
|
|
||||||
public static final String APPLICATION_CONFIG_XML_FILE = "application-mgt.xml";
|
public static final String APPLICATION_CONFIG_XML_FILE = "application-mgt.xml";
|
||||||
|
|
||||||
|
public static final String DEFAULT_CONFIG_FILE_LOCATION = CarbonUtils.getCarbonConfigDirPath() + File.separator +
|
||||||
|
Constants.APPLICATION_CONFIG_XML_FILE;
|
||||||
|
|
||||||
public static final class DataBaseTypes {
|
public static final class DataBaseTypes {
|
||||||
|
|
||||||
private DataBaseTypes() {
|
private DataBaseTypes() {
|
||||||
throw new AssertionError();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String DB_TYPE_MYSQL = "MySQL";
|
public static final String DB_TYPE_MYSQL = "MySQL";
|
||||||
public static final String DB_TYPE_ORACLE = "Oracle";
|
public static final String DB_TYPE_ORACLE = "Oracle";
|
||||||
public static final String DB_TYPE_MSSQL = "Microsoft SQL Server";
|
public static final String DB_TYPE_MSSQL = "Microsoft SQL Server";
|
||||||
|
|||||||
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.wso2.carbon.device.application.mgt.core;
|
||||||
|
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.config.Configuration;
|
||||||
|
import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class ConfigurationTest {
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void init() throws InvalidConfigurationException {
|
||||||
|
File configPath = new File("src/test/resources/application-mgt.xml");
|
||||||
|
ConfigurationManager.setConfigLocation(configPath.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void validateConfiguration() {
|
||||||
|
ConfigurationManager configurationManager = ConfigurationManager.getInstance();
|
||||||
|
Configuration configuration = configurationManager.getConfiguration();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,16 +1,61 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
~
|
||||||
|
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
~ Version 2.0 (the "License"); you may not use this file except
|
||||||
|
~ in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing,
|
||||||
|
~ software distributed under the License is distributed on an
|
||||||
|
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
~ KIND, either express or implied. See the License for the
|
||||||
|
~ specific language governing permissions and limitations
|
||||||
|
~ under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
<ApplicationManagementConfiguration>
|
<ApplicationManagementConfiguration>
|
||||||
|
|
||||||
<!-- Application Mgt DB schema -->
|
<!-- Application Mgt DB schema -->
|
||||||
<DatasourceName>jdbc/APPM_DS</DatasourceName>
|
<DatasourceName>jdbc/APPM_DS</DatasourceName>
|
||||||
|
|
||||||
<Extensions>
|
<Extensions>
|
||||||
<Extension name="ApplicationUploadExtension">
|
<Extension name="ApplicationUploadManager">
|
||||||
<ClassName>org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManagerImpl</ClassName>
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.ApplicationUploadManagerImpl</ClassName>
|
||||||
<Parameters>
|
<Parameters>
|
||||||
<Parameter name="UploadPath">repository/resources/mobileapps</Parameter>
|
<Parameter name="UploadPath">repository/resources/mobileapps</Parameter>
|
||||||
</Parameters>
|
</Parameters>
|
||||||
</Extension>
|
</Extension>
|
||||||
|
<Extension name="ApplicationManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.ApplicationManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="ApplicationReleaseManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.ApplicationReleaseManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="CategoryManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.CategoryManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="CommentsManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.CommentsManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="LifecycleStateManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.LifecycleStateManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="PlatformManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.PlatformManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="SubscriptionManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="VisibilityManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.VisibilityManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="VisibilityTypeManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.VisibilityTypeManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
</Extensions>
|
</Extensions>
|
||||||
|
|
||||||
</ApplicationManagementConfiguration>
|
</ApplicationManagementConfiguration>
|
||||||
@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>application-mgt</artifactId>
|
<artifactId>application-mgt</artifactId>
|
||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>WSO2 Carbon - Application Management Component</name>
|
<name>WSO2 Carbon - Application Management Component</name>
|
||||||
<description>WSO2 Carbon - Application Management Component</description>
|
<description>WSO2 Carbon - Application Management Component</description>
|
||||||
@ -39,7 +38,7 @@
|
|||||||
<module>org.wso2.carbon.device.application.mgt.common</module>
|
<module>org.wso2.carbon.device.application.mgt.common</module>
|
||||||
<module>org.wso2.carbon.device.application.mgt.api</module>
|
<module>org.wso2.carbon.device.application.mgt.api</module>
|
||||||
<module>org.wso2.carbon.device.application.mgt.ui</module>
|
<module>org.wso2.carbon.device.application.mgt.ui</module>
|
||||||
<module>org.wso2.carbon.device.application.mgt.extensions</module>
|
<!--<module>org.wso2.carbon.device.application.mgt.extensions</module>-->
|
||||||
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,60 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<ApplicationManagementConfigurations>
|
<!--
|
||||||
|
~ Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
~
|
||||||
|
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
~ Version 2.0 (the "License"); you may not use this file except
|
||||||
|
~ in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing,
|
||||||
|
~ software distributed under the License is distributed on an
|
||||||
|
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
~ KIND, either express or implied. See the License for the
|
||||||
|
~ specific language governing permissions and limitations
|
||||||
|
~ under the License.
|
||||||
|
-->
|
||||||
|
<ApplicationManagementConfiguration>
|
||||||
|
|
||||||
<!-- Application Mgt DB schema -->
|
<!-- Application Mgt DB schema -->
|
||||||
<DatasourceName>jdbc/APPM_DS</DatasourceName>
|
<DatasourceName>jdbc/APPM_DS</DatasourceName>
|
||||||
|
|
||||||
<Extensions>
|
<Extensions>
|
||||||
<Extension name="ApplicationUploadExtension">
|
<Extension name="ApplicationUploadManager">
|
||||||
<ClassName>org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManagerImpl</ClassName>
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.ApplicationUploadManagerImpl</ClassName>
|
||||||
<Parameters>
|
<Parameters>
|
||||||
<Parameter name="UploadPath">repository/resources/mobileapps</Parameter>
|
<Parameter name="UploadPath">repository/resources/mobileapps</Parameter>
|
||||||
</Parameters>
|
</Parameters>
|
||||||
</Extension>
|
</Extension>
|
||||||
|
<Extension name="ApplicationManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.ApplicationManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="ApplicationReleaseManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.ApplicationReleaseManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="CategoryManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.CategoryManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="CommentsManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.CommentsManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="LifecycleStateManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.LifecycleStateManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="PlatformManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.PlatformManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="SubscriptionManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="VisibilityManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.VisibilityManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
|
<Extension name="VisibilityTypeManager">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.VisibilityTypeManagerImpl</ClassName>
|
||||||
|
</Extension>
|
||||||
</Extensions>
|
</Extensions>
|
||||||
|
|
||||||
</ApplicationManagementConfigurations>
|
</ApplicationManagementConfiguration>
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
~ Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
~ Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
~
|
~
|
||||||
~ WSO2 Inc. licenses this file to you under the Apache License,
|
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
~ Version 2.0 (the "License"); you may not use this file except
|
~ Version 2.0 (the "License"); you may not use this file except
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user