revert-70aa11f8
milanperera 9 years ago
commit 256880089e

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>0.9.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
<version>0.9.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Webapp Publisher</name>
<description>WSO2 Carbon - API Management Webapp Publisher</description>
<url>http://wso2.org</url>
<dependencies>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.api</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.impl</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.tomcat</groupId>
<artifactId>tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>API Management Webapp Publisher</Bundle-Description>
<Private-Package>org.wso2.carbon.apimgt.webapp.publisher.internal</Private-Package>
<Export-Package>
!org.wso2.carbon.apimgt.webapp.publisher.internal,
org.wso2.carbon.apimgt.webapp.publisher.*
</Export-Package>
<Import-Package>
org.osgi.framework,
org.osgi.service.component,
org.apache.commons.logging,
javax.servlet,
javax.xml.bind.annotation,
org.apache.catalina,
org.apache.catalina.core,
org.wso2.carbon.apimgt.api,
org.wso2.carbon.apimgt.api.model,
org.wso2.carbon.apimgt.impl
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -16,12 +16,11 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.mgt.core.api.mgt; package org.wso2.carbon.apimgt.webapp.publisher;
import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.APIProvider; import org.wso2.carbon.apimgt.api.APIProvider;
import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.impl.APIManagerFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -55,11 +54,11 @@ public class APIConfig {
private APIProvider provider; private APIProvider provider;
private boolean isSecured; private boolean isSecured;
public void init() throws DeviceManagementException { public void init() throws APIManagementException {
try { try {
this.provider = APIManagerFactory.getInstance().getAPIProvider(this.getOwner()); this.provider = APIManagerFactory.getInstance().getAPIProvider(this.getOwner());
} catch (APIManagementException e) { } catch (APIManagementException e) {
throw new DeviceManagementException("Error occurred while initializing API provider", e); throw new APIManagementException("Error occurred while initializing API provider", e);
} }
} }

@ -16,7 +16,7 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.mgt.core.api.mgt; package org.wso2.carbon.apimgt.webapp.publisher;
import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.model.API; import org.wso2.carbon.apimgt.api.model.API;

@ -16,7 +16,7 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.mgt.core.api.mgt; package org.wso2.carbon.apimgt.webapp.publisher;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -54,8 +54,8 @@ public class APIPublisherServiceImpl implements APIPublisherService {
"'. Thus, the API config is updated"); "'. Thus, the API config is updated");
} }
} else { } else {
log.error("API provider configured for the given API configuration is null. Thus, the API is not " + throw new APIManagementException("API provider configured for the given API configuration is null. " +
"published"); "Thus, the API is not published");
} }
} }

@ -0,0 +1,98 @@
/*
* 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.apimgt.webapp.publisher;
import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.APIProvider;
import org.wso2.carbon.apimgt.api.model.API;
import org.wso2.carbon.apimgt.api.model.APIIdentifier;
import org.wso2.carbon.apimgt.api.model.APIStatus;
import org.wso2.carbon.apimgt.api.model.URITemplate;
import org.wso2.carbon.apimgt.impl.APIConstants;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
public class APIPublisherUtil {
enum HTTPMethod {
GET, POST, DELETE, PUT, OPTIONS
}
private static List<HTTPMethod> httpMethods;
static {
httpMethods = new ArrayList<HTTPMethod>();
httpMethods.add(HTTPMethod.GET);
httpMethods.add(HTTPMethod.POST);
httpMethods.add(HTTPMethod.DELETE);
httpMethods.add(HTTPMethod.PUT);
httpMethods.add(HTTPMethod.OPTIONS);
}
public static API getAPI(APIConfig config) throws APIManagementException {
APIProvider provider = config.getProvider();
APIIdentifier id = new APIIdentifier(config.getOwner(), config.getName(), config.getVersion());
API api = new API(id);
api.setApiOwner(config.getOwner());
api.setContext(config.getContext());
api.setUrl(config.getEndpoint());
api.setUriTemplates(
getURITemplates(config.getEndpoint(), APIConstants.AUTH_APPLICATION_OR_USER_LEVEL_TOKEN));
api.setVisibility(APIConstants.API_GLOBAL_VISIBILITY);
api.addAvailableTiers(provider.getTiers());
api.setEndpointSecured(true);
api.setStatus(APIStatus.PUBLISHED);
api.setTransports(config.getTransports());
return api;
}
private static Set<URITemplate> getURITemplates(String endpoint, String authType) {
Set<URITemplate> uriTemplates = new LinkedHashSet<URITemplate>();
if (APIConstants.AUTH_NO_AUTHENTICATION.equals(authType)) {
for (HTTPMethod method : httpMethods) {
URITemplate template = new URITemplate();
template.setAuthType(APIConstants.AUTH_NO_AUTHENTICATION);
template.setHTTPVerb(method.toString());
template.setResourceURI(endpoint);
template.setUriTemplate("/*");
uriTemplates.add(template);
}
} else {
for (HTTPMethod method : httpMethods) {
URITemplate template = new URITemplate();
if (HTTPMethod.OPTIONS.equals(method)) {
template.setAuthType(APIConstants.AUTH_NO_AUTHENTICATION);
} else {
template.setAuthType(APIConstants.AUTH_APPLICATION_OR_USER_LEVEL_TOKEN);
}
template.setHTTPVerb(method.toString());
template.setResourceURI(endpoint);
template.setUriTemplate("/*");
uriTemplates.add(template);
}
}
return uriTemplates;
}
}

@ -0,0 +1,44 @@
/*
* 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.apimgt.webapp.publisher.internal;
import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherService;
public class APIPublisherDataHolder {
private APIPublisherService apiPublisherService;
private static APIPublisherDataHolder thisInstance = new APIPublisherDataHolder();
private APIPublisherDataHolder() {
}
public static APIPublisherDataHolder getInstance() {
return thisInstance;
}
public APIPublisherService getApiPublisherService() {
return apiPublisherService;
}
public void setApiPublisherService(APIPublisherService apiPublisherService) {
this.apiPublisherService = apiPublisherService;
}
}

@ -0,0 +1,77 @@
/*
* 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.apimgt.webapp.publisher.internal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService;
import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherService;
import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherServiceImpl;
public class APIPublisherServiceComponent {
private static Log log = LogFactory.getLog(APIPublisherServiceComponent.class);
@SuppressWarnings("unused")
protected void activate(ComponentContext componentContext) {
try {
if (log.isDebugEnabled()) {
log.debug("Initializing device management core bundle");
}
/* Registering declarative service instances exposed by DeviceManagementServiceComponent */
this.registerServices(componentContext);
if (log.isDebugEnabled()) {
log.debug("Device management core bundle has been successfully initialized");
}
} catch (Throwable e) {
log.error("Error occurred while initializing device management core bundle", e);
}
}
@SuppressWarnings("unused")
protected void deactivate(ComponentContext componentContext) {
//do nothing
}
private void registerServices(ComponentContext componentContext) {
if (log.isDebugEnabled()) {
log.debug("Registering OSGi service DeviceManagementProviderServiceImpl");
}
/* Registering Device Management Service */
BundleContext bundleContext = componentContext.getBundleContext();
APIPublisherService publisher = new APIPublisherServiceImpl();
APIPublisherDataHolder.getInstance().setApiPublisherService(publisher);
bundleContext.registerService(APIPublisherService.class, publisher, null);
}
protected void setAPIManagerConfigurationService(APIManagerConfigurationService service) {
//do nothing
}
protected void unsetAPIManagerConfigurationService(APIManagerConfigurationService service) {
//do nothing
}
}

