forked from community/device-mgt-core
commit
6994d4bf57
@ -1,44 +0,0 @@
|
||||
/*
|
||||
* 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.api;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
public class APIOriginFilter implements Filter {
|
||||
|
||||
//TODO: check no config option.
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
HttpServletResponse res = (HttpServletResponse) response;
|
||||
res.addHeader("Access-Control-Allow-Origin", "*");
|
||||
res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
|
||||
res.addHeader("Access-Control-Allow-Headers", "Content-Type");
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import org.wso2.carbon.device.application.mgt.common.jaxrs.Exclude;
|
||||
|
||||
public class ApplicationType {
|
||||
|
||||
@Exclude
|
||||
private int id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String code;
|
||||
|
||||
private String parameters;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public void setParameters(String parameters) {
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Lifecycle {
|
||||
|
||||
private LifecycleState lifecycleState;
|
||||
|
||||
private Date lifecycleStateModifiedAt;
|
||||
|
||||
private Date getLifecycleStateModifiedBy;
|
||||
|
||||
public LifecycleState getLifecycleState() {
|
||||
return lifecycleState;
|
||||
}
|
||||
|
||||
public void setLifecycleState(LifecycleState lifecycleState) {
|
||||
this.lifecycleState = lifecycleState;
|
||||
}
|
||||
|
||||
public Date getLifecycleStateModifiedAt() {
|
||||
return lifecycleStateModifiedAt;
|
||||
}
|
||||
|
||||
public void setLifecycleStateModifiedAt(Date lifecycleStateModifiedAt) {
|
||||
this.lifecycleStateModifiedAt = lifecycleStateModifiedAt;
|
||||
}
|
||||
|
||||
public Date getGetLifecycleStateModifiedBy() {
|
||||
return getLifecycleStateModifiedBy;
|
||||
}
|
||||
|
||||
public void setGetLifecycleStateModifiedBy(Date getLifecycleStateModifiedBy) {
|
||||
this.getLifecycleStateModifiedBy = getLifecycleStateModifiedBy;
|
||||
}
|
||||
}
|
@ -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.common;
|
||||
|
||||
public class Payment {
|
||||
private boolean freeApp;
|
||||
|
||||
private String paymentCurrency;
|
||||
|
||||
private Float paymentPrice;
|
||||
|
||||
public boolean isFreeApp() {
|
||||
return freeApp;
|
||||
}
|
||||
|
||||
public void setFreeApp(boolean freeApp) {
|
||||
this.freeApp = freeApp;
|
||||
}
|
||||
|
||||
public String getPaymentCurrency() {
|
||||
return paymentCurrency;
|
||||
}
|
||||
|
||||
public void setPaymentCurrency(String paymentCurrency) {
|
||||
this.paymentCurrency = paymentCurrency;
|
||||
}
|
||||
|
||||
public Float getPaymentPrice() {
|
||||
return paymentPrice;
|
||||
}
|
||||
|
||||
public void setPaymentPrice(Float paymentPrice) {
|
||||
this.paymentPrice = paymentPrice;
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
public class ResourceType {
|
||||
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
3
components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementService.java → components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationUploadManager.java
3
components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementService.java → components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationUploadManager.java
@ -1,22 +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.
|
||||
*
|
||||
*/
|
||||
* 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;
|
||||
|
||||
public interface VisibilityManager extends ApplicationManagementService {
|
||||
public interface VisibilityManager {
|
||||
|
||||
}
|
||||
|
2
components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ResourceTypeManager.java → components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityTypeManager.java
2
components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ResourceTypeManager.java → components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityTypeManager.java
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.w3c.dom.Document;
|
||||
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.util.ApplicationManagementUtil;
|
||||
import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagerConstants;
|
||||
import org.wso2.carbon.utils.CarbonUtils;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import java.io.File;
|
||||
|
||||
public class ApplicationConfigurationManager {
|
||||
|
||||
private final String applicationMgtConfigXMLPath = CarbonUtils.getCarbonConfigDirPath() + File.separator +
|
||||
ApplicationManagerConstants.APPLICATION_CONFIG_XML_FILE;
|
||||
|
||||
private static final Log log = LogFactory.getLog(ApplicationConfigurationManager.class);
|
||||
|
||||
private ApplicationManagementConfigurations applicationManagerConfiguration;
|
||||
|
||||
|
||||
private static ApplicationConfigurationManager applicationConfigurationManager;
|
||||
|
||||
private ApplicationConfigurationManager() {
|
||||
|
||||
}
|
||||
|
||||
public static ApplicationConfigurationManager getInstance() {
|
||||
if (applicationConfigurationManager == null) {
|
||||
applicationConfigurationManager = new ApplicationConfigurationManager();
|
||||
try {
|
||||
applicationConfigurationManager.initConfig();
|
||||
} catch (ApplicationManagementException e) {
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
return applicationConfigurationManager;
|
||||
}
|
||||
|
||||
|
||||
public synchronized void initConfig() throws ApplicationManagementException {
|
||||
try {
|
||||
File appMgtConfig = new File(applicationMgtConfigXMLPath);
|
||||
Document doc = ApplicationManagementUtil.convertToDocument(appMgtConfig);
|
||||
|
||||
/* Un-marshaling Certificate Management configuration */
|
||||
JAXBContext jaxbContext = JAXBContext.newInstance(ApplicationManagementConfigurations.class);
|
||||
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
|
||||
this.applicationManagerConfiguration = (ApplicationManagementConfigurations) unmarshaller.unmarshal(doc);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
throw new InvalidConfigurationException("Error occurred while initializing application config", e);
|
||||
}
|
||||
}
|
||||
|
||||
public ApplicationManagementConfigurations getApplicationManagerConfiguration() {
|
||||
return applicationManagerConfiguration;
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import org.wso2.carbon.device.application.mgt.core.config.extensions.ExtensionsConfig;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "ApplicationManagementConfigurations")
|
||||
public class ApplicationManagementConfigurations {
|
||||
|
||||
private ApplicationManagementRepository applicationManagerRepository;
|
||||
|
||||
private ExtensionsConfig extensionsConfig;
|
||||
|
||||
@XmlElement(name = "ManagementRepository", required = true)
|
||||
public ApplicationManagementRepository getApplicationManagerRepository() {
|
||||
return applicationManagerRepository;
|
||||
}
|
||||
|
||||
public void setApplicationManagerRepository(ApplicationManagementRepository applicationManagerRepository) {
|
||||
this.applicationManagerRepository = applicationManagerRepository;
|
||||
}
|
||||
|
||||
@XmlElement(name = "ExtensionsConfig", required = false)
|
||||
public ExtensionsConfig getExtensionsConfig() {
|
||||
return extensionsConfig;
|
||||
}
|
||||
|
||||
public void setExtensionsConfig(ExtensionsConfig extensionsConfig) {
|
||||
this.extensionsConfig = extensionsConfig;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
|
||||
import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "ManagementRepository")
|
||||
public class ApplicationManagementRepository {
|
||||
|
||||
private DataSourceConfig dataSourceConfig;
|
||||
|
||||
@XmlElement(name = "DataSourceConfiguration", required = true)
|
||||
public DataSourceConfig getDataSourceConfig() {
|
||||
return dataSourceConfig;
|
||||
}
|
||||
|
||||
public void setDataSourceConfig(DataSourceConfig dataSourceConfig) {
|
||||
this.dataSourceConfig = dataSourceConfig;
|
||||
}
|
||||
}
|
36
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extensions.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configuration.java
36
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extensions.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configuration.java
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
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.util.Constants;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import java.io.File;
|
||||
|
||||
public class ConfigurationManager {
|
||||
|
||||
private static final Log log = LogFactory.getLog(ConfigurationManager.class);
|
||||
|
||||
private Configuration configuration;
|
||||
|
||||
private static String configPath;
|
||||
|
||||
private static ConfigurationManager configurationManager;
|
||||
|
||||
private ConfigurationManager() {
|
||||
|
||||
}
|
||||
|
||||
public static ConfigurationManager getInstance() {
|
||||
if (configurationManager == null) {
|
||||
synchronized (ConfigurationManager.class) {
|
||||
if (configurationManager == null) {
|
||||
configurationManager = new ConfigurationManager();
|
||||
try {
|
||||
configurationManager.initConfig();
|
||||
} catch (ApplicationManagementException e) {
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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(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;
|
||||
}
|
||||
|
||||
public Extension getExtension(Extension.Name extName) throws InvalidConfigurationException {
|
||||
for (Extension extension : configuration.getExtensions()) {
|
||||
if (extension.getName().contentEquals(extName.toString())) {
|
||||
return extension;
|
||||
}
|
||||
}
|
||||
throw new InvalidConfigurationException("Expecting an extension with name - " + extName + " , but not found!");
|
||||
}
|
||||
}
|
45
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java
45
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java
13
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Parameter.java
13
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Parameter.java
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.datasource;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* Class for holding data source configuration in cdm-config.xml at parsing with JAXB
|
||||
*/
|
||||
@XmlRootElement(name = "DataSourceConfiguration")
|
||||
public class DataSourceConfig {
|
||||
|
||||
private JNDILookupDefinition jndiLookupDefinition;
|
||||
|
||||
@XmlElement(name = "JndiLookupDefinition", nillable = true)
|
||||
public JNDILookupDefinition getJndiLookupDefinition() {
|
||||
return jndiLookupDefinition;
|
||||
}
|
||||
|
||||
public void setJndiLookupDefinition(JNDILookupDefinition jndiLookupDefinition) {
|
||||
this.jndiLookupDefinition = jndiLookupDefinition;
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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.datasource;
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Class for hold JndiLookupDefinition of cdm-config.xml at parsing with JAXB
|
||||
*/
|
||||
@XmlRootElement(name = "JndiLookupDefinition")
|
||||
public class JNDILookupDefinition {
|
||||
|
||||
private String jndiName;
|
||||
private List<JNDIProperty> jndiProperties;
|
||||
|
||||
@XmlElement(name = "Name", nillable = false)
|
||||
public String getJndiName() {
|
||||
return jndiName;
|
||||
}
|
||||
|
||||
public void setJndiName(String jndiName) {
|
||||
this.jndiName = jndiName;
|
||||
}
|
||||
|
||||
@XmlElementWrapper(name = "Environment", nillable = false)
|
||||
@XmlElement(name = "Parameters", nillable = false)
|
||||
public List<JNDIProperty> getJndiProperties() {
|
||||
return jndiProperties;
|
||||
}
|
||||
|
||||
public void setJndiProperties(List<JNDIProperty> jndiProperties) {
|
||||
this.jndiProperties = jndiProperties;
|
||||
}
|
||||
|
||||
@XmlRootElement(name = "Parameters")
|
||||
public static class JNDIProperty {
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* 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
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java
20
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java
8
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOUtil.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java
8
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOUtil.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java
2
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOException.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/ApplicationManagementDAOException.java
2
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOException.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/ApplicationManagementDAOException.java
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.exception;
|
||||
|
||||
public class KeystoreException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = -8935640983869122660L;
|
||||
private String errorMessage;
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public KeystoreException(String msg, Exception nestedEx) {
|
||||
super(msg, nestedEx);
|
||||
setErrorMessage(msg);
|
||||
}
|
||||
|
||||
public KeystoreException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
setErrorMessage(message);
|
||||
}
|
||||
|
||||
public KeystoreException(String msg) {
|
||||
super(msg);
|
||||
setErrorMessage(msg);
|
||||
}
|
||||
|
||||
public KeystoreException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public KeystoreException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
8
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java
8
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java
2
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationReleaseManagerImpl.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationReleaseManagerImpl.java
2
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationReleaseManagerImpl.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationReleaseManagerImpl.java
10
components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManager.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationUploadManagerImpl.java
10
components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManager.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationUploadManagerImpl.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 {
|
||||
}
|
@ -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 {
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* 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.internal;
|
||||
|
||||
import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory;
|
||||
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
||||
|
||||
public class ApplicationManagementDataHolder {
|
||||
|
||||
private DeviceManagementProviderService deviceManagementService;
|
||||
private ApplicationManagementServiceFactory applicationManagementServiceFactory;
|
||||
|
||||
private static final ApplicationManagementDataHolder applicationMgtDataHolder = new ApplicationManagementDataHolder();
|
||||
|
||||
private ApplicationManagementDataHolder() {
|
||||
|
||||
}
|
||||
|
||||
public static ApplicationManagementDataHolder getInstance() {
|
||||
return applicationMgtDataHolder;
|
||||
}
|
||||
|
||||
public DeviceManagementProviderService getDeviceManagementService() {
|
||||
return deviceManagementService;
|
||||
}
|
||||
|
||||
public void setDeviceManagementService(DeviceManagementProviderService deviceManagementService) {
|
||||
this.deviceManagementService = deviceManagementService;
|
||||
}
|
||||
|
||||
public ApplicationManagementServiceFactory getApplicationManagementServiceFactory() {
|
||||
return applicationManagementServiceFactory;
|
||||
}
|
||||
|
||||
public void setApplicationManagementServiceFactory(ApplicationManagementServiceFactory applicationManagementServiceFactory) {
|
||||
this.applicationManagementServiceFactory = applicationManagementServiceFactory;
|
||||
}
|
||||
|
||||
public static ApplicationManagementDataHolder getApplicationMgtDataHolder() {
|
||||
return applicationMgtDataHolder;
|
||||
}
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* 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.internal;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService;
|
||||
import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory;
|
||||
import org.wso2.carbon.device.application.mgt.core.config.ApplicationConfigurationManager;
|
||||
import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig;
|
||||
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
|
||||
/**
|
||||
* @scr.component name="org.wso2.carbon.application.mgt.service" immediate="true"
|
||||
* @scr.reference name="org.wso2.carbon.device.manager"
|
||||
* interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService"
|
||||
* cardinality="1..1"
|
||||
* policy="dynamic"
|
||||
* bind="setDeviceManagementService"
|
||||
* unbind="unsetDeviceManagementService"
|
||||
*/
|
||||
public class ApplicationManagementServiceComponent {
|
||||
|
||||
private static Log log = LogFactory.getLog(ApplicationManagementServiceComponent.class);
|
||||
|
||||
|
||||
protected void activate(ComponentContext componentContext) throws NamingException {
|
||||
BundleContext bundleContext = componentContext.getBundleContext();
|
||||
ApplicationManagementServiceFactory serviceFactory = new ApplicationManagementServiceFactory();
|
||||
ApplicationManagementDataHolder.getInstance().setApplicationManagementServiceFactory(serviceFactory);
|
||||
bundleContext.registerService(ApplicationManagementServiceFactory.class.getName(), serviceFactory, null);
|
||||
|
||||
DataSourceConfig dataSourceConfig = ApplicationConfigurationManager.getInstance()
|
||||
.getApplicationManagerConfiguration().getApplicationManagerRepository().getDataSourceConfig();
|
||||
ApplicationManagementDAOFactory.init(dataSourceConfig);
|
||||
|
||||
log.info("ApplicationManagement core bundle has been successfully initialized");
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("ApplicationManagement core bundle has been successfully initialized");
|
||||
}
|
||||
}
|
||||
|
||||
protected void deactivate(ComponentContext componentContext) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Setting Application Management OSGI Manager");
|
||||
}
|
||||
ApplicationManagementDataHolder.getInstance().setDeviceManagementService(deviceManagementProviderService);
|
||||
}
|
||||
|
||||
protected void unsetDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Removing Application Management OSGI Manager");
|
||||
}
|
||||
ApplicationManagementDataHolder.getInstance().setDeviceManagementService(null);
|
||||
}
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
/*
|
||||
* 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.internal;
|
||||
|
||||
import org.wso2.carbon.device.application.mgt.common.services.*;
|
||||
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
||||
|
||||
public class DataHolder {
|
||||
//TODO move the osgi classes here.
|
||||
|
||||
private DeviceManagementProviderService deviceManagementService;
|
||||
|
||||
private ApplicationManager applicationManager;
|
||||
|
||||
private ApplicationReleaseManager releaseManager;
|
||||
|
||||
private CategoryManager categoryManager;
|
||||
|
||||
private CommentsManager commentsManager;
|
||||
|
||||
private LifecycleStateManager lifecycleStateManager;
|
||||
|
||||
private PlatformManager platformManager;
|
||||
|
||||
private VisibilityTypeManager visibilityTypeManager;
|
||||
|
||||
private SubscriptionManager subscriptionManager;
|
||||
|
||||
private VisibilityManager visibilityManager;
|
||||
|
||||
private ApplicationUploadManager applicationUploadManager;
|
||||
|
||||
private static final DataHolder applicationMgtDataHolder = new DataHolder();
|
||||
|
||||
private DataHolder() {
|
||||
|
||||
}
|
||||
|
||||
public static DataHolder getInstance() {
|
||||
return applicationMgtDataHolder;
|
||||
}
|
||||
|
||||
public DeviceManagementProviderService getDeviceManagementService() {
|
||||
return deviceManagementService;
|
||||
}
|
||||
|
||||
public void setDeviceManagementService(DeviceManagementProviderService deviceManagementService) {
|
||||
this.deviceManagementService = deviceManagementService;
|
||||
}
|
||||
|
||||
public static DataHolder getApplicationMgtDataHolder() {
|
||||
return applicationMgtDataHolder;
|
||||
}
|
||||
|
||||
public ApplicationManager getApplicationManager() {
|
||||
return applicationManager;
|
||||
}
|
||||
|
||||
public void setApplicationManager(ApplicationManager applicationManager) {
|
||||
this.applicationManager = applicationManager;
|
||||
}
|
||||
|
||||
public ApplicationReleaseManager getReleaseManager() {
|
||||
return releaseManager;
|
||||
}
|
||||
|
||||
public void setReleaseManager(ApplicationReleaseManager releaseManager) {
|
||||
this.releaseManager = releaseManager;
|
||||
}
|
||||
|
||||
public CategoryManager getCategoryManager() {
|
||||
return categoryManager;
|
||||
}
|
||||
|
||||
public void setCategoryManager(CategoryManager categoryManager) {
|
||||
this.categoryManager = categoryManager;
|
||||
}
|
||||
|
||||
public CommentsManager getCommentsManager() {
|
||||
return commentsManager;
|
||||
}
|
||||
|
||||
public void setCommentsManager(CommentsManager commentsManager) {
|
||||
this.commentsManager = commentsManager;
|
||||
}
|
||||
|
||||
public LifecycleStateManager getLifecycleStateManager() {
|
||||
return lifecycleStateManager;
|
||||
}
|
||||
|
||||
public void setLifecycleStateManager(LifecycleStateManager lifecycleStateManager) {
|
||||
this.lifecycleStateManager = lifecycleStateManager;
|
||||
}
|
||||
|
||||
public PlatformManager getPlatformManager() {
|
||||
return platformManager;
|
||||
}
|
||||
|
||||
public void setPlatformManager(PlatformManager platformManager) {
|
||||
this.platformManager = platformManager;
|
||||
}
|
||||
|
||||
public VisibilityTypeManager getVisibilityTypeManager() {
|
||||
return visibilityTypeManager;
|
||||
}
|
||||
|
||||
public void setVisibilityTypeManager(VisibilityTypeManager visibilityTypeManager) {
|
||||
this.visibilityTypeManager = visibilityTypeManager;
|
||||
}
|
||||
|
||||
public SubscriptionManager getSubscriptionManager() {
|
||||
return subscriptionManager;
|
||||
}
|
||||
|
||||
public void setSubscriptionManager(SubscriptionManager subscriptionManager) {
|
||||
this.subscriptionManager = subscriptionManager;
|
||||
}
|
||||
|
||||
public VisibilityManager getVisibilityManager() {
|
||||
return visibilityManager;
|
||||
}
|
||||
|
||||
public void setVisibilityManager(VisibilityManager visibilityManager) {
|
||||
this.visibilityManager = visibilityManager;
|
||||
}
|
||||
|
||||
public void setApplicationUploadManager(ApplicationUploadManager applicationUploadManager) {
|
||||
this.applicationUploadManager = applicationUploadManager;
|
||||
}
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* 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.internal;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.framework.BundleContext;
|
||||
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.dao.common.DAOFactory;
|
||||
import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagementUtil;
|
||||
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
|
||||
/**
|
||||
* @scr.component name="org.wso2.carbon.application.mgt.service" immediate="true"
|
||||
* @scr.reference name="org.wso2.carbon.device.manager"
|
||||
* interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService"
|
||||
* cardinality="1..1"
|
||||
* policy="dynamic"
|
||||
* bind="setDeviceManagementService"
|
||||
* unbind="unsetDeviceManagementService"
|
||||
*/
|
||||
public class ServiceComponent {
|
||||
|
||||
private static Log log = LogFactory.getLog(ServiceComponent.class);
|
||||
|
||||
|
||||
protected void activate(ComponentContext componentContext) throws NamingException {
|
||||
BundleContext bundleContext = componentContext.getBundleContext();
|
||||
try {
|
||||
String datasourceName = ConfigurationManager.getInstance()
|
||||
.getConfiguration().getDatasourceName();
|
||||
DAOFactory.init(datasourceName);
|
||||
|
||||
ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance();
|
||||
DataHolder.getInstance().setApplicationManager(applicationManager);
|
||||
bundleContext.registerService(ApplicationManager.class.getName(), applicationManager, null);
|
||||
|
||||
ApplicationReleaseManager applicationReleaseManager = ApplicationManagementUtil.getApplicationReleaseManagerInstance();
|
||||
DataHolder.getInstance().setReleaseManager(applicationReleaseManager);
|
||||
bundleContext.registerService(ApplicationReleaseManager.class.getName(), applicationReleaseManager, null);
|
||||
|
||||
CategoryManager categoryManager = ApplicationManagementUtil.getCategoryManagerInstance();
|
||||
DataHolder.getInstance().setCategoryManager(categoryManager);
|
||||
bundleContext.registerService(CategoryManager.class.getName(), categoryManager, null);
|
||||
|
||||
CommentsManager commentsManager = ApplicationManagementUtil.getCommentsManagerInstance();
|
||||
DataHolder.getInstance().setCommentsManager(commentsManager);
|
||||
bundleContext.registerService(CommentsManager.class.getName(), commentsManager, null);
|
||||
|
||||
LifecycleStateManager lifecycleStateManager = ApplicationManagementUtil.getLifecycleStateManagerInstance();
|
||||
DataHolder.getInstance().setLifecycleStateManager(lifecycleStateManager);
|
||||
bundleContext.registerService(LifecycleStateManager.class.getName(), lifecycleStateManager, null);
|
||||
|
||||
PlatformManager platformManager = ApplicationManagementUtil.getPlatformManagerInstance();
|
||||
DataHolder.getInstance().setPlatformManager(platformManager);
|
||||
bundleContext.registerService(PlatformManager.class.getName(), platformManager, null);
|
||||
|
||||
SubscriptionManager subscriptionManager = ApplicationManagementUtil.getSubscriptionManagerInstance();
|
||||
DataHolder.getInstance().setSubscriptionManager(subscriptionManager);
|
||||
bundleContext.registerService(SubscriptionManager.class.getName(), subscriptionManager, null);
|
||||
|
||||
VisibilityManager visibilityManager = ApplicationManagementUtil.getVisibilityManagerInstance();
|
||||
DataHolder.getInstance().setVisibilityManager(visibilityManager);
|
||||
bundleContext.registerService(VisibilityManager.class.getName(), visibilityManager, null);
|
||||
|
||||
VisibilityTypeManager visibilityTypeManager = ApplicationManagementUtil.getVisibilityTypeManagerInstance();
|
||||
DataHolder.getInstance().setVisibilityTypeManager(visibilityTypeManager);
|
||||
bundleContext.registerService(VisibilityTypeManager.class.getName(), visibilityTypeManager, null);
|
||||
|
||||
ApplicationUploadManager uploadManager = ApplicationManagementUtil.getApplicationUploadManagerInstance();
|
||||
DataHolder.getInstance().setApplicationUploadManager(uploadManager);
|
||||
bundleContext.registerService(ApplicationUploadManager.class.getName(), uploadManager, null);
|
||||
|
||||
log.info("ApplicationManagement core bundle has been successfully initialized");
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("ApplicationManagement core bundle has been successfully initialized");
|
||||
}
|
||||
} catch (InvalidConfigurationException e) {
|
||||
log.error("Error while activating Application Management core component. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void deactivate(ComponentContext componentContext) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Setting Application Management OSGI Manager");
|
||||
}
|
||||
DataHolder.getInstance().setDeviceManagementService(deviceManagementProviderService);
|
||||
}
|
||||
|
||||
protected void unsetDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Removing Application Management OSGI Manager");
|
||||
}
|
||||
DataHolder.getInstance().setDeviceManagementService(null);
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
/*
|
||||
* 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.services.impl;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.application.mgt.common.services.*;
|
||||
import org.wso2.carbon.device.application.mgt.core.config.ApplicationConfigurationManager;
|
||||
import org.wso2.carbon.device.application.mgt.core.config.extensions.Extension;
|
||||
import org.wso2.carbon.device.application.mgt.core.config.extensions.ExtensionsConfig;
|
||||
|
||||
public class ApplicationManagementServiceFactory {
|
||||
|
||||
private static Log log = LogFactory.getLog(ApplicationManagementServiceFactory.class);
|
||||
|
||||
public enum ManagerService {
|
||||
APPLICATION_MANAGER,
|
||||
APPLICATION_RELEASE_MANAGER,
|
||||
CATEGORY_MANAGER,
|
||||
COMMENTS_MANAGER,
|
||||
LIFECYCLE_STATE_MANAGER,
|
||||
PLATFORM_MANAGER,
|
||||
RESOURCE_TYPE_MANAGER,
|
||||
SUBSCRIPTION_MANAGER,
|
||||
VISIBILITY_MANAGER
|
||||
}
|
||||
|
||||
public ApplicationManagementService getApplicationManagementService(ManagerService managerService) {
|
||||
switch (managerService) {
|
||||
case APPLICATION_MANAGER:
|
||||
return new ApplicationManagerImpl();
|
||||
case APPLICATION_RELEASE_MANAGER:
|
||||
return new ApplicationReleaseManagerImpl();
|
||||
default:
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
12
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagerConstants.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java
12
components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagerConstants.java → components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.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();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?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>
|
||||
|
||||
<!-- Application Mgt DB schema -->
|
||||
<DatasourceName>jdbc/APPM_DS</DatasourceName>
|
||||
|
||||
<Extensions>
|
||||
<Extension name="ApplicationUploadManager">
|
||||
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.ApplicationUploadManagerImpl</ClassName>
|
||||
<Parameters>
|
||||
<Parameter name="UploadPath">repository/resources/mobileapps</Parameter>
|
||||
</Parameters>
|
||||
</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>
|
||||
|
||||
</ApplicationManagementConfiguration>
|
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* 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.extensions.appupload;
|
||||
|
||||
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementExtension;
|
||||
|
||||
public class AppUploadManagerImpl extends ApplicationManagementExtension implements AppUploadManager {
|
||||
|
||||
}
|
@ -1,25 +1,60 @@
|
||||
<?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 -->
|
||||
<ManagementRepository>
|
||||
<DataSourceConfiguration>
|
||||
<JndiLookupDefinition>
|
||||
<Name>jdbc/APPM_DS</Name>
|
||||
</JndiLookupDefinition>
|
||||
</DataSourceConfiguration>
|
||||
</ManagementRepository>
|
||||
<DatasourceName>jdbc/APPM_DS</DatasourceName>
|
||||
|
||||
|
||||
<ExtensionsConfig>
|
||||
<Extensions>
|
||||
<Extension name="ApplicationUploadExtension">
|
||||
<ClassName>org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManagerImpl</ClassName>
|
||||
<Extension name="ApplicationUploadManager">
|
||||
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.ApplicationUploadManagerImpl</ClassName>
|
||||
<Parameters>
|
||||
<Parameter name="UploadPath">repository/resources/mobileapps</Parameter>
|
||||
</Parameters>
|
||||
</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>
|
||||
</ExtensionsConfig>
|
||||
|
||||
</ApplicationManagementConfigurations>
|
||||
</ApplicationManagementConfiguration>
|
Loading…
Reference in new issue