change plesk subscription expire date via API - plesk-onyx

how can i prolong plesk subscription expire date via XML RPC or REST?
in the following code i can create subrcription, but i want a way to change the expiration date after creation.
<webspace>
<add>
<gen_setup>
<name>{domainName}</name>
<owner-login>{username}</owner-login>
<ip_address>1.1.1.1</ip_address>
</gen_setup>
<hosting>
<vrt_hst>
<property>
<name>ftp_login</name>
<value>ftp_{ftpUsername}</value>
</property>
<property>
<name>ftp_password</name>
<value>{pass}</value>
</property>
<ip_address>1.1.1.1</ip_address>
</vrt_hst>
</hosting>
<plan-name>{plan}</plan-name>
</add>
</webspace>

You can get subscription properties which include experation date in UNIXTIME using the following request:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
<webspace>
<get>
<filter>
<name>example.com</name>
</filter>
<dataset>
<limits/>
</dataset>
</get>
</webspace>
</packet>
To set the expiration date, use:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
<webspace>
<set>
<filter>
<name>example.com</name>
</filter>
<values>
<limits>
<limit>
<name>expiration</name>
<value>1600000000</value>
</limit>
</limits>
</values>
</set>
</webspace>
</packet>
Where example.com is a subscription name, 1600000000 - expiration date in UNIXTIME.

Related

Connect pooling problem with Netbeans 8 and Java

I am trying to complete the web tutorial 'Creating a simple web application using a MySQL database'. The NetBeans project name is 'IFPWAFCAD' and I am using GlassFish 5 and Java EE 5.
The database and its tables are listed correctly under Project Services, and the database shows as connected.
I am unable to deploy the application after attempting to create a connection pool. The xml files are as follows:
web.xml:
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<resource-ref>
<description>Database for IFPWAFCAD application
</description>
<res-ref-name>jdbc/IFPWAFCAD</res-ref-name>
<res-type>javax.sql.ConnectionPoolDataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>
glassfish-web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>
glassfish-resources.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<jdbc-resource enabled="true" jndi-name="jdbc/IFPWAFCAD" object-type="user" pool-name="IfpwafcadPool">
<description>Accesses IFPWAFCAD database</description>
</jdbc-resource>
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="table" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="IfpwafcadPool" non-transactional-connections="false" ping="false" pool-resize-quantity="2" pooling="true" res-type="javax.sql.ConnectionPoolDataSource" statement-cache-size="0" statement-leak-reclaim="false" statement-leak-timeout-in-seconds="0" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="true">
<property name="URL" value="jdbc:mysql://localhost:3306/mynewdatabase?zeroDateTimeBehavior=convertToNull"/>
<property name="User" value="root"/>
<property name="Password" value="23447HP"/>
</jdbc-connection-pool>
</resources>

Could not initialize Start up controller. TaskManager not found

i have written a scheduled task which call an Api in sequence in wso2 ei 6.4.0. my task is :
<task xmlns="http://ws.apache.org/ns/synapse"
name="GetMunicipalityAPIToken"
class="org.apache.synapse.startup.tasks.MessageInjector"
group="synapse.simple.quartz">
<trigger interval="60"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
<test xmlns=""/>
</property>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
name="sequenceName"
value="GetTokenFromMunicipalityService"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks"
name="injectTo"
value="sequence"/>
</task>
and my sequence is :
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="GetTokenFromMunicipalityService" xmlns="http://ws.apache.org/ns/synapse">
<send>
<endpoint>
<http method="POST" uri-template="http://x.x.x.x/api/MunicipalityBill/connect/token"/>
</endpoint>
</send>
</sequence>
but when i run integrator.bat in wso2eiHome/bin I got this error : "Could not initialize Start up controller. TaskManager not found" and the Api dont be called. Do i forget something ?
The error can be caused when you do not have org.wso2.carbon.mediation.ntask.NTaskTaskManager defined in the server. Could you please check whether the following is added in the synapse.xml file located in the [EI_HOME]/repository/deployment/server/synapse-configs/default/ directory
<definitions xmlns="http://ws.apache.org/ns/synapse">
<taskManager provider="org.wso2.carbon.mediation.ntask.NTaskTaskManager"/>
</definitions>

