show processlist
This runs a query (can be run from either the command line or the query browser) and shows you a summary of all the processes that MySQL is currently using.
show processlist
My configuration went from this (in Webflow 1) :
<flow:registry id="flowRegistry">
<flow:location path="/WEB-INF/flows/**/*-flow.xml"/>
</flow:registry>
<flow:executor id="flowExecutor" registry-ref="flowRegistry">
<!--flow:execution-listeners>
<flow:listener ref="webflowDebugListener"/>
</flow:execution-listeners-->
</flow:executor>
<!--bean id="webflowDebugListener" class="org.springframework.webflow.execution.DebuggingListener"/-->
<bean name="flowController" class="org.springframework.webflow.executor.mvc.FlowController">
<property name="flowExecutor" ref="flowExecutor" />
<property name="argumentHandler">
<bean class="org.springframework.webflow.executor.support.RequestParameterFlowExecutorArgumentHandler" />
</property>
</bean>
To this (in Webflow 2) :
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices">
<webflow:flow-location-pattern value="/WEB-INF/flows/**/*-flow.xml"/>
</webflow:flow-registry>
<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
<webflow:flow-execution-listeners>
<!-- webflow:listener ref="webflowDebugListener"/ -->
<webflow:listener ref="securityFlowExecutionListener"/>
</webflow:flow-execution-listeners>
</webflow:flow-executor>
<bean id="securityFlowExecutionListener" class="org.springframework.webflow.security.SecurityFlowExecutionListener" />
<webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="viewFactoryCreator" conversion-service="webflowConversionService"/>
<bean id="webflowConversionService" class="com.mypackage.modules.springframework.webflow2.ConversionServiceFactoryBean">
<property name="editorMappings">
<map>
<entry key="java.util.Calendar"><idref bean="sqlDateCalendarEditor"/></entry>
</map>
</property>
</bean>
<bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="viewResolvers">
<list>
<ref local="xmlViewResolver"/>
<ref local="decoratedJstlViewResolver"/>
<ref local="urlBasedViewResolver"/>
</list>
</property>
</bean>
<bean id="webflowDebugListener" class="org.springframework.webflow.execution.DebuggingListener"/>
<bean name="flowController" class="org.springframework.webflow.mvc.servlet.FlowController">
<property name="flowExecutor" ref="flowExecutor" />
<property name="flowUrlHandler">
<bean class="org.springframework.webflow.context.servlet.DefaultFlowUrlHandler" />
</property>
</bean>
Now, you may be asking yourself, "Why would there be more configuration in Spring Webflow 2 ? Doesn't Spring generally improve on things like configuration syntax between major versions ? The answer is, of course, yes. However, there are a number of new features that come with Webflow 2 that need to be configured, hence the extra beans for configuration. Note also, that the syntax has changed. I direct your attention to the added 'flow-' prefixes on element names of the previously existing Webflow elements.
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core-tiger</artifactId>
<version>${spring.security.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-support</artifactId>
</exclusion>
</exclusions>
</dependency>
...
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${spring.security.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
</exclusions>
</dependency>
xmlns:security="http://www.springframework.org/security/tags"
public enum Role implements GrantedAuthority, ConfigAttribute
{
ROLE_ADMINISTRATOR;
public String getAuthority() {
return name();
}
public String getAttribute() {
return name();
}
public String getMessageKey() {
return "enum.Role.".concat(name());
}
}
public final class Role implements GrantedAuthority, ConfigAttribute, Serializable, Cloneable {
private static final long serialVersionUID = 1L;
public static final Role ROLE_ADMINISTRATOR = new Role(0, "ROLE_ADMINISTRATOR");
private static final Role[] VALUES = new Role[] {
ROLE_ADMINISTRATOR
};
private static final MapNAME_MAPPINGS = new HashMap ();
static {
Arrays.sort(VALUES, new Comparator() {
public int compare(Role o1, Role o2) {
return o1.ordinal - o2.ordinal;
}
});
for (Role r : VALUES) {
NAME_MAPPINGS.put (r.getName(), r);
}
}
private int ordinal;
private String name;
//Constructors
/*
* DO NOT EVER USE THIS! It exists only for serialization purposes.
*/
public Role() {
super();
}
private Role(Role r) {
this(r.ordinal, r.name);
}
private Role(int ordinal, String name) {
super();
this.ordinal = ordinal;
this.name = name;
}
//Behaviour Methods
public int compareTo(Object o) {
if (o == null || o.getClass() != Role.class) {
throw new IllegalArgumentException(
"Comparison object may not be null, and must be a Role");
}
return this.ordinal - ((Role) o).ordinal;
}
public String getAuthority() {
return getName();
}
public String getAttribute() {
return getName();
}
//Pseudo-properties
public String getMessageKey() {
return "enum.Role.".concat(getName());
}
//Property Accessors
public final int getOrdinal() {
return this.ordinal;
}
public final String getName() {
return this.name;
}
//Helper Methods
public static final int hashCode(Role r) {
return r == null ? 0 : r.hashCode();
}
public static final boolean equals(Role x, Role y) {
return x == null ? (y == null) : x.equals(y);
}
public static final Role clone(Role r) {
return r == null ? null : r.clone();
}
public static final Role[] values() {
return VALUES;
}
public static final Role valueOf(String s) throws IllegalArgumentException {
String key = defaultString(s).toUpperCase();
if (NAME_MAPPINGS.containsKey(key)) {
return NAME_MAPPINGS.get(key);
} else {
throw new IllegalArgumentException("No role by the name ["+s+"] exists");
}
}
//Object Overrides
@Override
public String toString() {
return new StringBuffer().append(this.name)
.append("(").append(this.ordinal).append(")")
.toString();
}
@Override
public Role clone() {
return new Role(this);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.name == null) ? 0 : this.name.hashCode());
result = prime * result + this.ordinal;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Role other = (Role) obj;
if (this.name == null) {
if (other.name != null)
return false;
} else if (!this.name.equals(other.name))
return false;
if (this.ordinal != other.ordinal)
return false;
return true;
}
}
public class RoleUserType implements UserType {
private static final int[] SQL_TYPES = new int[] { Types.INTEGER };
public static final String HIBERNATE_TYPE_NAME = "RoleUserType";
public Object deepCopy(Object value) throws HibernateException {
return value;
}
public Object assemble(Serializable cached, Object owner) throws HibernateException {
return (Role)cached;
}
public Serializable disassemble(Object value) throws HibernateException {
return (Role)value;
}
public boolean equals(Object x, Object y) throws HibernateException {
return Role.equals((Role)x, (Role)y);
}
public int hashCode(Object x) throws HibernateException {
return Role.hashCode((Role)x);
}
public boolean isMutable() {
return false;
}
public Object nullSafeGet(ResultSet resultSet, String[] names, Object owner) throws HibernateException, SQLException {
int roleOrdinal = resultSet.getInt(names[0]);
return resultSet.wasNull() ? null : Role.values()[roleOrdinal];
}
public void nullSafeSet(PreparedStatement statement, Object value, int index)
throws HibernateException, SQLException {
if (value == null) {
statement.setNull(index, Types.INTEGER);
} else {
statement.setInt(index, ((Role)value).getOrdinal());
}
}
public Object replace(Object original, Object target, Object owner) throws HibernateException {
return original;
}
@SuppressWarnings("unchecked")
public Class returnedClass() {
return Role.class;
}
public int[] sqlTypes() {
return SQL_TYPES;
}
}
@TypeDef(name = RoleUserType.HIBERNATE_TYPE_NAME, typeClass = RoleUserType.class)
package com.mypackage.model;
import org.hibernate.annotations.TypeDef;
import eu.alenislimited.acshelper.support.hibernate.RoleUserType;
@Enumerated(EnumType.ORDINAL)
@Type(type = RoleUserType.HIBERNATE_TYPE_NAME)
def name= (name)
@name = name
end
@person_instance.send "name=", "John Smith"
/**
* Create an instance of {@link PurchaseOrder }
*
*/
public PurchaseOrder createPurchaseOrder() {
return new PurchaseOrder();
}
Pure FTP is a great FTP server and I love it because it's ridiculously fast, reliable and works well for our company. The only problem is that it's tricky to configure on Ubuntu because just like with numerous other programs, the people at Ubuntu, in their infinite wisdom, felt the need to fuck with the program's default way of doing things. Specifically, in Ubuntu, command line arguments for starting the FTP service are done through individual files for each command line option you want the service to be started with, with values for the options placed inside each of the files. This is a stupid way of doing things, but that's not the topic of this post.
The problem I've been having lately is that I recently deployed new projects within our production network, and these new projects required access to the FTP server, and aren't on the same box as the server, as is the sole other project that has been using the FTP server. I'd been getting problems trying to connect to the server from any LAN box, but not any external boxes nor the machine itself (localhost). The error I got back was "421 Service not available". I googled around for hours and found nothing useful, until I started realizing that other people were getting 421 errors when their PureFTP instance was misconfigured, but with different messages, and then it got me thinking that maybe my instance was somehow misconfigured.
I re-read the documentation for PureFTP and after an hour or so, it hit me that the server does reverse lookups to resolve fully qualified names, and such resolution doesn't work properly on our network (for good reasons that I'm not going to go into). After disabling reverse DNS resolution with the -H startup option (`echo "yes" >> DontResolve` in the configuration directory in Ubuntu), the problem went away.
I hope this helps anybody else who runs into the same problem.
For those not in the know, schemagen is a program that comes as part of the Java Web Services Developer Pack and it's used to generated XML schemas from JAXB annotations on Java beans. It so happens that the creators of the JAXB reference implementation also made a Maven 2 plugin for this program. I had previously attempted to use it to generate schemas in my initial attempts with JAXB, but had been presented with a slough of unfriendly exceptions being thrown at me whenever I ran the plugin. Not having the time back then to really play around with it and being considerably less experienced with JAXB, I had to shelve it and find other, less satisfying solutions to my problems with generating documentation.
Recently, I've had to come back to using JAXB because I'm making a RESTful Web Services API that leverages the power of both JAXB and Hibernate to do all my heavy lifting for me. This time around, I wasn't willing to tolerate a lack of schema to give to our users of the API, because it would mean a lot more work for them, and a lot more work for me. This time, I decided to be persistent and dig around the jaxb-schemagen plugin to make sure I could get it working. I'm proud to say that my perseverance paid off, and I now have my RESTful API schema being automatically generated for my application. Here are the problems and the solutions I ran into when I was trying to get going on this:
/etc/apt/sources.list, and you'll have to find a line similar to :
deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted