This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HttpEndpoint endpoint; | |
| public void setLocationURI(String locationURI) { | |
| endpoint.setLocationURI(locationURI); | |
| } | |
| public String getLocationURI() { | |
| return endpoint.getLocationURI(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @ManagedAttribute(description="Location URI") | |
| public void setLocationURI(String locationURI) { | |
| endpoint.setLocationURI(locationURI); | |
| } | |
| @ManagedAttribute | |
| public String getLocationURI() { | |
| return endpoint.getLocationURI(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package net.iocanel.blog.servicemix.management; | |
| import org.apache.servicemix.http.HttpEndpoint; | |
| import org.springframework.beans.factory.InitializingBean; | |
| import org.springframework.jmx.export.annotation.ManagedAttribute; | |
| import org.springframework.jmx.export.annotation.ManagedOperation; | |
| import org.springframework.jmx.export.annotation.ManagedResource; | |
| /** | |
| * A simple spring bean that gets injected an HttpEndpoint and exposes it to jmx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE `ENDPOINT_CONFIGURATION` ( | |
| `ENDPOINT_ID` varchar(80) NOT NULL, | |
| `CONFIGURATION` text NOT NULL, | |
| PRIMARY KEY (`ENDPOINT_ID`) | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package net.iocanel.blog.management.support.persistence; | |
| import java.io.Serializable; | |
| import javax.persistence.Basic; | |
| import javax.persistence.Column; | |
| import javax.persistence.Entity; | |
| import javax.persistence.Id; | |
| import javax.persistence.Lob; | |
| import javax.persistence.Table; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <persistence version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/persistence" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> | |
| <persistence-unit name="ServiceMixManagementPU" transaction-type="RESOURCE_LOCAL"> | |
| <provider>org.hibernate.ejb.HibernatePersistence</provider> | |
| <class>net.iocanel.blog.management.support.persistence.EndpointConfiguration</class> | |
| <properties> | |
| <property name="hibernate.connection.username" value="username_here"/> | |
| <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/> | |
| <property name="hibernate.connection.password" value="password_here"/> | |
| <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/blog"/> | |
| <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package net.iocanel.blog.management.support.persistence; | |
| import javax.persistence.EntityManager; | |
| import javax.persistence.PersistenceContext; | |
| import org.springframework.beans.factory.InitializingBean; | |
| import org.springframework.transaction.annotation.Transactional; | |
| /** | |
| * | |
| * @author iocanel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected ConfigurationDao configurationDao; | |
| protected JAXBContext context; | |
| @ManagedOperation(description = "Persist the endpoint configuration") | |
| public void saveConfiguration() { | |
| try { | |
| StringWriter writer = new StringWriter(); | |
| BeanUtils.copyProperties(endpoint, data,ignore); | |
| context.createMarshaller().marshal(data, writer); | |
| configuration.setEndpointId(endpoint.getKey()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Endpoint Start Interceptor | |
| * Intercepts start method, load the configuration data of the endpoint and applies them to the endpoint. | |
| * @param pjp | |
| */ | |
| @Around("execution(* start() )") //For the shake of simplicity | |
| public void interceptEndpointStart(ProceedingJoinPoint pjp) { | |
| if (pjp.getThis() instanceof Endpoint) { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package net.iocanel.blog.management.support; | |
| import java.io.StringReader; | |
| import java.io.StringWriter; | |
| import javax.xml.bind.JAXBContext; | |
| import javax.xml.bind.JAXBException; | |
| import net.iocanel.blog.management.support.persistence.ConfigurationDao; | |
| import net.iocanel.blog.management.support.persistence.EndpointConfiguration; | |
| import org.apache.commons.logging.Log; | |
| import org.apache.commons.logging.LogFactory; |