diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml
index 1f5bee530d7..f40fb228136 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml
@@ -80,19 +80,11 @@
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.18
-
-
- file:src/test/resources/log4j.properties
-
-
- src/test/resources/testng.xml
-
-
-
+
+
+
+
+
@@ -114,6 +106,11 @@
org.testng
testng
+
+ junit
+ junit
+ test
+
org.wso2.carbon
org.wso2.carbon.logging
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configurations.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configuration.java
similarity index 75%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configurations.java
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configuration.java
index 1fa2d87fb7a..b41501c7a3d 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configurations.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configuration.java
@@ -18,17 +18,19 @@
*/
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.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
@XmlRootElement(name = "ApplicationManagementConfiguration")
-public class Configurations {
+public class Configuration {
private String datasourceName;
- private List extensionsConfig;
+ private List extensions;
@XmlElement(name = "DatasourceName", required = true)
public String getDatasourceName() {
@@ -39,13 +41,14 @@ public class Configurations {
this.datasourceName = datasourceName;
}
- @XmlElement(name = "Extensions", required = false)
+ @XmlElementWrapper(name = "Extensions")
+ @XmlElement(name = "Extension")
public List getExtensions() {
- return extensionsConfig;
+ return extensions;
}
- public void setExtensionsConfig(List extensionsConfig) {
- this.extensionsConfig = extensionsConfig;
+ public void setExtensions(List extensions) {
+ this.extensions = extensions;
}
}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java
index f1502021d1a..d81240e5737 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java
@@ -22,9 +22,7 @@ import org.apache.commons.logging.Log;
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.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.utils.CarbonUtils;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
@@ -32,13 +30,11 @@ import java.io.File;
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 Configurations configuration;
+ private Configuration configuration;
+ private static String configPath;
private static ConfigurationManager configurationManager;
@@ -62,20 +58,30 @@ public class ConfigurationManager {
return configurationManager;
}
+ public static synchronized void setConfigLocation(String configPath) throws InvalidConfigurationException {
+ if (ConfigurationManager.configPath == null) {
+ ConfigurationManager.configPath = configPath;
+ } else {
+ throw new InvalidConfigurationException("Configuration path " + configPath + " is already defined");
+ }
+ }
private void initConfig() throws ApplicationManagementException {
try {
- JAXBContext jaxbContext = JAXBContext.newInstance(Configurations.class);
+ JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- this.configuration = (Configurations) unmarshaller.unmarshal(new File(applicationMgtConfigXMLPath));
+ 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: "
- + applicationMgtConfigXMLPath, e);
+ + configPath, e);
}
}
- public Configurations getConfiguration() {
+ public Configuration getConfiguration() {
return configuration;
}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java
similarity index 76%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java
index 5429b8beac7..dc49eb60baf 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java
@@ -16,14 +16,10 @@
* 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.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.bind.annotation.*;
import java.util.List;
-import java.util.Map;
@XmlRootElement(name = "Extension")
public class Extension {
@@ -43,7 +39,7 @@ public class Extension {
this.name = name;
}
- @XmlElement(name = "ClassName", nillable = false)
+ @XmlElement(name = "ClassName")
public String getClassName() {
return className;
}
@@ -52,7 +48,8 @@ public class Extension {
this.className = className;
}
- @XmlElement(name = "Parameters", nillable = true)
+ @XmlElementWrapper(name = "Parameters")
+ @XmlElement(name = "Parameter")
public List getParameters() {
return parameters;
}
@@ -61,10 +58,10 @@ public class Extension {
this.parameters = parameters;
}
- public boolean equals(Object anotherObj){
- if (anotherObj instanceof Extension){
+ public boolean equals(Object anotherObj) {
+ if (anotherObj instanceof Extension) {
Extension anExt = (Extension) anotherObj;
- if (anExt.getName().contentEquals(this.getName())){
+ if (anExt.getName().contentEquals(this.getName())) {
return true;
}
}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Parameter.java
similarity index 94%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Parameter.java
index dbea52df573..12283e46a04 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Parameter.java
@@ -16,7 +16,7 @@
* 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.XmlRootElement;
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationUploadManagerImpl.java
similarity index 79%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationUploadManagerImpl.java
index 51fcbfaff6c..38b908c00dd 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationUploadManagerImpl.java
@@ -16,15 +16,14 @@
* 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;
-public class AppUploadManagerImpl implements ApplicationUploadManager {
+public class ApplicationUploadManagerImpl implements ApplicationUploadManager {
- public AppUploadManagerImpl(String a, String b){
- //do a
- }
+ public ApplicationUploadManagerImpl(String uploadPath){
+ }
}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java
new file mode 100644
index 00000000000..e245186b1a2
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java
@@ -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 {
+}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java
new file mode 100644
index 00000000000..fbecc5a7eb0
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java
@@ -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 {
+}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/LifecycleStateManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/LifecycleStateManagerImpl.java
new file mode 100644
index 00000000000..2c71738f40d
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/LifecycleStateManagerImpl.java
@@ -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 {
+}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformManagerImpl.java
new file mode 100644
index 00000000000..52c302fde64
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformManagerImpl.java
@@ -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 {
+}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java
new file mode 100644
index 00000000000..d0f3433fb61
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java
@@ -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 {
+}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java
new file mode 100644
index 00000000000..315d3c6122d
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java
@@ -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{
+}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityTypeManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityTypeManagerImpl.java
new file mode 100644
index 00000000000..5396a670006
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityTypeManagerImpl.java
@@ -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 {
+}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java
index 842958ffb18..070e57f1c81 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java
@@ -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.services.*;
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;
public class ApplicationManagementUtil {
@@ -90,17 +91,22 @@ public class ApplicationManagementUtil {
return getInstance(extension, ApplicationUploadManager.class);
}
- private static T getInstance(Extension extension, Class cls) throws InvalidConfigurationException {
+ private static T getInstance(Extension extension, Class cls) throws InvalidConfigurationException {
try {
- Class theClass = Class.forName(extension.getClassName());
+ Class theClass = Class.forName(extension.getClassName());
Class[] types = new Class[extension.getParameters().size()];
Object[] paramValues = new String[extension.getParameters().size()];
- for (int i = 0; i < extension.getParameters().size(); i++) {
- types[i] = String.class;
- paramValues[i] = extension.getParameters().get(i).getValue();
+ if (extension.getParameters() != null && extension.getParameters().size() > 0) {
+ for (int i = 0; i < extension.getParameters().size(); i++) {
+ types[i] = String.class;
+ paramValues[i] = extension.getParameters().get(i).getValue();
+ }
+ Constructor constructor = theClass.getConstructor(types);
+ return constructor.newInstance(paramValues);
+ } else {
+ Constructor constructor = theClass.getConstructor(types);
+ return constructor.newInstance();
}
- Constructor constructor = theClass.getConstructor(types);
- return constructor.newInstance(paramValues);
} catch (Exception e) {
throw new InvalidConfigurationException("Unable to get instance of extension - " + extension.getName()
+ " , for class - " + extension.getClassName(), e);
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java
index 27f3e763d9a..6ed1fe951a7 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java
@@ -18,14 +18,22 @@
*/
package org.wso2.carbon.device.application.mgt.core.util;
+import org.wso2.carbon.utils.CarbonUtils;
+
+import java.io.File;
+
public class Constants {
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 {
+
private DataBaseTypes() {
- throw new AssertionError();
}
+
public static final String DB_TYPE_MYSQL = "MySQL";
public static final String DB_TYPE_ORACLE = "Oracle";
public static final String DB_TYPE_MSSQL = "Microsoft SQL Server";
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ConfigurationTest.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ConfigurationTest.java
new file mode 100644
index 00000000000..4040237b078
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ConfigurationTest.java
@@ -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();
+ }
+}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml
index eec845ef7ef..c2cac418578 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml
@@ -1,16 +1,61 @@
+
+
jdbc/APPM_DS
-
- org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManagerImpl
+
+ org.wso2.carbon.device.application.mgt.core.impl.ApplicationUploadManagerImpl
repository/resources/mobileapps
+
+ org.wso2.carbon.device.application.mgt.core.impl.ApplicationManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.ApplicationReleaseManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.CategoryManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.CommentsManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.LifecycleStateManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.PlatformManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.VisibilityManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.VisibilityTypeManagerImpl
+
\ No newline at end of file
diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml
index 478fd3f5df3..043f32a6943 100644
--- a/components/application-mgt/pom.xml
+++ b/components/application-mgt/pom.xml
@@ -28,7 +28,6 @@
4.0.0
application-mgt
- org.wso2.carbon.devicemgt
pom
WSO2 Carbon - Application Management Component
WSO2 Carbon - Application Management Component
@@ -39,7 +38,7 @@
org.wso2.carbon.device.application.mgt.common
org.wso2.carbon.device.application.mgt.api
org.wso2.carbon.device.application.mgt.ui
- org.wso2.carbon.device.application.mgt.extensions
+
diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml
index bc148ab0d8c..fd99ffe3de8 100644
--- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml
+++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml
@@ -1,16 +1,60 @@
-
+
+
jdbc/APPM_DS
-
- org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManagerImpl
+
+ org.wso2.carbon.device.application.mgt.core.impl.ApplicationUploadManagerImpl
repository/resources/mobileapps
+
+ org.wso2.carbon.device.application.mgt.core.impl.ApplicationManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.ApplicationReleaseManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.CategoryManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.CommentsManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.LifecycleStateManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.PlatformManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.VisibilityManagerImpl
+
+
+ org.wso2.carbon.device.application.mgt.core.impl.VisibilityTypeManagerImpl
+
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml
index e773738c3bd..7038d24c55d 100644
--- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml
+++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml
@@ -1,5 +1,5 @@