diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/APIUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/APIUtil.java index 754907282a..c9dfbb057a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/APIUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/APIUtil.java @@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.application.mgt.api.beans.ErrorResponse; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; -import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory; +import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import javax.ws.rs.core.Response; @@ -35,24 +35,24 @@ public class APIUtil { private static Log log = LogFactory.getLog(APIUtil.class); - private static ApplicationManagementServiceFactory applicationManagementServiceFactory; + private static ApplicationManager applicationManager; - public static ApplicationManagementServiceFactory getApplicationManagementServiceFactory() { - if (applicationManagementServiceFactory == null) { + public static ApplicationManager getApplicationManagemer() { + if (applicationManager == null) { synchronized (APIUtil.class) { - if (applicationManagementServiceFactory == null) { + if (applicationManager == null) { PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - applicationManagementServiceFactory = - (ApplicationManagementServiceFactory) ctx.getOSGiService(ApplicationManagementServiceFactory.class, null); - if (applicationManagementServiceFactory == null) { - String msg = "Application Management provider service has not initialized."; + applicationManager = + (ApplicationManager) ctx.getOSGiService(ApplicationManager.class, null); + if (applicationManager == null) { + String msg = "Application Manager service has not initialized."; log.error(msg); throw new IllegalStateException(msg); } } } } - return applicationManagementServiceFactory; + return applicationManager; } public static Response getResponse(ApplicationManagementException ex, Response.Status status) { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/ApiOriginFilter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/ApiOriginFilter.java deleted file mode 100644 index fc8d84d3e7..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/ApiOriginFilter.java +++ /dev/null @@ -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 - } - -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/JSONMessageHandler.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/JSONMessageHandler.java index 2a1407eeae..2f88b22306 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/JSONMessageHandler.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/JSONMessageHandler.java @@ -62,7 +62,7 @@ public class JSONMessageHandler implements MessageBodyWriter, MessageBod public Object readFrom(Class objectClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap stringStringMultivaluedMap, InputStream entityStream) throws IOException, WebApplicationException { - try (InputStreamReader reader = new InputStreamReader(entityStream, "UTF-8")) { + try (InputStreamReader reader = new InputStreamReader(entityStream, UTF_8)) { return getGson().fromJson(reader, type); } } @@ -78,7 +78,6 @@ public class JSONMessageHandler implements MessageBodyWriter, MessageBod public void writeTo(Object object, Class aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap stringObjectMultivaluedMap, OutputStream entityStream) throws IOException, WebApplicationException { - try (OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8)) { getGson().toJson(object, type, writer); } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorListItem.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorListItem.java index e69f62c2ca..91599d539a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorListItem.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorListItem.java @@ -50,7 +50,6 @@ public class ErrorListItem { this.message = msg; } - /** * Description about individual errors occurred */ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java index a02469577f..06e95af7b0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java @@ -25,15 +25,9 @@ import org.wso2.carbon.device.application.mgt.common.ApplicationList; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.api.APIUtil; -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.core.Response; -import static org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory - .ManagerService.APPLICATION_MANAGER; - @Produces({"application/json"}) @Consumes({"application/json"}) public class ApplicationManagementAPIImpl { @@ -49,10 +43,8 @@ public class ApplicationManagementAPIImpl { @Consumes("application/json") @Path("applications") public Response getApplications(@QueryParam("offset") int offset, @QueryParam("limit") int limit, - @QueryParam("q") String searchQuery) { - ApplicationManagementServiceFactory serviceFactory = APIUtil.getApplicationManagementServiceFactory(); - ApplicationManager applicationManager = (ApplicationManager) serviceFactory - .getApplicationManagementService(APPLICATION_MANAGER); + @QueryParam("query") String searchQuery) { + ApplicationManager applicationManager = APIUtil.getApplicationManagemer(); try { if (limit == 0) { limit = DEFAULT_LIMIT; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml index abcd6b3d1c..db708d84b9 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml @@ -16,7 +16,9 @@ ~ specific language governing permissions and limitations ~ under the License. --> - + Application Management Webapp JAX-WS/JAX-RS Application Management Endpoint @@ -53,8 +55,20 @@ - ApiOriginFilter - org.wso2.carbon.device.application.mgt.api.APIOriginFilter + CorsFilter + org.apache.catalina.filters.CorsFilter + + cors.allowed.origins + * + + + cors.allowed.methods + GET,POST,DELETE,PUT + + + cors.allowed.headers + Content-Type + @@ -94,7 +108,8 @@ - ApiOriginFilter + CorsFilter /* + \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java index 1cbdb02a3f..144f8231ed 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java @@ -50,10 +50,10 @@ public class Application { private List tags; - private List subscriptions; - private Platform platform; + private List comments; + private Category category; private Map properties; @@ -64,21 +64,49 @@ public class Application { private Date modifiedAt; - private LifecycleState lifecycleState; + private Payment payment; - private Date lifecycleStateModifiedAt; + private Lifecycle currentLifecycle; - private Date getLifecycleStateModifiedBy; + private List releases; - private boolean freeApp; + private Visibility visibility; - private String paymentCurrency; + public int getId() { + return id; + } - private Float paymentPrice; + public List getReleases() { + return releases; + } + public void setReleases(List releases) { + this.releases = releases; + } - public int getId() { - return id; + + public List getComments() { + return comments; + } + + public void setComments(List comments) { + this.comments = comments; + } + + public Payment getPayment() { + return payment; + } + + public void setPayment(Payment payment) { + this.payment = payment; + } + + public Lifecycle getCurrentLifecycle() { + return currentLifecycle; + } + + public void setCurrentLifecycle(Lifecycle currentLifecycle) { + this.currentLifecycle = currentLifecycle; } public void setId(int id) { @@ -165,14 +193,6 @@ public class Application { this.tags = tags; } - public List getSubscriptions() { - return subscriptions; - } - - public void setSubscriptions(List subscriptions) { - this.subscriptions = subscriptions; - } - public Platform getPlatform() { return platform; } @@ -221,51 +241,11 @@ public class Application { this.modifiedAt = modifiedAt; } - 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; - } - - 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 Visibility getVisibility() { + return visibility; } - public void setPaymentPrice(Float paymentPrice) { - this.paymentPrice = paymentPrice; + public void setVisibility(Visibility visibility) { + this.visibility = visibility; } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java index 077feedb82..a1cedc9882 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java @@ -23,7 +23,7 @@ import java.util.Map; public class ApplicationRelease { - private enum ReleaseChannel { + private enum Channel { PRODUCTION, ALPHA, BETA } @@ -35,7 +35,7 @@ public class ApplicationRelease { private String resource; - private ReleaseChannel releaseChannel; + private Channel releaseChannel; private String releaseDetails; @@ -83,11 +83,11 @@ public class ApplicationRelease { this.resource = resource; } - public ReleaseChannel getReleaseChannel() { + public Channel getReleaseChannel() { return releaseChannel; } - public void setReleaseChannel(ReleaseChannel releaseChannel) { + public void setReleaseChannel(Channel releaseChannel) { this.releaseChannel = releaseChannel; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationType.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationType.java deleted file mode 100644 index 9c07db63c1..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationType.java +++ /dev/null @@ -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; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Comment.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Comment.java index 80dc6162db..bde0883491 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Comment.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Comment.java @@ -26,6 +26,7 @@ public class Comment { private int rating; + //TODO: Pagination, comment ID for child private Comment parent; private String createdBy; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Filter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Filter.java index 5a83306ea0..bfdb5d3ab0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Filter.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Filter.java @@ -31,6 +31,7 @@ public class Filter { private int offset; + //TODO: private String filter; private List filterProperties; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/FilterProperty.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/FilterProperty.java index 5dc2b907ff..f9dfece8d6 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/FilterProperty.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/FilterProperty.java @@ -18,6 +18,7 @@ */ package org.wso2.carbon.device.application.mgt.common; +//TODO public class FilterProperty { public enum Operator { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifeCycle.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifeCycle.java new file mode 100644 index 0000000000..c8901af5bc --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifeCycle.java @@ -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; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Payment.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Payment.java new file mode 100644 index 0000000000..8eabdef644 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Payment.java @@ -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; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java index bffc570e97..27550b9ecc 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java @@ -21,6 +21,7 @@ package org.wso2.carbon.device.application.mgt.common; import org.wso2.carbon.device.application.mgt.common.jaxrs.Exclude; import java.util.List; +import java.util.Map; public class Platform { @@ -37,9 +38,7 @@ public class Platform { private List tags; - private String properties; - - private List applications; + private Map properties; public int getId() { return id; @@ -81,11 +80,11 @@ public class Platform { this.iconName = iconName; } - public String getProperties() { + public Map getProperties() { return properties; } - public void setProperties(String properties) { + public void setProperties(Map properties) { this.properties = properties; } @@ -96,12 +95,4 @@ public class Platform { public void setTags(List tags) { this.tags = tags; } - - public List getApplications() { - return applications; - } - - public void setApplications(List applications) { - this.applications = applications; - } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ResourceType.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ResourceType.java deleted file mode 100644 index 2856f6160e..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ResourceType.java +++ /dev/null @@ -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; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Subscription.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Subscription.java index f4bba93000..75c3fc57fa 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Subscription.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Subscription.java @@ -22,7 +22,7 @@ import java.util.Date; public class Subscription { - private ResourceType type; + private Visibility.Type type; private String value; @@ -40,11 +40,11 @@ public class Subscription { this.value = value; } - public ResourceType getType() { + public Visibility.Type getType() { return type; } - public void setType(ResourceType type) { + public void setType(Visibility.Type type) { this.type = type; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Visibility.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Visibility.java index 672ab62f52..20ea959353 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Visibility.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Visibility.java @@ -18,11 +18,10 @@ */ package org.wso2.carbon.device.application.mgt.common; -import java.util.Date; - +//TODO: move to app public class Visibility { - private ResourceType type; + private Type type; private String value; @@ -38,11 +37,11 @@ public class Visibility { this.value = value; } - public ResourceType getType() { + public Type getType() { return type; } - public void setType(ResourceType type) { + public void setType(Type type) { this.type = type; } @@ -61,4 +60,37 @@ public class Visibility { public void setApplicationRelease(ApplicationRelease applicationRelease) { this.applicationRelease = applicationRelease; } + + public class Type { + + 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; + } + } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementExtension.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementExtension.java deleted file mode 100644 index df281eb991..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementExtension.java +++ /dev/null @@ -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 parameters; - - - public Map getParameters() { - return parameters; - } - - public void setParameters(Map parameters) { - this.parameters = parameters; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java index 098b3cbe3b..ae1752b8d8 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java @@ -23,7 +23,7 @@ import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.common.ApplicationList; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; -public interface ApplicationManager extends ApplicationManagementService { +public interface ApplicationManager{ void createApplication(Application application) throws ApplicationManagementException; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java index 43a870d8cc..00c5855b6d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java @@ -18,5 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface ApplicationReleaseManager extends ApplicationManagementService { +public interface ApplicationReleaseManager{ } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementService.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationUploadManager.java similarity index 94% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementService.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationUploadManager.java index 9fe5fe9996..027a87dfbf 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementService.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationUploadManager.java @@ -18,5 +18,6 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface ApplicationManagementService { +public interface ApplicationUploadManager { + } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java index 462db94f5d..4781299677 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java @@ -18,5 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface CategoryManager extends ApplicationManagementService { +public interface CategoryManager{ } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java index 031e3fcf85..02403a03a6 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java @@ -18,5 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface CommentsManager extends ApplicationManagementService { +public interface CommentsManager{ } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/LifecycleStateManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/LifecycleStateManager.java index cfc84506a4..36e772f7e8 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/LifecycleStateManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/LifecycleStateManager.java @@ -18,6 +18,6 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface LifecycleStateManager extends ApplicationManagementService { +public interface LifecycleStateManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/PlatformManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/PlatformManager.java index e006ad5697..fb57b924a3 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/PlatformManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/PlatformManager.java @@ -18,5 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface PlatformManager extends ApplicationManagementService { +public interface PlatformManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/SubscriptionManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/SubscriptionManager.java index 371fa93695..1067c3bcb9 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/SubscriptionManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/SubscriptionManager.java @@ -18,5 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface SubscriptionManager extends ApplicationManagementService { +public interface SubscriptionManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityManager.java index e2febced23..c45fbe3c47 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityManager.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 { + } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ResourceTypeManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityTypeManager.java similarity index 90% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ResourceTypeManager.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityTypeManager.java index 87bff5dcac..5584cbd8f4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ResourceTypeManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityTypeManager.java @@ -18,5 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface ResourceTypeManager extends ApplicationManagementService { +public interface VisibilityTypeManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml index 1f5bee530d..f40fb22813 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml @@ -80,19 +80,11 @@ - - org.apache.maven.plugins - maven-surefire-plugin - 2.18 - - - file:src/test/resources/log4j.properties - - - src/test/resources/testng.xml - - - + + + + + @@ -114,6 +106,11 @@ org.testng testng + + junit + junit + test + org.wso2.carbon org.wso2.carbon.logging diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationConfigurationManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationConfigurationManager.java deleted file mode 100644 index 5f740cab67..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationConfigurationManager.java +++ /dev/null @@ -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; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementConfigurations.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementConfigurations.java deleted file mode 100644 index 58f103c2c8..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementConfigurations.java +++ /dev/null @@ -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; - } -} - - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementRepository.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementRepository.java deleted file mode 100644 index 52f257fd74..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementRepository.java +++ /dev/null @@ -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; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extensions.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configuration.java similarity index 58% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extensions.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configuration.java index e686e8b9b4..b41501c7a3 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extensions.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configuration.java @@ -16,17 +16,32 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.config.extensions; +package org.wso2.carbon.device.application.mgt.core.config; -import javax.xml.bind.annotation.*; +import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; import java.util.List; -@XmlRootElement(name = "Extensions") -public class Extensions { +@XmlRootElement(name = "ApplicationManagementConfiguration") +public class Configuration { + + private String datasourceName; private List extensions; + @XmlElement(name = "DatasourceName", required = true) + public String getDatasourceName() { + return datasourceName; + } + + public void setDatasourceName(String datasourceName) { + this.datasourceName = datasourceName; + } + @XmlElementWrapper(name = "Extensions") @XmlElement(name = "Extension") public List getExtensions() { return extensions; @@ -35,15 +50,6 @@ public class Extensions { public void setExtensions(List 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; - } } + + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java new file mode 100644 index 0000000000..d81240e573 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.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!"); + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java similarity index 55% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java index 862f2130f8..dc49eb60ba 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java @@ -16,13 +16,10 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.config.extensions; +package org.wso2.carbon.device.application.mgt.core.config; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import java.util.Map; +import javax.xml.bind.annotation.*; +import java.util.List; @XmlRootElement(name = "Extension") public class Extension { @@ -31,7 +28,7 @@ public class Extension { private String className; - private Map parameters; + private List parameters; @XmlAttribute(name = "name") public String getName() { @@ -42,7 +39,7 @@ public class Extension { this.name = name; } - @XmlElement(name = "ClassName", nillable = true) + @XmlElement(name = "ClassName") public String getClassName() { return className; } @@ -51,13 +48,37 @@ public class Extension { this.className = className; } - @XmlElement(name = "Parameters", nillable = true) - @XmlJavaTypeAdapter(ParameterAdapter.class) - public Map getParameters() { + @XmlElementWrapper(name = "Parameters") + @XmlElement(name = "Parameter") + public List getParameters() { return parameters; } - public void setParameters(Map parameters) { + public void setParameters(List parameters) { this.parameters = parameters; } + + public boolean equals(Object anotherObj) { + if (anotherObj instanceof Extension) { + Extension anExt = (Extension) anotherObj; + if (anExt.getName().contentEquals(this.getName())) { + return true; + } + } + return false; + } + + public enum Name { + ApplicationManager, + ApplicationReleaseManager, + ApplicationUploadManager, + CategoryManager, + CommentsManager, + LifecycleStateManager, + PlatformManager, + VisibilityTypeManager, + SubscriptionManager, + VisibilityManager + } } + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Parameter.java similarity index 85% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Parameter.java index db3d22b8d8..12283e46a0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Parameter.java @@ -16,26 +16,19 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.config.extensions; +package org.wso2.carbon.device.application.mgt.core.config; import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlValue; +@XmlRootElement(name = "Parameter") 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; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/DataSourceConfig.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/DataSourceConfig.java deleted file mode 100644 index 6b6d9ff3e1..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/DataSourceConfig.java +++ /dev/null @@ -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; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/JNDILookupDefinition.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/JNDILookupDefinition.java deleted file mode 100644 index 2ae8125c79..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/JNDILookupDefinition.java +++ /dev/null @@ -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 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 getJndiProperties() { - return jndiProperties; - } - - public void setJndiProperties(List 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; - } - } - -} - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ExtensionsConfig.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ExtensionsConfig.java deleted file mode 100644 index 75be478f2e..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ExtensionsConfig.java +++ /dev/null @@ -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; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ParameterAdapter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ParameterAdapter.java deleted file mode 100644 index ff0a4b2ac3..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ParameterAdapter.java +++ /dev/null @@ -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> { - - @Override - public Map unmarshal(Parameters in) throws Exception { - HashMap hashMap = new HashMap<>(); - for (Parameter parameter : in.getParameters()) { - hashMap.put(parameter.getName(), parameter.getValue()); - } - return hashMap; - } - - @Override - public Parameters marshal(Map map) throws Exception { - Parameters parameters = new Parameters(); - for (Map.Entry entry : map.entrySet()) { - parameters.addEntry(new Parameter(entry.getKey(), entry.getValue())); - } - return parameters; - } - -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameters.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameters.java deleted file mode 100644 index 280b9d516d..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameters.java +++ /dev/null @@ -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 parameters = new ArrayList<>();; - - @XmlElement(name = "Parameter", nillable = true) - public List getParameters() { - return parameters; - } - - public void setParameters(List parameters) { - this.parameters = parameters; - } - - void addEntry(Parameter parameter) { - parameters.add(parameter); - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationDAO.java index ae07f81c58..8a4652c7ce 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationDAO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationDAO.java @@ -18,7 +18,7 @@ */ package org.wso2.carbon.device.application.mgt.core.dao; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException; +import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; import org.wso2.carbon.device.application.mgt.common.Application; import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.common.ApplicationList; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java similarity index 76% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java index c8eb610ae8..71c3e675fa 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java @@ -21,11 +21,10 @@ package org.wso2.carbon.device.application.mgt.core.dao.common; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.common.exception.UnsupportedDatabaseEngineException; -import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.H2ApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.MySQLApplicationDAOImpl; -import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagerConstants; +import org.wso2.carbon.device.application.mgt.core.util.Constants; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; import javax.sql.DataSource; @@ -37,27 +36,22 @@ import javax.sql.DataSource; * different data sources, connection acquisition mechanisms as well as different forms of DAO implementations to the * high-level implementations that require Application management related metadata persistence. */ -public class ApplicationManagementDAOFactory { +public class DAOFactory { private static String databaseEngine; - private static final Log log = LogFactory.getLog(ApplicationManagementDAOFactory.class); + private static final Log log = LogFactory.getLog(DAOFactory.class); - public static void init(DataSourceConfig config) { - ConnectionManagerUtil.resolveDataSource(config); - databaseEngine = ConnectionManagerUtil.getDatabaseType(); - } - - public static void init(DataSource dtSource) { - ConnectionManagerUtil.setDataSource(dtSource); + public static void init(String datasourceName) { + ConnectionManagerUtil.resolveDataSource(datasourceName); databaseEngine = ConnectionManagerUtil.getDatabaseType(); } public static ApplicationDAO getApplicationDAO(){ if (databaseEngine != null) { switch (databaseEngine) { - case ApplicationManagerConstants.DataBaseTypes.DB_TYPE_H2: + case Constants.DataBaseTypes.DB_TYPE_H2: return new H2ApplicationDAOImpl(); - case ApplicationManagerConstants.DataBaseTypes.DB_TYPE_MYSQL: + case Constants.DataBaseTypes.DB_TYPE_MYSQL: return new MySQLApplicationDAOImpl(); default: throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java similarity index 90% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOUtil.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java index bdb8d4d744..19cb7da13a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java @@ -25,19 +25,15 @@ import org.json.JSONException; import org.wso2.carbon.device.application.mgt.common.Application; import org.wso2.carbon.device.application.mgt.common.Platform; import org.wso2.carbon.device.application.mgt.common.Category; -import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; -import org.wso2.carbon.device.application.mgt.core.config.datasource.JNDILookupDefinition; -import javax.naming.InitialContext; -import javax.sql.DataSource; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.*; -public class ApplicationManagementDAOUtil { +public class Util { - private static final Log log = LogFactory.getLog(ApplicationManagementDAOUtil.class); + private static final Log log = LogFactory.getLog(Util.class); public static Application loadApplication(ResultSet rs, ResultSet rsProperties, ResultSet rsTags) throws SQLException, JSONException { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/AbstractApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/AbstractApplicationDAOImpl.java index b30a8f0d9b..ebc06a5dae 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/AbstractApplicationDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/AbstractApplicationDAOImpl.java @@ -24,8 +24,8 @@ import org.wso2.carbon.device.application.mgt.common.Application; import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOUtil; +import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; +import org.wso2.carbon.device.application.mgt.core.dao.common.Util; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; import java.sql.Connection; @@ -100,7 +100,7 @@ public abstract class AbstractApplicationDAOImpl implements ApplicationDAO { } catch (DBConnectionException e) { throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection.", e); } finally { - ApplicationManagementDAOUtil.cleanupResources(stmt, rs); + Util.cleanupResources(stmt, rs); } return count; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/H2ApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/H2ApplicationDAOImpl.java index 06e40c5fe7..9d9816f0cb 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/H2ApplicationDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/H2ApplicationDAOImpl.java @@ -26,8 +26,8 @@ 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.Pagination; import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOUtil; +import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; +import org.wso2.carbon.device.application.mgt.core.dao.common.Util; import org.wso2.carbon.device.application.mgt.core.dao.impl.AbstractApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; @@ -110,9 +110,9 @@ public class H2ApplicationDAOImpl extends AbstractApplicationDAOImpl { stmt.setInt(1, rs.getInt("ID")); ResultSet rsTags = stmt.executeQuery(); - applications.add(ApplicationManagementDAOUtil.loadApplication(rs, rsProperties, rsTags)); - ApplicationManagementDAOUtil.cleanupResources(null, rsProperties); - ApplicationManagementDAOUtil.cleanupResources(null, rsTags); + applications.add(Util.loadApplication(rs, rsProperties, rsTags)); + Util.cleanupResources(null, rsProperties); + Util.cleanupResources(null, rsTags); length++; } @@ -128,7 +128,7 @@ public class H2ApplicationDAOImpl extends AbstractApplicationDAOImpl { } catch (DBConnectionException e) { throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection.", e); } finally { - ApplicationManagementDAOUtil.cleanupResources(stmt, rs); + Util.cleanupResources(stmt, rs); } return applicationList; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/MySQLApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/MySQLApplicationDAOImpl.java index 7e6e5358f9..c0f5697f56 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/MySQLApplicationDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/MySQLApplicationDAOImpl.java @@ -26,8 +26,8 @@ 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.Pagination; import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOUtil; +import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; +import org.wso2.carbon.device.application.mgt.core.dao.common.Util; import org.wso2.carbon.device.application.mgt.core.dao.impl.AbstractApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; @@ -95,7 +95,7 @@ public class MySQLApplicationDAOImpl extends AbstractApplicationDAOImpl { rs = stmt.executeQuery(); int length = 0; - sql = "SELECT FOUND_ROWS() AS COUNT;"; + sql = "SELECT FOUND_ROWS() AS COUNT;"; //TODO: from which tables???? stmt = conn.prepareStatement(sql); ResultSet rsCount = stmt.executeQuery(); if (rsCount.next()) { @@ -116,9 +116,9 @@ public class MySQLApplicationDAOImpl extends AbstractApplicationDAOImpl { stmt.setInt(1, rs.getInt("ID")); ResultSet rsTags = stmt.executeQuery(); - applications.add(ApplicationManagementDAOUtil.loadApplication(rs, rsProperties, rsTags)); - ApplicationManagementDAOUtil.cleanupResources(null, rsProperties); - ApplicationManagementDAOUtil.cleanupResources(null, rsTags); + applications.add(Util.loadApplication(rs, rsProperties, rsTags)); + Util.cleanupResources(null, rsProperties); + Util.cleanupResources(null, rsTags); length++; } @@ -134,7 +134,7 @@ public class MySQLApplicationDAOImpl extends AbstractApplicationDAOImpl { } catch (DBConnectionException e) { throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection.", e); } finally { - ApplicationManagementDAOUtil.cleanupResources(stmt, rs); + Util.cleanupResources(stmt, rs); } return applicationList; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOException.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/ApplicationManagementDAOException.java similarity index 94% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOException.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/ApplicationManagementDAOException.java index fa9808c1a3..d951b84c9d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOException.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/ApplicationManagementDAOException.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.dao.common; +package org.wso2.carbon.device.application.mgt.core.exception; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/KeystoreException.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/KeystoreException.java deleted file mode 100644 index 15e1aec5bf..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/KeystoreException.java +++ /dev/null @@ -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); - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java similarity index 79% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java index 850d972f04..baa915ee9c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java @@ -16,17 +16,15 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services.impl; +package org.wso2.carbon.device.application.mgt.core.impl; 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.exception.ApplicationManagementException; -import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory; +import org.wso2.carbon.device.application.mgt.core.dao.common.DAOFactory; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; public class ApplicationManagerImpl implements ApplicationManager { @@ -39,7 +37,7 @@ public class ApplicationManagerImpl implements ApplicationManager { public ApplicationList getApplications(Filter filter) throws ApplicationManagementException { try { ConnectionManagerUtil.openConnection(); - ApplicationDAO applicationDAO = ApplicationManagementDAOFactory.getApplicationDAO(); + ApplicationDAO applicationDAO = DAOFactory.getApplicationDAO(); return applicationDAO.getApplications(filter); } finally { ConnectionManagerUtil.closeConnection(); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationReleaseManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationReleaseManagerImpl.java similarity index 92% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationReleaseManagerImpl.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationReleaseManagerImpl.java index 622c6d516e..874164efee 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationReleaseManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationReleaseManagerImpl.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services.impl; +package org.wso2.carbon.device.application.mgt.core.impl; import org.wso2.carbon.device.application.mgt.common.services.ApplicationReleaseManager; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationUploadManagerImpl.java similarity index 76% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManager.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationUploadManagerImpl.java index c813a6af12..38b908c00d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationUploadManagerImpl.java @@ -16,10 +16,14 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.extensions.appupload; +package org.wso2.carbon.device.application.mgt.core.impl; -import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService; -public interface AppUploadManager { +import org.wso2.carbon.device.application.mgt.common.services.ApplicationUploadManager; +public class ApplicationUploadManagerImpl implements ApplicationUploadManager { + + public ApplicationUploadManagerImpl(String uploadPath){ + + } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java new file mode 100644 index 0000000000..e245186b1a --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +package org.wso2.carbon.device.application.mgt.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.CategoryManager; + +public class CategoryManagerImpl implements CategoryManager { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java new file mode 100644 index 0000000000..fbecc5a7eb --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +package org.wso2.carbon.device.application.mgt.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.CommentsManager; + +public class CommentsManagerImpl implements CommentsManager { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/LifecycleStateManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/LifecycleStateManagerImpl.java new file mode 100644 index 0000000000..2c71738f40 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/LifecycleStateManagerImpl.java @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +package org.wso2.carbon.device.application.mgt.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.LifecycleStateManager; + +public class LifecycleStateManagerImpl implements LifecycleStateManager { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformManagerImpl.java new file mode 100644 index 0000000000..52c302fde6 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformManagerImpl.java @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +package org.wso2.carbon.device.application.mgt.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.PlatformManager; + +public class PlatformManagerImpl implements PlatformManager { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java new file mode 100644 index 0000000000..d0f3433fb6 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +package org.wso2.carbon.device.application.mgt.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager; + +public class SubscriptionManagerImpl implements SubscriptionManager { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java new file mode 100644 index 0000000000..315d3c6122 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +package org.wso2.carbon.device.application.mgt.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.VisibilityManager; + +public class VisibilityManagerImpl implements VisibilityManager{ +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityTypeManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityTypeManagerImpl.java new file mode 100644 index 0000000000..5396a67000 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityTypeManagerImpl.java @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +package org.wso2.carbon.device.application.mgt.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.VisibilityTypeManager; + +public class VisibilityTypeManagerImpl implements VisibilityTypeManager { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java deleted file mode 100644 index 73fd21660c..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java +++ /dev/null @@ -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; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java deleted file mode 100644 index 552a74effe..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java +++ /dev/null @@ -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); - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/DataHolder.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/DataHolder.java new file mode 100644 index 0000000000..948c143220 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/DataHolder.java @@ -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; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ServiceComponent.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ServiceComponent.java new file mode 100644 index 0000000000..11a9957aa9 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ServiceComponent.java @@ -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); + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceFactory.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceFactory.java deleted file mode 100644 index 6715fab117..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceFactory.java +++ /dev/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; - - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java index 1afe85092a..6c3d6377df 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java @@ -20,43 +20,96 @@ package org.wso2.carbon.device.application.mgt.core.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.wso2.carbon.context.PrivilegedCarbonContext; -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.services.impl.ApplicationManagementServiceFactory; +import org.wso2.carbon.device.application.mgt.common.services.*; +import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager; +import org.wso2.carbon.device.application.mgt.core.config.Extension; -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.File; +import java.lang.reflect.Constructor; public class ApplicationManagementUtil { private static Log log = LogFactory.getLog(ApplicationManagementUtil.class); - public static ApplicationManagementServiceFactory getApplicationManagementServiceFactory() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ApplicationManagementServiceFactory applicationManagerServiceFactory = - (ApplicationManagementServiceFactory) ctx.getOSGiService(ApplicationManagementServiceFactory.class, null); - if (applicationManagerServiceFactory == null) { - String msg = "Application Management provider service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - return applicationManagerServiceFactory; + public static ApplicationManager getApplicationManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.ApplicationManager); + return getInstance(extension, ApplicationManager.class); + } + + public static ApplicationReleaseManager getApplicationReleaseManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.ApplicationReleaseManager); + return getInstance(extension, ApplicationReleaseManager.class); + } + + public static CategoryManager getCategoryManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.CategoryManager); + return getInstance(extension, CategoryManager.class); + } + + public static CommentsManager getCommentsManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.CommentsManager); + return getInstance(extension, CommentsManager.class); + } + + public static LifecycleStateManager getLifecycleStateManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.LifecycleStateManager); + return getInstance(extension, LifecycleStateManager.class); + } + + public static PlatformManager getPlatformManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.PlatformManager); + return getInstance(extension, PlatformManager.class); + } + + public static VisibilityTypeManager getVisibilityTypeManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.VisibilityTypeManager); + return getInstance(extension, VisibilityTypeManager.class); + } + + public static VisibilityManager getVisibilityManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.VisibilityManager); + return getInstance(extension, VisibilityManager.class); + } + + public static SubscriptionManager getSubscriptionManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.SubscriptionManager); + return getInstance(extension, SubscriptionManager.class); + } + + public static ApplicationUploadManager getApplicationUploadManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.ApplicationUploadManager); + return getInstance(extension, ApplicationUploadManager.class); } - public static Document convertToDocument(File file) throws ApplicationManagementException { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); + private static T getInstance(Extension extension, Class cls) throws InvalidConfigurationException { try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - return docBuilder.parse(file); + Class theClass = Class.forName(extension.getClassName()); + if (extension.getParameters() != null && extension.getParameters().size() > 0) { + Class[] types = new Class[extension.getParameters().size()]; + Object[] paramValues = new String[extension.getParameters().size()]; + for (int i = 0; i < extension.getParameters().size(); i++) { + types[i] = String.class; + paramValues[i] = extension.getParameters().get(i).getValue(); + } + Constructor constructor = theClass.getConstructor(types); + return constructor.newInstance(paramValues); + } else { + Constructor constructor = theClass.getConstructor(); + return constructor.newInstance(); + } } catch (Exception e) { - throw new InvalidConfigurationException("Error occurred while parsing file, while converting " + - "to a org.w3c.dom.Document : ", e); + throw new InvalidConfigurationException("Unable to get instance of extension - " + extension.getName() + + " , for class - " + extension.getClassName(), e); } } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ConnectionManagerUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ConnectionManagerUtil.java index 61aad433c7..b7c7d4830b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ConnectionManagerUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ConnectionManagerUtil.java @@ -23,15 +23,11 @@ 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.IllegalTransactionStateException; import org.wso2.carbon.device.application.mgt.common.exception.TransactionManagementException; -import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; -import org.wso2.carbon.device.application.mgt.core.config.datasource.JNDILookupDefinition; import javax.naming.InitialContext; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; -import java.util.Hashtable; -import java.util.List; public class ConnectionManagerUtil { @@ -45,10 +41,6 @@ public class ConnectionManagerUtil { private static ThreadLocal currentTxState = new ThreadLocal<>(); private static DataSource dataSource; - public static void setDataSource(DataSource dataSource) { - ConnectionManagerUtil.dataSource = dataSource; - } - public static ThreadLocal getCurrentConnection() { return currentConnection; } @@ -168,49 +160,17 @@ public class ConnectionManagerUtil { /** * Resolve data source from the data source definition. * - * @param config data source configuration - * + * @param dataSourceName data source name */ - public static void resolveDataSource(DataSourceConfig config) { - if (config == null) { - throw new RuntimeException( - "Application Management Repository data source configuration " + "is null and " + - "thus, is not initialized" - ); - } - JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition(); - if (jndiConfig != null) { - if (log.isDebugEnabled()) { - log.debug("Initializing Application Management Repository data source using the JNDI " + - "Lookup Definition"); - } - List jndiPropertyList = - jndiConfig.getJndiProperties(); - if (jndiPropertyList != null) { - Hashtable jndiProperties = new Hashtable(); - for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) { - jndiProperties.put(prop.getName(), prop.getValue()); - } - dataSource = lookupDataSource(jndiConfig.getJndiName(), jndiProperties); - } else { - dataSource = lookupDataSource(jndiConfig.getJndiName(), null); - } - } - } - - - public static DataSource lookupDataSource(String dataSourceName, final Hashtable jndiProperties) { + public static void resolveDataSource(String dataSourceName) { try { - if (jndiProperties == null || jndiProperties.isEmpty()) { - return (DataSource) InitialContext.doLookup(dataSourceName); - } - final InitialContext context = new InitialContext(jndiProperties); - return (DataSource) context.doLookup(dataSourceName); + dataSource = InitialContext.doLookup(dataSourceName); } catch (Exception e) { throw new RuntimeException("Error in looking up data source: " + e.getMessage(), e); } } + public static String getDatabaseType() { try { return dataSource.getConnection().getMetaData().getDatabaseProductName(); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagerConstants.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java similarity index 83% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagerConstants.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java index 053b3f8e96..6ed1fe951a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagerConstants.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java @@ -18,14 +18,22 @@ */ package org.wso2.carbon.device.application.mgt.core.util; -public class ApplicationManagerConstants { +import org.wso2.carbon.utils.CarbonUtils; + +import java.io.File; + +public class Constants { public static final String APPLICATION_CONFIG_XML_FILE = "application-mgt.xml"; + public static final String DEFAULT_CONFIG_FILE_LOCATION = CarbonUtils.getCarbonConfigDirPath() + File.separator + + Constants.APPLICATION_CONFIG_XML_FILE; + public static final class DataBaseTypes { + private DataBaseTypes() { - throw new AssertionError(); } + public static final String DB_TYPE_MYSQL = "MySQL"; public static final String DB_TYPE_ORACLE = "Oracle"; public static final String DB_TYPE_MSSQL = "Microsoft SQL Server"; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ConfigurationTest.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ConfigurationTest.java new file mode 100644 index 0000000000..4040237b07 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ConfigurationTest.java @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* +*/ +package org.wso2.carbon.device.application.mgt.core; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException; +import org.wso2.carbon.device.application.mgt.core.config.Configuration; +import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager; + +import java.io.File; + +public class ConfigurationTest { + + @BeforeClass + public static void init() throws InvalidConfigurationException { + File configPath = new File("src/test/resources/application-mgt.xml"); + ConfigurationManager.setConfigLocation(configPath.getAbsolutePath()); + } + + @Test + public void validateConfiguration() { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Configuration configuration = configurationManager.getConfiguration(); + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml new file mode 100644 index 0000000000..c2cac41857 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml @@ -0,0 +1,61 @@ + + + + + + + jdbc/APPM_DS + + + + org.wso2.carbon.device.application.mgt.core.impl.ApplicationUploadManagerImpl + + repository/resources/mobileapps + + + + org.wso2.carbon.device.application.mgt.core.impl.ApplicationManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.ApplicationReleaseManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.CategoryManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.CommentsManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.LifecycleStateManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.PlatformManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.VisibilityManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.VisibilityTypeManagerImpl + + + + \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java deleted file mode 100644 index cd935e95d8..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java +++ /dev/null @@ -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 { - -} diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index 478fd3f5df..043f32a694 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -28,7 +28,6 @@ 4.0.0 application-mgt - org.wso2.carbon.devicemgt pom WSO2 Carbon - Application Management Component WSO2 Carbon - Application Management Component @@ -39,7 +38,7 @@ org.wso2.carbon.device.application.mgt.common org.wso2.carbon.device.application.mgt.api org.wso2.carbon.device.application.mgt.ui - org.wso2.carbon.device.application.mgt.extensions + diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.extensions.feature/pom.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.extensions.feature/pom.xml index 286d01f0c0..3aceaea044 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.extensions.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.extensions.feature/pom.xml @@ -80,7 +80,7 @@ p2-feature-gen - org.wso2.carbon.device.application.mgt.extensions + org.wso2.carbon.device.application.mgt.extensions.feature ../../../features/etc/feature.properties diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml index d96620cf59..87e8f0c203 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml @@ -100,7 +100,6 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.api.feature:${carbon.device.mgt.version} - org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.extensions.feature:${carbon.device.mgt.version} diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml index 539b5af3d5..fd99ffe3de 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml @@ -1,25 +1,60 @@ - + + - - - - jdbc/APPM_DS - - - + jdbc/APPM_DS + + + org.wso2.carbon.device.application.mgt.core.impl.ApplicationUploadManagerImpl + + repository/resources/mobileapps + + + + org.wso2.carbon.device.application.mgt.core.impl.ApplicationManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.ApplicationReleaseManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.CategoryManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.CommentsManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.LifecycleStateManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.PlatformManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.VisibilityManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.VisibilityTypeManagerImpl + + - - - - org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManagerImpl - - repository/resources/mobileapps - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml index e773738c3b..7038d24c55 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml @@ -1,5 +1,5 @@ org.wso2.carbon.device.application.mgt.server.feature \ No newline at end of file