URL parameter wso2esb

I have created an API in esb like this snippet:
<api xmlns="http://ws.apache.org/ns/synapse" name="contact_v1"
<resource methods="GET" uri-template="/contact-by-email?email={query.param.email}" inSequence="crm_contact-by-email_v1" outSequence="crm_contact-by-email_v1" faultSequence="crm_contact-by-email-error_v1"/>
</api>
In my sequence I retrieve the request param, email, like that
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="crm_contact-by-email_v1" xmlns="http://ws.apache.org/ns/synapse">
<in>
<script language="js"><![CDATA[try {
var randomnumber1=Math.floor((Math.random() * 10000) + 1);
mc.setProperty("sessionnumber", randomnumber1.toString());
} catch(e) {
}]]></script>
<property expression="$axis2:REST_URL_POSTFIX" name="myURL"
scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<script language="js"><![CDATA[try {
var log = mc.getServiceLog();
var email = mc.getProperty('query.param.email');
log.info("emailxxxxxx "+email);
} catch(e) {}]]></script>
</in>
<out>
<send/>
<drop/>
</out>
</sequence>
When I make a request with an encoding email like that
test%40test.com
it works witout problem.
But when I make a request with
test#test.com
it display this error
<tp:fault xmlns:tp="https://xxxxxxx.com/"><tp:code>404</tp:code><tp:type>Status report</tp:type><tp:message>Not Found</tp:message><tp:description>The requested resource (//contact-by-email?email=test#test.com) is not available.</tp:description></tp:fault>
Would you have any idea
Best regards
Characters as # are reserved characters for delimiters in the RFC specification for URI-Templates (I can explain more if you are interested). Therefore, in order to allow # as the value for email parameter, define the uri-template with {+query.param.email} as below.
<api xmlns="http://ws.apache.org/ns/synapse" name="contact_v1"
<resource methods="GET" uri-template="/contact-by-email?email={+query.param.email}" inSequence="crm_contact-by-email_v1" outSequence="crm_contact-by-email_v1" faultSequence="crm_contact-by-email-error_v1"/>
</api>

Why is my EclipseLink Query Results Cache NOT working

I am developing a website on TomEE, and I want to use the EclipseLink Query Results Cache (L2) working, but every time I reload my web page, SELECT query is running (checked via general_log of mysql).
My Database entity looks like below:
#Entity(name="item")
#NamedQueries({
#NamedQuery(name="ItemEntity.getAllList",
query="Select distinct itemEntity from mypackage.entity.ItemEntity itemEntity",
hints={
#QueryHint(name="eclipselink.query-results-cache", value="true"),
#QueryHint(name="eclipselink.query-results-cache.size", value="1000"),
#QueryHint(name="eclipselink.query-results-cache.expiry", value="10000"), //10 secs for test but not working
#QueryHint(name="eclipselink.query-results-cache.type", value="FULL")
}
)
})
#org.eclipse.persistence.annotations.Cache(
type= CacheType.FULL,
size=10000,
expiry=60000, // 1 minute for test
coordinationType= CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS
)
public class ItemEntity implements Serializable, Comparable {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
#Column(name="name", unique=true, nullable=false)
private String name;
/* getters and setters for fields */
public CompanyEntity(){}
#Override
public int compareTo(Object o) {.......}
}
My persistence.xml looks like below:
<?xml version="1.0" encoding="UTF-8" ?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="myprojectname-persistence-unit" transaction-type="JTA">
<jta-data-source>myprojectname-mysql-jdbc-jta-resource</jta-data-source>
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<properties>
<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.MySQLPlatform"/>
<property name="eclipselink.cache.shared.default" value="true"/>
</properties>
</persistence-unit>
</persistence>
I read database table like below:
#Stateful
public class CompanyDao {
#PersistenceContext(unitName = "myprojectname-persistence-unit", type = PersistenceContextType.EXTENDED)
protected EntityManager em;
public List<CompanyEntity> getAllList(){
return this.em.createNamedQuery("ItemEntity.getAllList", ItemEntity.class).getResultList();
}
}
Dependency version details:
TomEE 1.7.2, Java EE6, openJPA 2.4.0, openEJB Java EE API 6.0-6, openEJB core 4.7.2, EclipseLink 2.6.2, MySQL 5.6.23, MySQL connector/J 5.1.38 (Tomcat connection pool)
I've looked at a similar question:
Can't get Eclipselink level 2 cache to work
but it doesn't describe how the OP managed to cache query results.
BTW, the default cache (L2), with em.find(ItemEntity.class, id); is working just fine.
What am I missing? Please help me out.
Solved.
I was using EclipseLink 2.6.2, I downgraded to version 2.4.2, and now Query Results Cache WORKS as expected!
I guess EclipseLink 2.6.x or 2.5.x is not quite compatible with JPA 2.0.x.
It's confusing, because when I use 2.5.x or higher, those still seem to be working, BESIDES the feature of Query Results Cache.
My persistence.xml looks like bellow now, so I can get log output:
<?xml version="1.0" encoding="UTF-8" ?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="myprojectname-persistence-unit" transaction-type="JTA">
<jta-data-source>myprojectname-mysql-jdbc-jta-resource</jta-data-source>
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<properties>
<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.MySQLPlatform"/>
<property name="eclipselink.logging.logger" value="JavaLogger"/>
<!-- The warning log of "Problem while registering MBean: java.lang.NullPointerException" did not go away even if I set bellow 2 propertes -->
<!--
<property name="eclipselink.register.dev.mbean" value="false" />
<property name="eclipselink.register.run.mbean" value="false" />
-->
<property name="eclipselink.cache.shared.default" value="true"/>
<property name="eclipselink.logging.parameters" value="true"/>
<property name="eclipselink.logging.timestamp" value="true"/>
<property name="eclipselink.logging.session" value="true"/>
<property name="eclipselink.logging.thread" value="true"/>
<property name="eclipselink.logging.exceptions" value="true"/>
<property name="eclipselink.logging.level" value="FINEST"/>
</properties>
</persistence-unit>
</persistence>