@ -16,7 +16,7 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.mgt.core.api.mgt.lifecycle.listener; package org.wso2.carbon.apimgt.webapp.publisher.lifecycle.listener;
import org.apache.catalina.Lifecycle; import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleEvent;
@ -25,15 +25,26 @@ import org.apache.catalina.core.StandardContext;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.apimgt.api.model.API; import org.wso2.carbon.apimgt.api.model.API;
import org.wso2.carbon.device.mgt.core.api.mgt.APIConfig; import org.wso2.carbon.apimgt.webapp.publisher.APIConfig;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherUtil;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil; import org.wso2.carbon.apimgt.webapp.publisher.internal.APIPublisherDataHolder;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
@SuppressWarnings("unused")
public class APIPublisherLifecycleListener implements LifecycleListener { public class APIPublisherLifecycleListener implements LifecycleListener {
private static final String API_CONFIG_DEFAULT_VERSION = "1.0.0"; private static final String API_CONFIG_DEFAULT_VERSION = "1.0.0";
private static final String PARAM_MANAGED_API_ENABLED = "managed-api-enabled";
private static final String PARAM_MANAGED_API_NAME = "managed-api-name";
private static final String PARAM_MANAGED_API_VERSION = "managed-api-version";
private static final String PARAM_MANAGED_API_CONTEXT = "managed-api-context";
private static final String PARAM_MANAGED_API_ENDPOINT = "managed-api-endpoint";
private static final String PARAM_MANAGED_API_OWNER = "managed-api-owner";
private static final String PARAM_MANAGED_API_TRANSPORTS = "managed-api-transports";
private static final String PARAM_MANAGED_API_IS_SECURED = "managed-api-isSecured";
private static final Log log = LogFactory.getLog(APIPublisherLifecycleListener.class); private static final Log log = LogFactory.getLog(APIPublisherLifecycleListener.class);
@Override @Override
@ -42,15 +53,15 @@ public class APIPublisherLifecycleListener implements LifecycleListener {
StandardContext context = (StandardContext) lifecycleEvent.getLifecycle(); StandardContext context = (StandardContext) lifecycleEvent.getLifecycle();
ServletContext servletContext = context.getServletContext(); ServletContext servletContext = context.getServletContext();
String param = servletContext.getInitParameter("managed-api-enabled"); String param = servletContext.getInitParameter(PARAM_MANAGED_API_ENABLED);
boolean isManagedApi = (param != null && !"".equals(param)) && Boolean.parseBoolean(param); boolean isManagedApi = (param != null && param.isEmpty()) && Boolean.parseBoolean(param);
if (isManagedApi) { if (isManagedApi) {
APIConfig apiConfig = this.buildApiConfig(servletContext); APIConfig apiConfig = this.buildApiConfig(servletContext);
try { try {
apiConfig.init(); apiConfig.init();
API api = DeviceManagerUtil.getAPI(apiConfig); API api = APIPublisherUtil.getAPI(apiConfig);
DeviceManagementDataHolder.getInstance().getApiPublisherService().publishAPI(api); APIPublisherDataHolder.getInstance().getApiPublisherService().publishAPI(api);
} catch (Throwable e) { } catch (Throwable e) {
/* Throwable is caught as none of the RuntimeExceptions that can potentially occur at this point /* Throwable is caught as none of the RuntimeExceptions that can potentially occur at this point
does not seem to be logged anywhere else within the framework */ does not seem to be logged anywhere else within the framework */
@ -64,8 +75,8 @@ public class APIPublisherLifecycleListener implements LifecycleListener {
private APIConfig buildApiConfig(ServletContext servletContext) { private APIConfig buildApiConfig(ServletContext servletContext) {
APIConfig apiConfig = new APIConfig(); APIConfig apiConfig = new APIConfig();
String name = servletContext.getInitParameter("managed-api-name"); String name = servletContext.getInitParameter(PARAM_MANAGED_API_NAME);
if (name == null || "".equals(name)) { if (name == null || name.isEmpty()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("'managed-api-name' attribute is not configured. Therefore, using the default, " + log.debug("'managed-api-name' attribute is not configured. Therefore, using the default, " +
"which is the name of the web application"); "which is the name of the web application");
@ -74,8 +85,8 @@ public class APIPublisherLifecycleListener implements LifecycleListener {
} }
apiConfig.setName(name); apiConfig.setName(name);
String version = servletContext.getInitParameter("managed-api-version"); String version = servletContext.getInitParameter(PARAM_MANAGED_API_VERSION);
if (version == null || "".equals(version)) { if (version == null || version.isEmpty()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("'managed-api-version' attribute is not configured. Therefore, using the " + log.debug("'managed-api-version' attribute is not configured. Therefore, using the " +
"default, which is '1.0.0'"); "default, which is '1.0.0'");
@ -84,8 +95,8 @@ public class APIPublisherLifecycleListener implements LifecycleListener {
} }
apiConfig.setVersion(version); apiConfig.setVersion(version);
String context = servletContext.getInitParameter("managed-api-context"); String context = servletContext.getInitParameter(PARAM_MANAGED_API_CONTEXT);
if (context == null || "".equals(context)) { if (context == null || context.isEmpty()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("'managed-api-context' attribute is not configured. Therefore, using the default, " + log.debug("'managed-api-context' attribute is not configured. Therefore, using the default, " +
"which is the original context assigned to the web application"); "which is the original context assigned to the web application");
@ -94,29 +105,29 @@ public class APIPublisherLifecycleListener implements LifecycleListener {
} }
apiConfig.setContext(context); apiConfig.setContext(context);
String endpoint = servletContext.getInitParameter("managed-api-endpoint"); String endpoint = servletContext.getInitParameter(PARAM_MANAGED_API_ENDPOINT);
if (endpoint == null || "".equals(endpoint)) { if (endpoint == null || endpoint.isEmpty()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("'managed-api-endpoint' attribute is not configured"); log.debug("'managed-api-endpoint' attribute is not configured");
} }
} }
apiConfig.setEndpoint(endpoint); apiConfig.setEndpoint(endpoint);
String owner = servletContext.getInitParameter("managed-api-owner"); String owner = servletContext.getInitParameter(PARAM_MANAGED_API_OWNER);
if (owner == null || "".equals(owner)) { if (owner == null || owner.isEmpty()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("'managed-api-owner' attribute is not configured"); log.debug("'managed-api-owner' attribute is not configured");
} }
} }
apiConfig.setOwner(owner); apiConfig.setOwner(owner);
String isSecuredParam = servletContext.getInitParameter("managed-api-isSecured"); String isSecuredParam = servletContext.getInitParameter(PARAM_MANAGED_API_IS_SECURED);
boolean isSecured = boolean isSecured =
(isSecuredParam != null && !"".equals(isSecuredParam)) && Boolean.parseBoolean(isSecuredParam); (isSecuredParam != null && !isSecuredParam.isEmpty()) && Boolean.parseBoolean(isSecuredParam);
apiConfig.setSecured(isSecured); apiConfig.setSecured(isSecured);
String transports = servletContext.getInitParameter("managed-api-transports"); String transports = servletContext.getInitParameter(PARAM_MANAGED_API_TRANSPORTS);
if (transports == null || "".equals(transports)) { if (transports == null || transports.isEmpty()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("'managed-api-transports' attribute is not configured. Therefore using the defaults, " + log.debug("'managed-api-transports' attribute is not configured. Therefore using the defaults, " +
"which are 'http' and 'https'"); "which are 'http' and 'https'");

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>0.9.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions</artifactId>
<version>0.9.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Component</name>
<url>http://wso2.org</url>
<modules>
<module>org.wso2.carbon.apimgt.webapp.publisher</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.7.2</version>
<executions>
<execution>
<id>generate-scr-scrdescriptor</id>
<goals>
<goal>scr</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

@ -18,6 +18,8 @@
package org.wso2.carbon.device.mgt.common; package org.wso2.carbon.device.mgt.common;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import java.util.List; import java.util.List;
@ -144,4 +146,8 @@ public interface DeviceManager {
boolean setStatus(DeviceIdentifier deviceId, String currentOwner, boolean setStatus(DeviceIdentifier deviceId, String currentOwner,
EnrolmentInfo.Status status) throws DeviceManagementException; EnrolmentInfo.Status status) throws DeviceManagementException;
License getLicense(String languageCode) throws LicenseManagementException;
void addLicense(License license) throws LicenseManagementException;
} }

@ -22,6 +22,6 @@ public interface LicenseManager {
License getLicense(String deviceType, String languageCode) throws LicenseManagementException; License getLicense(String deviceType, String languageCode) throws LicenseManagementException;
boolean addLicense(String deviceType, License license) throws LicenseManagementException; void addLicense(String deviceType, License license) throws LicenseManagementException;
} }

@ -17,7 +17,8 @@
~ under the License. ~ under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
@ -69,23 +70,13 @@
org.wso2.carbon.device.mgt.common.*, org.wso2.carbon.device.mgt.common.*,
org.wso2.carbon.user.api, org.wso2.carbon.user.api,
org.wso2.carbon.user.core.*, org.wso2.carbon.user.core.*,
org.wso2.carbon.registry.core,
org.wso2.carbon.registry.core.exceptions,
org.wso2.carbon.registry.core.service, org.wso2.carbon.registry.core.service,
org.wso2.carbon.registry.core.session,
org.w3c.dom, org.w3c.dom,
org.wso2.carbon.governance.api.exception,
org.wso2.carbon.governance.api.generic,
org.wso2.carbon.governance.api.generic.dataobjects,
org.wso2.carbon.apimgt.api,
org.wso2.carbon.apimgt.api.model,
org.wso2.carbon.apimgt.impl,
org.wso2.carbon.identity.oauth.stub, org.wso2.carbon.identity.oauth.stub,
org.wso2.carbon.identity.oauth.stub.dto, org.wso2.carbon.identity.oauth.stub.dto,
org.wso2.carbon.ndatasource.core, org.wso2.carbon.ndatasource.core,
org.apache.catalina, org.wso2.carbon.apimgt.impl,
org.apache.catalina.core, org.wso2.carbon.ndatasource.core
javax.servlet
</Import-Package> </Import-Package>
<Export-Package> <Export-Package>
!org.wso2.carbon.device.mgt.core.internal, !org.wso2.carbon.device.mgt.core.internal,

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.core.api.mgt; package org.wso2.carbon.device.mgt.core.app.mgt;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.Application;

@ -29,19 +29,16 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants; import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository; import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository;
import org.wso2.carbon.device.mgt.core.api.mgt.ApplicationManagementProviderService;
import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig; import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig;
import org.wso2.carbon.device.mgt.core.app.mgt.oauth.ServiceAuthenticator; import org.wso2.carbon.device.mgt.core.app.mgt.oauth.ServiceAuthenticator;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.identity.IdentityConfigurations; import org.wso2.carbon.device.mgt.core.config.identity.IdentityConfigurations;
import org.wso2.carbon.device.mgt.core.dao.*; import org.wso2.carbon.device.mgt.core.dao.*;
import org.wso2.carbon.device.mgt.core.internal.PluginInitializationListener; import org.wso2.carbon.device.mgt.core.internal.PluginInitializationListener;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import org.wso2.carbon.identity.oauth.stub.OAuthAdminServiceException; import org.wso2.carbon.identity.oauth.stub.OAuthAdminServiceException;
import org.wso2.carbon.identity.oauth.stub.OAuthAdminServiceStub; import org.wso2.carbon.identity.oauth.stub.OAuthAdminServiceStub;
import org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO; import org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO;

@ -22,7 +22,6 @@ package org.wso2.carbon.device.mgt.core.internal;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.core.api.mgt.APIPublisherService;
import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig; import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig;
import org.wso2.carbon.device.mgt.core.config.license.LicenseConfig; import org.wso2.carbon.device.mgt.core.config.license.LicenseConfig;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
@ -39,7 +38,6 @@ public class DeviceManagementDataHolder {
private LicenseManager licenseManager; private LicenseManager licenseManager;
private RegistryService registryService; private RegistryService registryService;
private LicenseConfig licenseConfig; private LicenseConfig licenseConfig;
private APIPublisherService apiPublisherService;
private ApplicationManager appManager; private ApplicationManager appManager;
private AppManagementConfig appManagerConfig; private AppManagementConfig appManagerConfig;
private OperationManager operationManager; private OperationManager operationManager;
@ -106,14 +104,6 @@ public class DeviceManagementDataHolder {
this.licenseConfig = licenseConfig; this.licenseConfig = licenseConfig;
} }
public APIPublisherService getApiPublisherService() {
return apiPublisherService;
}
public void setApiPublisherService(APIPublisherService apiPublisherService) {
this.apiPublisherService = apiPublisherService;
}
public ApplicationManager getAppManager() { public ApplicationManager getAppManager() {
return appManager; return appManager;
} }

@ -25,28 +25,19 @@ import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService;
import org.wso2.carbon.core.ServerStartupObserver; import org.wso2.carbon.core.ServerStartupObserver;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants; import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository; import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository;
import org.wso2.carbon.device.mgt.core.api.mgt.APIPublisherService; import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService;
import org.wso2.carbon.device.mgt.core.api.mgt.APIPublisherServiceImpl;
import org.wso2.carbon.device.mgt.core.api.mgt.ApplicationManagementProviderService;
import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagerProviderServiceImpl; import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagerProviderServiceImpl;
import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig; import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig;
import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfigurationManager; import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig; import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig;
import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
import org.wso2.carbon.device.mgt.core.config.license.LicenseConfig;
import org.wso2.carbon.device.mgt.core.config.license.LicenseConfigurationManager;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.license.mgt.LicenseManagementService;
import org.wso2.carbon.device.mgt.core.license.mgt.LicenseManagerImpl;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationManagerImpl; import org.wso2.carbon.device.mgt.core.operation.mgt.OperationManagerImpl;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
@ -109,6 +100,7 @@ public class DeviceManagementServiceComponent {
private static List<PluginInitializationListener> listeners = new ArrayList<PluginInitializationListener>(); private static List<PluginInitializationListener> listeners = new ArrayList<PluginInitializationListener>();
private static List<DeviceManagementService> deviceManagers = new ArrayList<DeviceManagementService>(); private static List<DeviceManagementService> deviceManagers = new ArrayList<DeviceManagementService>();
@SuppressWarnings("unused")
protected void activate(ComponentContext componentContext) { protected void activate(ComponentContext componentContext) {
try { try {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
@ -122,8 +114,6 @@ public class DeviceManagementServiceComponent {
DataSourceConfig dsConfig = config.getDeviceManagementConfigRepository().getDataSourceConfig(); DataSourceConfig dsConfig = config.getDeviceManagementConfigRepository().getDataSourceConfig();
DeviceManagementDAOFactory.init(dsConfig); DeviceManagementDAOFactory.init(dsConfig);
/* Initializing license manager */
this.initLicenseManager();
/*Initialize Operation Manager*/ /*Initialize Operation Manager*/
this.initOperationsManager(); this.initOperationsManager();
@ -137,7 +127,6 @@ public class DeviceManagementServiceComponent {
"begin"); "begin");
} }
this.setupDeviceManagementSchema(dsConfig); this.setupDeviceManagementSchema(dsConfig);
this.setupDefaultLicenses(DeviceManagementDataHolder.getInstance().getLicenseConfig());
} }
/* Registering declarative service instances exposed by DeviceManagementServiceComponent */ /* Registering declarative service instances exposed by DeviceManagementServiceComponent */
@ -151,6 +140,7 @@ public class DeviceManagementServiceComponent {
} }
} }
@SuppressWarnings("unused")
protected void deactivate(ComponentContext componentContext) { protected void deactivate(ComponentContext componentContext) {
//do nothing //do nothing
} }
@ -164,16 +154,6 @@ public class DeviceManagementServiceComponent {
} }
} }
private void initLicenseManager() throws LicenseManagementException {
LicenseConfigurationManager.getInstance().initConfig();
LicenseConfig licenseConfig =
LicenseConfigurationManager.getInstance().getLicenseConfig();
LicenseManager licenseManager = new LicenseManagerImpl();
DeviceManagementDataHolder.getInstance().setLicenseManager(licenseManager);
DeviceManagementDataHolder.getInstance().setLicenseConfig(licenseConfig);
}
private void initOperationsManager() throws OperationManagementException { private void initOperationsManager() throws OperationManagementException {
OperationManager operationManager = new OperationManagerImpl(); OperationManager operationManager = new OperationManagerImpl();
DeviceManagementDataHolder.getInstance().setOperationManager(operationManager); DeviceManagementDataHolder.getInstance().setOperationManager(operationManager);
@ -189,14 +169,6 @@ public class DeviceManagementServiceComponent {
DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(deviceManagementProvider); DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(deviceManagementProvider);
bundleContext.registerService(DeviceManagementProviderService.class.getName(), deviceManagementProvider, null); bundleContext.registerService(DeviceManagementProviderService.class.getName(), deviceManagementProvider, null);
LicenseManagementService licenseManagementService = new LicenseManagementService();
DeviceManagementDataHolder.getInstance().setLicenseManager(new LicenseManagerImpl());
bundleContext.registerService(LicenseManagementService.class.getName(), licenseManagementService, null);
APIPublisherService publisher = new APIPublisherServiceImpl();
DeviceManagementDataHolder.getInstance().setApiPublisherService(publisher);
bundleContext.registerService(APIPublisherService.class, publisher, null);
/* Registering App Management service */ /* Registering App Management service */
try { try {
AppManagementConfigurationManager.getInstance().initConfig(); AppManagementConfigurationManager.getInstance().initConfig();
@ -225,17 +197,6 @@ public class DeviceManagementServiceComponent {
} }
} }
private void setupDefaultLicenses(LicenseConfig licenseConfig)
throws LicenseManagementException {
LicenseManager licenseManager = DeviceManagementDataHolder.getInstance().getLicenseManager();
for (License license : licenseConfig.getLicenses()) {
License extLicense = licenseManager.getLicense(license.getName(), license.getLanguage());
if (extLicense == null) {
licenseManager.addLicense(license.getName(), license);
}
}
}
/** /**
* Sets Device Manager service. * Sets Device Manager service.
* *

@ -21,6 +21,7 @@ import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.DeviceManager; import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import java.util.List; import java.util.List;
@ -29,9 +30,9 @@ import java.util.List;
* Proxy class for all Device Management related operations that take the corresponding plugin type in * Proxy class for all Device Management related operations that take the corresponding plugin type in
* and resolve the appropriate plugin implementation * and resolve the appropriate plugin implementation
*/ */
public interface DeviceManagementProviderService extends DeviceManager, LicenseManager, OperationManager { public interface DeviceManagementProviderService extends OperationManager {
List<Device> getAllDevices(String type) throws DeviceManagementException; List<Device> getAllDevices(String deviceType) throws DeviceManagementException;
List<Device> getAllDevices() throws DeviceManagementException; List<Device> getAllDevices() throws DeviceManagementException;
@ -39,17 +40,17 @@ public interface DeviceManagementProviderService extends DeviceManager, LicenseM
void sendRegistrationEmail(EmailMessageProperties config) throws DeviceManagementException; void sendRegistrationEmail(EmailMessageProperties config) throws DeviceManagementException;
FeatureManager getFeatureManager(String type) throws DeviceManagementException; FeatureManager getFeatureManager(String deviceType) throws DeviceManagementException;
/** /**
* Proxy method to get the tenant configuration of a given platform. * Proxy method to get the tenant configuration of a given platform.
* *
* @param type Device platform * @param deviceType Device platform
* @return Tenant configuration settings of the particular tenant and platform. * @return Tenant configuration settings of the particular tenant and platform.
* @throws DeviceManagementException If some unusual behaviour is observed while fetching the * @throws DeviceManagementException If some unusual behaviour is observed while fetching the
* configuration. * configuration.
*/ */
TenantConfiguration getConfiguration(String type) throws DeviceManagementException; TenantConfiguration getConfiguration(String deviceType) throws DeviceManagementException;
/** /**
* Method to get the list of devices owned by an user. * Method to get the list of devices owned by an user.
@ -99,4 +100,38 @@ public interface DeviceManagementProviderService extends DeviceManager, LicenseM
* @throws DeviceManagementException * @throws DeviceManagementException
*/ */
List<Device> getDevicesByStatus(EnrolmentInfo.Status status) throws DeviceManagementException; List<Device> getDevicesByStatus(EnrolmentInfo.Status status) throws DeviceManagementException;
License getLicense(String deviceType, String languageCode) throws DeviceManagementException;
void addLicense(String deviceType, License license) throws DeviceManagementException;
boolean modifyEnrollment(Device device) throws DeviceManagementException;
boolean enrollDevice(Device device) throws DeviceManagementException;
TenantConfiguration getConfiguration() throws DeviceManagementException;
boolean saveConfiguration(TenantConfiguration configuration) throws DeviceManagementException;
boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException;
boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException;
boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException;
boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException;
Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException;
boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException;
boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException;
boolean isClaimable(DeviceIdentifier deviceId) throws DeviceManagementException;
boolean setStatus(DeviceIdentifier deviceId, String currentOwner,
EnrolmentInfo.Status status) throws DeviceManagementException;
} }

@ -67,7 +67,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
DeviceManagementServiceComponent.registerPluginInitializationListener(this); DeviceManagementServiceComponent.registerPluginInitializationListener(this);
} }
/** /**
* This constructor calls from unit tests * This constructor calls from unit tests
* *
@ -85,13 +84,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
} }
@Override @Override
public FeatureManager getFeatureManager() { public boolean saveConfiguration(TenantConfiguration configuration) throws DeviceManagementException {
return null;
}
@Override
public boolean saveConfiguration(TenantConfiguration configuration)
throws DeviceManagementException {
DeviceManager dms = DeviceManager dms =
this.getPluginRepository().getDeviceManagementService(configuration.getType()).getDeviceManager(); this.getPluginRepository().getDeviceManagementService(configuration.getType()).getDeviceManager();
return dms.saveConfiguration(configuration); return dms.saveConfiguration(configuration);
@ -261,8 +254,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
} }
@Override @Override
public boolean setActive(DeviceIdentifier deviceId, boolean status) public boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException {
throws DeviceManagementException {
DeviceManager dms = DeviceManager dms =
this.getPluginRepository().getDeviceManagementService(deviceId.getType()).getDeviceManager(); this.getPluginRepository().getDeviceManagementService(deviceId.getType()).getDeviceManager();
return dms.setActive(deviceId, status); return dms.setActive(deviceId, status);
@ -497,8 +489,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
} }
@Override @Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException {
throws DeviceManagementException {
DeviceManager dms = DeviceManager dms =
this.getPluginRepository().getDeviceManagementService(deviceId.getType()).getDeviceManager(); this.getPluginRepository().getDeviceManagementService(deviceId.getType()).getDeviceManager();
return dms.setOwnership(deviceId, ownershipType); return dms.setOwnership(deviceId, ownershipType);
@ -540,13 +531,27 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
} }
@Override @Override
public License getLicense(String deviceType, String languageCode) throws LicenseManagementException { public License getLicense(String deviceType, String languageCode) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getLicenseManager().getLicense(deviceType, languageCode); DeviceManager dms =
this.getPluginRepository().getDeviceManagementService(deviceType).getDeviceManager();
try {
return dms.getLicense(languageCode);
} catch (LicenseManagementException e) {
throw new DeviceManagementException("Error occurred while retrieving license configured for " +
"device type '" + deviceType + "' and language code '" + languageCode + "'", e);
}
} }
@Override @Override
public boolean addLicense(String type, License license) throws LicenseManagementException { public void addLicense(String deviceType, License license) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getLicenseManager().addLicense(type, license); DeviceManager dms =
this.getPluginRepository().getDeviceManagementService(deviceType).getDeviceManager();
try {
dms.addLicense(license);
} catch (LicenseManagementException e) {
throw new DeviceManagementException("Error occurred while adding license for " +
"device type '" + deviceType + "'", e);
}
} }
private DeviceManagementPluginRepository getPluginRepository() { private DeviceManagementPluginRepository getPluginRepository() {

@ -20,18 +20,9 @@ package org.wso2.carbon.device.mgt.core.util;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.APIProvider;
import org.wso2.carbon.apimgt.api.model.API;
import org.wso2.carbon.apimgt.api.model.APIIdentifier;
import org.wso2.carbon.apimgt.api.model.APIStatus;
import org.wso2.carbon.apimgt.api.model.URITemplate;
import org.wso2.carbon.apimgt.impl.APIConstants;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.core.api.mgt.APIConfig;
import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
import org.wso2.carbon.device.mgt.core.config.datasource.JNDILookupDefinition; import org.wso2.carbon.device.mgt.core.config.datasource.JNDILookupDefinition;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
@ -44,27 +35,15 @@ import javax.sql.DataSource;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File; import java.io.File;
import java.util.*; import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
public final class DeviceManagerUtil { public final class DeviceManagerUtil {
private static final Log log = LogFactory.getLog(DeviceManagerUtil.class); private static final Log log = LogFactory.getLog(DeviceManagerUtil.class);
enum HTTPMethod {
GET, POST, DELETE, PUT, OPTIONS
}
private static List<HTTPMethod> httpMethods;
static {
httpMethods = new ArrayList<HTTPMethod>();
httpMethods.add(HTTPMethod.GET);
httpMethods.add(HTTPMethod.POST);
httpMethods.add(HTTPMethod.DELETE);
httpMethods.add(HTTPMethod.PUT);
httpMethods.add(HTTPMethod.OPTIONS);
}
public static Document convertToDocument(File file) throws DeviceManagementException { public static Document convertToDocument(File file) throws DeviceManagementException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true); factory.setNamespaceAware(true);
@ -168,52 +147,4 @@ public final class DeviceManagerUtil {
return ctx.getTenantId(); return ctx.getTenantId();
} }
public static API getAPI(APIConfig config) throws APIManagementException {
APIProvider provider = config.getProvider();
APIIdentifier id = new APIIdentifier(config.getOwner(), config.getName(), config.getVersion());
API api = new API(id);
api.setApiOwner(config.getOwner());
api.setContext(config.getContext());
api.setUrl(config.getEndpoint());
api.setUriTemplates(
getURITemplates(config.getEndpoint(), APIConstants.AUTH_APPLICATION_OR_USER_LEVEL_TOKEN));
api.setVisibility(APIConstants.API_GLOBAL_VISIBILITY);
api.addAvailableTiers(provider.getTiers());
api.setEndpointSecured(true);
api.setStatus(APIStatus.PUBLISHED);
api.setTransports(config.getTransports());
return api;
}
private static Set<URITemplate> getURITemplates(String endpoint, String authType) {
Set<URITemplate> uriTemplates = new LinkedHashSet<URITemplate>();
if (APIConstants.AUTH_NO_AUTHENTICATION.equals(authType)) {
for (HTTPMethod method : httpMethods) {
URITemplate template = new URITemplate();
template.setAuthType(APIConstants.AUTH_NO_AUTHENTICATION);
template.setHTTPVerb(method.toString());
template.setResourceURI(endpoint);
template.setUriTemplate("/*");
uriTemplates.add(template);
}
} else {
for (HTTPMethod method : httpMethods) {
URITemplate template = new URITemplate();
if (HTTPMethod.OPTIONS.equals(method)) {
template.setAuthType(APIConstants.AUTH_NO_AUTHENTICATION);
} else {
template.setAuthType(APIConstants.AUTH_APPLICATION_OR_USER_LEVEL_TOKEN);
}
template.setHTTPVerb(method.toString());
template.setResourceURI(endpoint);
template.setUriTemplate("/*");
uriTemplates.add(template);
}
}
return uriTemplates;
}
} }

@ -16,14 +16,18 @@
package org.wso2.carbon.device.mgt.core; package org.wso2.carbon.device.mgt.core;
import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import java.util.List; import java.util.List;
import java.util.Map;
public class TestDeviceManager implements DeviceManager { public class TestDeviceManager implements DeviceManager {
public TestDeviceManager() {
}
@Override @Override
public FeatureManager getFeatureManager() { public FeatureManager getFeatureManager() {
return null; return null;
@ -101,4 +105,15 @@ public class TestDeviceManager implements DeviceManager {
throws DeviceManagementException { throws DeviceManagementException {
return false; return false;
} }
@Override
public License getLicense(String languageCode) throws LicenseManagementException {
return null;
}
@Override
public void addLicense(License license) throws LicenseManagementException {
}
} }

@ -27,8 +27,6 @@ import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository; import org.wso2.carbon.device.mgt.core.DeviceManagementPluginRepository;
import org.wso2.carbon.device.mgt.core.TestDeviceManagementService; import org.wso2.carbon.device.mgt.core.TestDeviceManagementService;
import org.wso2.carbon.device.mgt.core.api.mgt.ApplicationManagementProviderService;
import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagerProviderServiceImpl;
import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig; import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig;
import org.wso2.carbon.device.mgt.core.common.TestDataHolder; import org.wso2.carbon.device.mgt.core.common.TestDataHolder;

@ -24,17 +24,17 @@
<test name="DAO Unit Tests" preserve-order="true"> <test name="DAO Unit Tests" preserve-order="true">
<classes> <classes>
<!--<class name="org.wso2.carbon.device.mgt.core.common.BaseDeviceManagementTest"/>--> <class name="org.wso2.carbon.device.mgt.core.common.BaseDeviceManagementTest"/>
<!--<class name="org.wso2.carbon.device.mgt.core.dao.DevicePersistTests"/>--> <class name="org.wso2.carbon.device.mgt.core.dao.DevicePersistTests"/>
<!--<class name="org.wso2.carbon.device.mgt.core.DeviceManagementRepositoryTests"/>--> <class name="org.wso2.carbon.device.mgt.core.DeviceManagementRepositoryTests"/>
<!--<class name="org.wso2.carbon.device.mgt.core.DeviceManagementConfigTests"/>--> <class name="org.wso2.carbon.device.mgt.core.DeviceManagementConfigTests"/>
<!--<class name="org.wso2.carbon.device.mgt.core.dao.ApplicationPersistenceTests"/>--> <class name="org.wso2.carbon.device.mgt.core.dao.ApplicationPersistenceTests"/>
</classes> </classes>
</test> </test>
<test name="Service Unit Tests" preserve-order="true"> <test name="Service Unit Tests" preserve-order="true">
<classes> <classes>
<!--<class name="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceTest"/>--> <class name="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceTest"/>
<!--<class name="org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderServiceTest"/>--> <class name="org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderServiceTest"/>
</classes> </classes>
</test> </test>
</suite> </suite>

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>0.9.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions</artifactId>
<version>0.9.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Device Management Extensions</name>
<description>WSO2 Carbon - Device Management Extensions</description>
<url>http://wso2.org</url>
<dependencies>
<dependency>
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.api</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.registry.api</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.registry.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>Device Management Extensions Bundle</Bundle-Description>
<Export-Package>
org.wso2.carbon.device.mgt.extensions.*
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -16,12 +16,11 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.mgt.core.license.mgt; package org.wso2.carbon.device.mgt.extensions.license.mgt;
import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.governance.api.generic.GenericArtifactManager; import org.wso2.carbon.governance.api.generic.GenericArtifactManager;
import org.wso2.carbon.registry.api.Registry; import org.wso2.carbon.registry.api.Registry;
import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.exceptions.RegistryException;
@ -35,21 +34,10 @@ public class GenericArtifactManagerFactory {
new HashMap<Integer, GenericArtifactManager>(); new HashMap<Integer, GenericArtifactManager>();
private static final Object lock = new Object(); private static final Object lock = new Object();
public static GenericArtifactManager getTenantAwareGovernanceArtifactManager() throws public static GenericArtifactManager getTenantAwareGovernanceArtifactManager(
LicenseManagementException { Registry registry) throws LicenseManagementException {
Registry registry;
int tenantId;
try {
tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
registry =
DeviceManagementDataHolder.getInstance().getRegistryService().getGovernanceSystemRegistry(
tenantId);
} catch (RegistryException e) {
throw new LicenseManagementException("Error occurred while initializing tenant system registry " +
"to be used to manipulate License artifacts", e);
}
try { try {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
GenericArtifactManager artifactManager; GenericArtifactManager artifactManager;
synchronized (lock) { synchronized (lock) {
artifactManager = artifactManager =

@ -16,23 +16,23 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.mgt.core.license.mgt; package org.wso2.carbon.device.mgt.extensions.license.mgt;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
public class LicenseManagementService implements LicenseManager { public class LicenseManagementService implements LicenseManager {
@Override @Override
public License getLicense(String deviceType, String languageCode) throws LicenseManagementException { public License getLicense(String deviceType, String languageCode) throws LicenseManagementException {
return DeviceManagementDataHolder.getInstance().getLicenseManager().getLicense(deviceType, languageCode); //return DeviceManagementDataHolder.getInstance().getLicenseManager().getLicense(deviceType, languageCode);
return null;
} }
@Override @Override
public boolean addLicense(String deviceType, License license) throws LicenseManagementException { public void addLicense(String deviceType, License license) throws LicenseManagementException {
return DeviceManagementDataHolder.getInstance().getLicenseManager().addLicense(deviceType, license); //return DeviceManagementDataHolder.getInstance().getLicenseManager().addLicense(deviceType, license);
} }
} }

@ -16,7 +16,7 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.mgt.core.license.mgt; package org.wso2.carbon.device.mgt.extensions.license.mgt;
public class LicenseManagementUtil { public class LicenseManagementUtil {

@ -17,7 +17,7 @@
* *
*/ */
package org.wso2.carbon.device.mgt.core.license.mgt; package org.wso2.carbon.device.mgt.extensions.license.mgt;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
@ -27,19 +27,36 @@ import org.wso2.carbon.governance.api.exception.GovernanceException;
import org.wso2.carbon.governance.api.generic.GenericArtifactFilter; import org.wso2.carbon.governance.api.generic.GenericArtifactFilter;
import org.wso2.carbon.governance.api.generic.GenericArtifactManager; import org.wso2.carbon.governance.api.generic.GenericArtifactManager;
import org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact; import org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact;
import org.wso2.carbon.registry.api.Registry;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import java.lang.String;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Locale; import java.util.Locale;
public class LicenseManagerImpl implements LicenseManager { public class RegistryBasedLicenseManager implements LicenseManager {
private Registry registry;
private GenericArtifactManager artifactManager;
public RegistryBasedLicenseManager(Registry registry) {
if (registry == null) {
throw new IllegalArgumentException("Registry instance provided is null. Hence, " +
"'Registry based license manager cannot be initialized'");
}
this.registry = registry;
try {
this.artifactManager = GenericArtifactManagerFactory.getTenantAwareGovernanceArtifactManager(registry);
} catch (LicenseManagementException e) {
throw new IllegalStateException("Failed to initialize generic artifact manager bound to " +
"Registry based license manager", e);
}
}
@Override @Override
public License getLicense(final String deviceType, final String languageCode) throws LicenseManagementException { public License getLicense(final String deviceType, final String languageCode) throws LicenseManagementException {
GenericArtifactManager artifactManager =
GenericArtifactManagerFactory.getTenantAwareGovernanceArtifactManager();
try { try {
GenericArtifact[] artifacts = artifactManager.findGenericArtifacts(new GenericArtifactFilter() { GenericArtifact[] artifacts = artifactManager.findGenericArtifacts(new GenericArtifactFilter() {
@Override @Override
@ -82,9 +99,9 @@ public class LicenseManagerImpl implements LicenseManager {
} }
@Override @Override
public boolean addLicense(String deviceType, License license) throws LicenseManagementException { public void addLicense(final String deviceType, final License license) throws LicenseManagementException {
GenericArtifactManager artifactManager = GenericArtifactManager artifactManager =
GenericArtifactManagerFactory.getTenantAwareGovernanceArtifactManager(); GenericArtifactManagerFactory.getTenantAwareGovernanceArtifactManager(registry);
try { try {
GenericArtifact artifact = GenericArtifact artifact =
artifactManager.newGovernanceArtifact(new QName("http://www.wso2.com", artifactManager.newGovernanceArtifact(new QName("http://www.wso2.com",
@ -99,7 +116,6 @@ public class LicenseManagerImpl implements LicenseManager {
artifact.setAttribute(DeviceManagementConstants.LicenseProperties.VALID_FROM, artifact.setAttribute(DeviceManagementConstants.LicenseProperties.VALID_FROM,
license.getValidFrom().toString()); license.getValidFrom().toString());
artifactManager.addGenericArtifact(artifact); artifactManager.addGenericArtifact(artifact);
return true;
} catch (GovernanceException e) { } catch (GovernanceException e) {
throw new LicenseManagementException("Error occurred while adding license for device type " + throw new LicenseManagementException("Error occurred while adding license for device type " +
deviceType + "'", e); deviceType + "'", e);

@ -37,6 +37,7 @@
<modules> <modules>
<module>org.wso2.carbon.device.mgt.core</module> <module>org.wso2.carbon.device.mgt.core</module>
<module>org.wso2.carbon.device.mgt.common</module> <module>org.wso2.carbon.device.mgt.common</module>
<module>org.wso2.carbon.device.mgt.extensions</module>
</modules> </modules>
<build> <build>

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>0.9.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>0.9.2-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Webapp Publisher Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing
JAX-RS web applications as 'Managed APIs'
</description>
<dependencies>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>src/main/resources</outputDirectory>
<resources>
<resource>
<directory>resources</directory>
<includes>
<include>build.properties</include>
<include>p2.inf</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>${carbon.p2.plugin.version}</version>
<executions>
<execution>
<id>p2-feature-generation</id>
<phase>package</phase>
<goals>
<goal>p2-feature-gen</goal>
</goals>
<configuration>
<id>org.wso2.carbon.apimgt.webapp.publisher</id>
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
<adviceFile>
<properties>
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
<propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
</properties>
</adviceFile>
<bundles>
<bundleDef>
org.wso2.carbon.devicemgt:org.wso2.carbon.apimgt.webapp.publisher:${carbon.device.mgt.version}
</bundleDef>
</bundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}</importFeatureDef>
</importFeatures>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>0.9.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>0.9.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Feature</name>
<url>http://wso2.org</url>
<modules>
<module>org.wso2.carbon.apimgt.webapp.publisher.feature</module>
</modules>
</project>

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>0.9.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.feature</artifactId>
<packaging>pom</packaging>
<version>0.9.2-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Extensions Feature</name>
<url>http://wso2.org</url>
<description>This feature contains common extensions used by key device management functionalities
</description>
<dependencies>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.extensions</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>src/main/resources</outputDirectory>
<resources>
<resource>
<directory>resources</directory>
<includes>
<include>build.properties</include>
<include>p2.inf</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>${carbon.p2.plugin.version}</version>
<executions>
<execution>
<id>p2-feature-generation</id>
<phase>package</phase>
<goals>
<goal>p2-feature-gen</goal>
</goals>
<configuration>
<id>org.wso2.carbon.device.mgt.extensions</id>
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
<adviceFile>
<properties>
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
<propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
</properties>
</adviceFile>
<bundles>
<bundleDef>
org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.extensions:${carbon.device.mgt.version}
</bundleDef>
<bundleDef>
org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.common:${carbon.device.mgt.version}
</bundleDef>
</bundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}
</importFeatureDef>
<importFeatureDef>org.wso2.carbon.governance.metadata:${carbon.governance.version}
</importFeatureDef>
</importFeatures>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -113,16 +113,9 @@
</bundleDef> </bundleDef>
</bundles> </bundles>
<importFeatures> <importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version} <importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}</importFeatureDef>
</importFeatureDef> <importFeatureDef>org.wso2.carbon.apimgt.core:${carbon.api.mgt.version}</importFeatureDef>
<importFeatureDef>org.wso2.carbon.governance.metadata:${carbon.governance.version} <importFeatureDef>org.wso2.carbon.device.mgt.extensions:${carbon.device.mgt.version}</importFeatureDef>
</importFeatureDef>
<importFeatureDef>org.wso2.carbon.apimgt.core:${carbon.api.mgt.version}
</importFeatureDef>
<!--
<importFeatureDef>org.wso2.carbon.transaction.manager:${carbon.commons.version}
</importFeatureDef>
-->
</importFeatures> </importFeatures>
</configuration> </configuration>
</execution> </execution>

@ -36,6 +36,7 @@
<modules> <modules>
<module>org.wso2.carbon.device.mgt.server.feature</module> <module>org.wso2.carbon.device.mgt.server.feature</module>
<module>org.wso2.carbon.device.mgt.extensions.feature</module>
</modules> </modules>
</project> </project>

@ -37,10 +37,12 @@
<modules> <modules>
<module>components/device-mgt</module> <module>components/device-mgt</module>
<module>components/apimgt-extensions</module>
<module>components/policy-mgt</module> <module>components/policy-mgt</module>
<module>components/webapp-authenticator-framework</module> <module>components/webapp-authenticator-framework</module>
<module>components/oauth-extensions</module> <module>components/oauth-extensions</module>
<module>features/device-mgt</module> <module>features/device-mgt</module>
<module>features/apimgt-extensions</module>
<module>features/policy-mgt</module> <module>features/policy-mgt</module>
<module>features/webapp-authenticator-framework</module> <module>features/webapp-authenticator-framework</module>
<module>features/oauth-extensions</module> <module>features/oauth-extensions</module>
@ -126,6 +128,11 @@
<artifactId>org.wso2.carbon.device.mgt.common</artifactId> <artifactId>org.wso2.carbon.device.mgt.common</artifactId>
<version>${carbon.device.mgt.version}</version> <version>${carbon.device.mgt.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.extensions</artifactId>
<version>${carbon.device.mgt.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId> <artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
@ -152,9 +159,9 @@
<version>${carbon.device.mgt.version}</version> <version>${carbon.device.mgt.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.wso2.carbon.identity</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.identity.oauth.stub</artifactId> <artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
<version>${carbon.identity.version}</version> <version>${carbon.device.mgt.version}</version>
</dependency> </dependency>
<!-- Device Management dependencies --> <!-- Device Management dependencies -->
@ -832,6 +839,11 @@
<artifactId>org.wso2.carbon.identity.core</artifactId> <artifactId>org.wso2.carbon.identity.core</artifactId>
<version>${carbon.identity.version}</version> <version>${carbon.identity.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.carbon.identity</groupId>
<artifactId>org.wso2.carbon.identity.oauth.stub</artifactId>
<version>${carbon.identity.version}</version>
</dependency>
<!-- End of Carbon Identity dependencies --> <!-- End of Carbon Identity dependencies -->
<!-- CXF dependencies --> <!-- CXF dependencies -->

Loading…
Cancel
Save