mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Changes to App Management Externsions Framework
This commit is contained in:
parent
c89491b93e
commit
9343032c88
@ -166,6 +166,11 @@
|
|||||||
<artifactId>org.wso2.carbon.device.application.mgt.common</artifactId>
|
<artifactId>org.wso2.carbon.device.application.mgt.common</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.application.mgt.extensions</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.swagger</groupId>
|
<groupId>io.swagger</groupId>
|
||||||
<artifactId>swagger-annotations</artifactId>
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import org.wso2.carbon.device.application.mgt.common.ApplicationList;
|
|||||||
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager;
|
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager;
|
||||||
import org.wso2.carbon.device.application.mgt.api.util.ApplicationMgtAPIUtil;
|
import org.wso2.carbon.device.application.mgt.api.util.ApplicationMgtAPIUtil;
|
||||||
import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory;
|
import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory;
|
||||||
|
import org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManager;
|
||||||
|
|
||||||
import javax.ws.rs.*;
|
import javax.ws.rs.*;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
@ -39,6 +40,8 @@ public class ApplicationManagementAPIImpl {
|
|||||||
|
|
||||||
public static final int DEFAULT_LIMIT = 20;
|
public static final int DEFAULT_LIMIT = 20;
|
||||||
|
|
||||||
|
public static final String APPLICATION_UPLOAD_EXTENSION = "ApplicationUploadExtension";
|
||||||
|
|
||||||
private static Log log = LogFactory.getLog(ApplicationManagementAPIImpl.class);
|
private static Log log = LogFactory.getLog(ApplicationManagementAPIImpl.class);
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +53,10 @@ public class ApplicationManagementAPIImpl {
|
|||||||
ApplicationManagementServiceFactory serviceFactory = ApplicationMgtAPIUtil.getApplicationManagementServiceFactory();
|
ApplicationManagementServiceFactory serviceFactory = ApplicationMgtAPIUtil.getApplicationManagementServiceFactory();
|
||||||
ApplicationManager applicationManager = (ApplicationManager) serviceFactory
|
ApplicationManager applicationManager = (ApplicationManager) serviceFactory
|
||||||
.getApplicationManagementService(APPLICATION_MANAGER);
|
.getApplicationManagementService(APPLICATION_MANAGER);
|
||||||
|
|
||||||
|
AppUploadManager appUploadManager = (AppUploadManager) serviceFactory
|
||||||
|
.applicationManagementExtensionsService(APPLICATION_UPLOAD_EXTENSION);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (limit == 0) {
|
if (limit == 0) {
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* 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.common.services;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public abstract class ApplicationManagementExtension {
|
||||||
|
|
||||||
|
private Map<String, String> parameters;
|
||||||
|
|
||||||
|
|
||||||
|
public Map<String, String> getParameters() {
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParameters(Map<String, String> parameters) {
|
||||||
|
this.parameters = parameters;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -70,6 +70,7 @@ public class ApplicationConfigurationManager {
|
|||||||
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||||
this.applicationManagerConfiguration = (ApplicationManagementConfigurations) unmarshaller.unmarshal(doc);
|
this.applicationManagerConfiguration = (ApplicationManagementConfigurations) unmarshaller.unmarshal(doc);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error(e);
|
||||||
throw new ApplicationManagerException("Error occurred while initializing application config", e);
|
throw new ApplicationManagerException("Error occurred while initializing application config", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
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.ExtensionsConfig;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
@ -26,6 +28,8 @@ public class ApplicationManagementConfigurations {
|
|||||||
|
|
||||||
private ApplicationManagementRepository applicationManagerRepository;
|
private ApplicationManagementRepository applicationManagerRepository;
|
||||||
|
|
||||||
|
private ExtensionsConfig extensionsConfig;
|
||||||
|
|
||||||
@XmlElement(name = "ManagementRepository", required = true)
|
@XmlElement(name = "ManagementRepository", required = true)
|
||||||
public ApplicationManagementRepository getApplicationManagerRepository() {
|
public ApplicationManagementRepository getApplicationManagerRepository() {
|
||||||
return applicationManagerRepository;
|
return applicationManagerRepository;
|
||||||
@ -34,6 +38,15 @@ public class ApplicationManagementConfigurations {
|
|||||||
public void setApplicationManagerRepository(ApplicationManagementRepository applicationManagerRepository) {
|
public void setApplicationManagerRepository(ApplicationManagementRepository applicationManagerRepository) {
|
||||||
this.applicationManagerRepository = applicationManagerRepository;
|
this.applicationManagerRepository = applicationManagerRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "ExtensionsConfig", required = false)
|
||||||
|
public ExtensionsConfig getExtensionsConfig() {
|
||||||
|
return extensionsConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtensionsConfig(ExtensionsConfig extensionsConfig) {
|
||||||
|
this.extensionsConfig = extensionsConfig;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ public class JNDILookupDefinition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@XmlElementWrapper(name = "Environment", nillable = false)
|
@XmlElementWrapper(name = "Environment", nillable = false)
|
||||||
@XmlElement(name = "Property", nillable = false)
|
@XmlElement(name = "Parameters", nillable = false)
|
||||||
public List<JNDIProperty> getJndiProperties() {
|
public List<JNDIProperty> getJndiProperties() {
|
||||||
return jndiProperties;
|
return jndiProperties;
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ public class JNDILookupDefinition {
|
|||||||
this.jndiProperties = jndiProperties;
|
this.jndiProperties = jndiProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlRootElement(name = "Property")
|
@XmlRootElement(name = "Parameters")
|
||||||
public static class JNDIProperty {
|
public static class JNDIProperty {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|||||||
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* 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.config.extensions;
|
||||||
|
|
||||||
|
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 java.util.Map;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "Extension")
|
||||||
|
public class Extension {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String className;
|
||||||
|
|
||||||
|
private Map<String, String> parameters;
|
||||||
|
|
||||||
|
@XmlAttribute(name = "name")
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "ClassName", nillable = true)
|
||||||
|
public String getClassName() {
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassName(String className) {
|
||||||
|
this.className = className;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "Parameters", nillable = true)
|
||||||
|
@XmlJavaTypeAdapter(ParameterAdapter.class)
|
||||||
|
public Map<String, String> getParameters() {
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParameters(Map<String, String> parameters) {
|
||||||
|
this.parameters = parameters;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* 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.config.extensions;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "Extensions")
|
||||||
|
public class Extensions {
|
||||||
|
|
||||||
|
private List<Extension> extensions;
|
||||||
|
|
||||||
|
|
||||||
|
@XmlElement(name = "Extension")
|
||||||
|
public List<Extension> getExtensions() {
|
||||||
|
return extensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtensions(List<Extension> extensions) {
|
||||||
|
this.extensions = extensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Extension getExtensionByName(String extensionName) {
|
||||||
|
if (extensions != null) {
|
||||||
|
for (Extension extension : extensions) {
|
||||||
|
if(extension.getName().equals(extensionName)) {
|
||||||
|
return extension;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* 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.config.extensions;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "ExtensionsConfig")
|
||||||
|
public class ExtensionsConfig {
|
||||||
|
|
||||||
|
private Extensions extensions;
|
||||||
|
|
||||||
|
@XmlElement(name = "Extensions", nillable = true)
|
||||||
|
public Extensions getExtensions() {
|
||||||
|
return extensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtensions(Extensions extensions) {
|
||||||
|
this.extensions = extensions;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* 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.config.extensions;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlValue;
|
||||||
|
|
||||||
|
public class Parameter {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
Parameter(String name, String value) {
|
||||||
|
this.name = name;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Parameter(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlAttribute(name = "name")
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlValue
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* 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.config.extensions;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
import javax.xml.bind.annotation.XmlValue;
|
||||||
|
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
class ParameterAdapter extends XmlAdapter<Parameters, Map<String, String>> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> unmarshal(Parameters in) throws Exception {
|
||||||
|
HashMap<String, String> hashMap = new HashMap<>();
|
||||||
|
for (Parameter parameter : in.getParameters()) {
|
||||||
|
hashMap.put(parameter.getName(), parameter.getValue());
|
||||||
|
}
|
||||||
|
return hashMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Parameters marshal(Map<String, String> map) throws Exception {
|
||||||
|
Parameters parameters = new Parameters();
|
||||||
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||||
|
parameters.addEntry(new Parameter(entry.getKey(), entry.getValue()));
|
||||||
|
}
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* 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.config.extensions;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "Parameters")
|
||||||
|
public class Parameters {
|
||||||
|
|
||||||
|
private List<Parameter> parameters = new ArrayList<>();;
|
||||||
|
|
||||||
|
@XmlElement(name = "Parameter", nillable = true)
|
||||||
|
public List<Parameter> getParameters() {
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParameters(List<Parameter> parameters) {
|
||||||
|
this.parameters = parameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
void addEntry(Parameter parameter) {
|
||||||
|
parameters.add(parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -20,19 +20,15 @@ package org.wso2.carbon.device.application.mgt.core.services.impl;
|
|||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
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.DBConnectionException;
|
|
||||||
import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException;
|
|
||||||
import org.wso2.carbon.device.application.mgt.common.Application;
|
|
||||||
import org.wso2.carbon.device.application.mgt.common.ApplicationList;
|
|
||||||
import org.wso2.carbon.device.application.mgt.common.Filter;
|
|
||||||
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.dao.ApplicationDAO;
|
import org.wso2.carbon.device.application.mgt.core.config.ApplicationConfigurationManager;
|
||||||
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException;
|
import org.wso2.carbon.device.application.mgt.core.config.extensions.Extension;
|
||||||
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory;
|
import org.wso2.carbon.device.application.mgt.core.config.extensions.ExtensionsConfig;
|
||||||
import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil;
|
|
||||||
|
|
||||||
public class ApplicationManagementServiceFactory {
|
public class ApplicationManagementServiceFactory {
|
||||||
|
|
||||||
|
private static Log log = LogFactory.getLog(ApplicationManagementServiceFactory.class);
|
||||||
|
|
||||||
public enum ManagerService {
|
public enum ManagerService {
|
||||||
APPLICATION_MANAGER,
|
APPLICATION_MANAGER,
|
||||||
APPLICATION_RELEASE_MANAGER,
|
APPLICATION_RELEASE_MANAGER,
|
||||||
@ -55,4 +51,30 @@ public class ApplicationManagementServiceFactory {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ApplicationManagementExtension applicationManagementExtensionsService(String extensionName) {
|
||||||
|
ApplicationConfigurationManager applicationConfigurationManager = ApplicationConfigurationManager.getInstance();
|
||||||
|
|
||||||
|
ExtensionsConfig extensionConfig = applicationConfigurationManager
|
||||||
|
.getApplicationManagerConfiguration().getExtensionsConfig();
|
||||||
|
|
||||||
|
Extension extension = extensionConfig.getExtensions().getExtensionByName(extensionName);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class<?> theClass = Class.forName(extension.getClassName());
|
||||||
|
ApplicationManagementExtension appManagementExtension = (ApplicationManagementExtension) theClass.newInstance();
|
||||||
|
appManagementExtension.setParameters(extension.getParameters());
|
||||||
|
return appManagementExtension;
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
log.error("Class not Found", e);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
log.error("Illegal Access of Class", e);
|
||||||
|
} catch (InstantiationException e) {
|
||||||
|
log.error("Class instantiation exception", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,10 +49,7 @@
|
|||||||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||||
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||||
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
||||||
<Bundle-Description>Application Management Core Bundle</Bundle-Description>
|
<Bundle-Description>Application Management Extensions Bundle</Bundle-Description>
|
||||||
<Private-Package>
|
|
||||||
org.wso2.carbon.device.application.mgt.core.internal
|
|
||||||
</Private-Package>
|
|
||||||
<Import-Package>
|
<Import-Package>
|
||||||
org.osgi.framework,
|
org.osgi.framework,
|
||||||
org.osgi.service.component,
|
org.osgi.service.component,
|
||||||
@ -73,8 +70,7 @@
|
|||||||
org.wso2.carbon.device.mgt.common.*,
|
org.wso2.carbon.device.mgt.common.*,
|
||||||
</Import-Package>
|
</Import-Package>
|
||||||
<Export-Package>
|
<Export-Package>
|
||||||
!org.wso2.carbon.device.application.mgt.core.internal.*,
|
org.wso2.carbon.device.application.mgt.extensions.*
|
||||||
org.wso2.carbon.device.application.mgt.core.*
|
|
||||||
</Export-Package>
|
</Export-Package>
|
||||||
</instructions>
|
</instructions>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@ -16,8 +16,10 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.application.mgt.common.services;
|
package org.wso2.carbon.device.application.mgt.extensions.appupload;
|
||||||
|
|
||||||
public interface ApplicationManagementExtensionsService {
|
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService;
|
||||||
|
|
||||||
|
public interface AppUploadManager {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -16,13 +16,10 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.wso2.carbon.device.application.mgt.core.dao.common;
|
package org.wso2.carbon.device.application.mgt.extensions.appupload;
|
||||||
|
|
||||||
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementExtensionsService;
|
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementExtension;
|
||||||
|
|
||||||
public class ApplicationManagementExtensionsFactory {
|
public class AppUploadManagerImpl extends ApplicationManagementExtension implements AppUploadManager {
|
||||||
|
|
||||||
public ApplicationManagementExtensionsService getExtensionsService(Class managerClass) throws Exception {
|
|
||||||
return (ApplicationManagementExtensionsService) managerClass.newInstance();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -10,4 +10,16 @@
|
|||||||
</DataSourceConfiguration>
|
</DataSourceConfiguration>
|
||||||
</ManagementRepository>
|
</ManagementRepository>
|
||||||
|
|
||||||
|
|
||||||
|
<ExtensionsConfig>
|
||||||
|
<Extensions>
|
||||||
|
<Extension name="ApplicationUploadExtension">
|
||||||
|
<ClassName>org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManagerImpl</ClassName>
|
||||||
|
<Parameters>
|
||||||
|
<Parameter name="UploadPath">repository/resources/mobileapps</Parameter>
|
||||||
|
</Parameters>
|
||||||
|
</Extension>
|
||||||
|
</Extensions>
|
||||||
|
</ExtensionsConfig>
|
||||||
|
|
||||||
</ApplicationManagementConfigurations>
|
</ApplicationManagementConfigurations>
|
||||||
Loading…
Reference in New Issue
Block a user