Merge pull request #631 from ayyoob/cloud-3.1.0

added claimable property and fixed unsecured endpoint bug
revert-70aa11f8
Harshan Liyanage 8 years ago committed by GitHub
commit 3ab025a6d8

@ -218,7 +218,7 @@ public class APIPublisherUtil {
JsonObject httpVerb = new JsonObject(); JsonObject httpVerb = new JsonObject();
httpVerb.add("responses", response); httpVerb.add("responses", response);
httpVerb.addProperty("x-auth-type", "Application%20%26%20Application%20User"); httpVerb.addProperty("x-auth-type", uriTemplate.getAuthType());
httpVerb.addProperty("x-throttling-tier", "Unlimited"); httpVerb.addProperty("x-throttling-tier", "Unlimited");
if (uriTemplate.getScope() != null) { if (uriTemplate.getScope() != null) {
httpVerb.addProperty("x-scope", uriTemplate.getScope().getKey()); httpVerb.addProperty("x-scope", uriTemplate.getScope().getKey());
@ -289,5 +289,6 @@ public class APIPublisherUtil {
} }
} }
} }
apiConfig.setUriTemplates(templates);
} }
} }

@ -53,7 +53,7 @@ public class AnnotationProcessor {
private static final Log log = LogFactory.getLog(AnnotationProcessor.class); private static final Log log = LogFactory.getLog(AnnotationProcessor.class);
private static final String AUTH_TYPE = "Any"; private static final String AUTH_TYPE = "Application & Application User";
private static final String STRING_ARR = "string_arr"; private static final String STRING_ARR = "string_arr";
private static final String STRING = "string"; private static final String STRING = "string";
private static final String PACKAGE_ORG_APACHE = "org.apache"; private static final String PACKAGE_ORG_APACHE = "org.apache";

@ -0,0 +1,104 @@
/*
* 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.mgt.extensions.device.type.deployer.config;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* <p>Java class for DeviceDetails complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="DeviceDetails">
* &lt;simpleContent>
* &lt;extension base="&lt;http://www.w3.org/2001/XMLSchema>string">
* &lt;attribute name="table-id" type="{http://www.w3.org/2001/XMLSchema}string" />
* &lt;/extension>
* &lt;/simpleContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Claimable", propOrder = {
"value"
})
public class Claimable {
@XmlValue
protected String value;
@XmlAttribute(name = "enabled")
protected boolean enabled;
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the enabled property.
*
* @return
* possible object is
* {@link String }
*
*/
public boolean isEnabled() {
return enabled;
}
/**
* Sets the value of the enabled property.
*
* @param enabled
* allowed object is
* {@link String }
*
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}

@ -53,6 +53,8 @@ public class DeviceTypeConfiguration {
@XmlElement(name = "DeviceDetails", required = true) @XmlElement(name = "DeviceDetails", required = true)
protected DeviceDetails deviceDetails; protected DeviceDetails deviceDetails;
@XmlElement(name = "Claimable", required = true)
protected Claimable claimable;
@XmlElement(name = "Features", required = true) @XmlElement(name = "Features", required = true)
protected Features features; protected Features features;
@XmlElement(name = "ProvisioningConfig", required = true) @XmlElement(name = "ProvisioningConfig", required = true)
@ -131,6 +133,27 @@ public class DeviceTypeConfiguration {
this.deviceDetails = value; this.deviceDetails = value;
} }
/**
* Gets the value of the Claimable property.
*
* @return possible object is
* {@link DeviceDetails }
*/
public Claimable getClaimable() {
return claimable;
}
/**
* Sets the value of the deviceDetails property.
*
* @param value allowed object is
* {@link DeviceDetails }
*/
public void setClaimable(Claimable value) {
this.claimable = value;
}
/** /**
* Gets the value of the policyMonitoring property. * Gets the value of the policyMonitoring property.
* *

@ -65,6 +65,7 @@ public class DeviceTypeManager implements DeviceManager {
private LicenseManager licenseManager; private LicenseManager licenseManager;
private boolean propertiesExist; private boolean propertiesExist;
private boolean requiredDeviceTypeAuthorization; private boolean requiredDeviceTypeAuthorization;
private boolean claimable;
private FeatureManager featureManager; private FeatureManager featureManager;
@ -101,8 +102,13 @@ public class DeviceTypeManager implements DeviceManager {
String msg = "Error occurred while adding default license for " + deviceType + " devices"; String msg = "Error occurred while adding default license for " + deviceType + " devices";
throw new DeviceTypeDeployerFileException(msg, e); throw new DeviceTypeDeployerFileException(msg, e);
} }
claimable = false;
if (deviceTypeConfiguration.getClaimable() != null ) {
claimable = deviceTypeConfiguration.getClaimable().isEnabled();
}
DeviceDetails deviceDetails = deviceTypeConfiguration.getDeviceDetails(); DeviceDetails deviceDetails = deviceTypeConfiguration.getDeviceDetails();
if (deviceDetails != null) { if (deviceDetails != null) {
//Check whether device dao definition exist. //Check whether device dao definition exist.
@ -341,7 +347,7 @@ public class DeviceTypeManager implements DeviceManager {
@Override @Override
public boolean isClaimable(DeviceIdentifier deviceIdentifier) throws DeviceManagementException { public boolean isClaimable(DeviceIdentifier deviceIdentifier) throws DeviceManagementException {
return false; return claimable;
} }
@Override @Override

@ -36,6 +36,8 @@
</Feature> </Feature>
</Features> </Features>
<Claimable enabled="true"/>
<Sensors table-id="SAMPLE_DEVICE_2"> <Sensors table-id="SAMPLE_DEVICE_2">
<Sensor code="CPU_Temperature"> <Sensor code="CPU_Temperature">
<Name>temperature sensor fitted</Name> <Name>temperature sensor fitted</Name>

Loading…
Cancel
Save