How to make inSequence without send

I have this WSO2 ESB proxy:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="sid008" transports="http" startOnLoad="true" trace="disable">
<target>
<inSequence>
<switch source="get-property('inquiryId')">
<log level="full"/>
<case regex="">
<send/>
</case>
<default>
</default>
</switch>
</inSequence>
<outSequence>
<....some processing..>
<send/>
</outSequence>
</target>
<publishWSDL key="CommonService.wsdl">
<resource location="request.xsd" key="request.xsd"/>
<resource location="response.xsd" key="response.xsd"/>
<resource location="SMEV.xsd" key="SMEV.xsd"/>
<resource location="statusAndError.xsd" key="statusAndError.xsd"/>
</publishWSDL>
</proxy>
In this proxy in default case doesn't run outSequence without send mediator. How can I do it without send mediator
Try this config for :
<default>
<... some processing ...>
<header action="remove" name="To"/>
<property action="set" name="RESPONSE" scope="default" type="STRING" value="true"/>
<send/>
</default>
With this config, you'll send response to client directly from inSequence part (you won't get into outSequence).
The rational behind In and Out sequence is:
In seq : When a message comes to a proxy service from a client, it always goes to the In sequence.
Out Seq: When a proxy service sends a message out from ESB to a backend service, the response will always come to Out seq (Unless specify the sequence using receiving seq.)
Hope this helps.