I found this interesting definition of EA:
Enterprise Architecture is an infrastructure and a set of Machines constructed in order to manage a chaotic, dynamic, unpredictable, complex, organic, prone to error, frustrating, Enterprise IT, which has to support an ever increasing, dynamic portfolio of products and services, through constant "ASAP, Now, Right-Away" modifications of business processes.
Saturday, February 25, 2006
Tuesday, February 21, 2006
What you choose
You can make it happen when you truly choose to do so. You always have, and you always will.
If something is important enough to you, you'll surely find a way. Look back on your life up to this point, and you'll see a manifestation of what you've cared most about.
Now take a look at what you care most about in this very moment. Those are the things you will give your energy and attention to, and those are the things that will surely happen for you.
You are plenty capable of pushing yourself relentlessly toward what you choose. For you do it every day and you've had a lifetime of practice.
The big question is this. What exactly do you choose?
Whatever it is, whatever you truly care about in your hjavascript:void(0);
Publish Post eart of hearts, you'll find a way to make it real. With that in mind, always choose the very best you can imagine.
-- Ralph Marston
Out of your vulnerabilities will come your strength.
-Sigmund Freud
Friday, February 17, 2006
Spring to implement Failover mechansim
<bean id="highAvailabilityBean" class="org.springframework.remoting.support.FailoverProxyFactoryBean">
<property name="serviceInterface" value="com.x.MyInterface"> <property name="serviceBeans"> <list> <!-- service beans are typically proxies to remote services --> <ref bean="primaryServiceProvider"> <ref bean="fallBackServiceProvider"> </ref> </ref></list>
package org.springframework.remoting.support;import java.lang.reflect.InvocationTargetException;import java.util.Iterator;import java.util.List;import org.aopalliance.intercept.MethodInterceptor;import org.aopalliance.intercept.MethodInvocation;import org.springframework.aop.framework.ProxyFactory;import org.springframework.beans.factory.FactoryBean;import org.springframework.beans.factory.InitializingBean;import org.springframework.remoting.support.RemoteAccessor;/*** Factory bean for proxies to redundant services. Behaves like theproxied* service when used as bean reference, exposing the specified service* interface, but with transparent fail-over. All call to the proxy are* delegated to the first object in the list of service providers (@see* #setServiceProviders(List)). When this delegated call fails, thenext* provider in the list will be called, etc.** @author be324288**/public class FailoverProxyFactoryBean extends RemoteAccessor implementsMethodInterceptor,InitializingBean, FactoryBean {private Object serviceProxy;private List serviceProviders;/*** The list of (redundant) objects that implement the interfacespecified* with {@link RemoteAccessor#setServiceInterface(java.lang.Class)}** @return*/public List getServiceProviders() {return serviceProviders;}/*** @param serviceProviders*/public void setServiceProviders(List serviceProviders) {this.serviceProviders = serviceProviders;}public void afterPropertiesSet() throws Exception {if (getServiceInterface() == null) {throw new IllegalArgumentException("serviceInterface isrequired");}if (serviceProviders == null || serviceProviders.isEmpty()) {throw new IllegalArgumentException("serviceBeans isrequired");}for (Object o : serviceProviders) {if (!getServiceInterface().isInstance(o)) {throw new IllegalArgumentException(o.getClass()+ " does not implement the serviceInterface: "+getServiceInterface());}}this.serviceProxy =ProxyFactory.getProxy(getServiceInterface(), this);}public Object getObject() {return this.serviceProxy;}public Class getObjectType() {return getServiceInterface();}public boolean isSingleton() {return true;}public Object invoke(MethodInvocation mi) throws Throwable {Iterator iter = serviceProviders.iterator();while (iter.hasNext()) {Object bean = iter.next();try {returnbean.getClass().getMethod(mi.getMethod().getName(),(Class[])mi.getMethod().getParameterTypes()).invoke(bean,mi.getArguments());} catch (InvocationTargetException e) {// try next bean or throw exception if this is the lastbeanif (!iter.hasNext()) {throw e.getCause();}}}return null;}}
Failover mechansim using Spring
Here is a sample code snippet about how spring can be used to handle fail over mechansim: (Ref: from a Spring framework discussion forum)
class="org.springframework.remoting.support.FailoverProxyFactoryBean">
package org.springframework.remoting.support;
import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import java.util.List;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.remoting.support.RemoteAccessor;
/**
* Factory bean for proxies to redundant services. Behaves like the
proxied
* service when used as bean reference, exposing the specified service
* interface, but with transparent fail-over. All call to the proxy are
* delegated to the first object in the list of service providers (@see
* #setServiceProviders(List)). When this delegated call fails, the
next
* provider in the list will be called, etc.
*
* @author be324288
*
*/
public class FailoverProxyFactoryBean extends RemoteAccessor implements
MethodInterceptor,
InitializingBean, FactoryBean {
private Object serviceProxy;
private List serviceProviders;
/**
* The list of (redundant) objects that implement the interface
specified
* with {@link RemoteAccessor#setServiceInterface(java.lang.Class)}
*
* @return
*/
public List getServiceProviders() {
return serviceProviders;
}
/**
* @param serviceProviders
*/
public void setServiceProviders(List serviceProviders) {
this.serviceProviders = serviceProviders;
}
public void afterPropertiesSet() throws Exception {
if (getServiceInterface() == null) {
throw new IllegalArgumentException("serviceInterface is
required");
}
if (serviceProviders == null || serviceProviders.isEmpty()) {
throw new IllegalArgumentException("serviceBeans is
required");
}
for (Object o : serviceProviders) {
if (!getServiceInterface().isInstance(o)) {
throw new IllegalArgumentException(o.getClass()
+ " does not implement the serviceInterface: "
+
getServiceInterface());
}
}
this.serviceProxy =
ProxyFactory.getProxy(getServiceInterface(), this);
}
public Object getObject() {
return this.serviceProxy;
}
public Class getObjectType() {
return getServiceInterface();
}
public boolean isSingleton() {
return true;
}
public Object invoke(MethodInvocation mi) throws Throwable {
Iterator iter = serviceProviders.iterator();
while (iter.hasNext()) {
Object bean = iter.next();
try {
return
bean.getClass().getMethod(mi.getMethod().getName(),
(Class[])
mi.getMethod().getParameterTypes()).invoke(bean,
mi.getArguments());
} catch (InvocationTargetException e) {
// try next bean or throw exception if this is the last
bean
if (!iter.hasNext()) {
throw e.getCause();
}
}
}
return null;
}
}
package org.springframework.remoting.support;
import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import java.util.List;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.remoting.support.RemoteAccessor;
/**
* Factory bean for proxies to redundant services. Behaves like the
proxied
* service when used as bean reference, exposing the specified service
* interface, but with transparent fail-over. All call to the proxy are
* delegated to the first object in the list of service providers (@see
* #setServiceProviders(List)). When this delegated call fails, the
next
* provider in the list will be called, etc.
*
* @author be324288
*
*/
public class FailoverProxyFactoryBean extends RemoteAccessor implements
MethodInterceptor,
InitializingBean, FactoryBean {
private Object serviceProxy;
private List serviceProviders;
/**
* The list of (redundant) objects that implement the interface
specified
* with {@link RemoteAccessor#setServiceInterface(java.lang.Class)}
*
* @return
*/
public List getServiceProviders() {
return serviceProviders;
}
/**
* @param serviceProviders
*/
public void setServiceProviders(List serviceProviders) {
this.serviceProviders = serviceProviders;
}
public void afterPropertiesSet() throws Exception {
if (getServiceInterface() == null) {
throw new IllegalArgumentException("serviceInterface is
required");
}
if (serviceProviders == null || serviceProviders.isEmpty()) {
throw new IllegalArgumentException("serviceBeans is
required");
}
for (Object o : serviceProviders) {
if (!getServiceInterface().isInstance(o)) {
throw new IllegalArgumentException(o.getClass()
+ " does not implement the serviceInterface: "
+
getServiceInterface());
}
}
this.serviceProxy =
ProxyFactory.getProxy(getServiceInterface(), this);
}
public Object getObject() {
return this.serviceProxy;
}
public Class getObjectType() {
return getServiceInterface();
}
public boolean isSingleton() {
return true;
}
public Object invoke(MethodInvocation mi) throws Throwable {
Iterator iter = serviceProviders.iterator();
while (iter.hasNext()) {
Object bean = iter.next();
try {
return
bean.getClass().getMethod(mi.getMethod().getName(),
(Class[])
mi.getMethod().getParameterTypes()).invoke(bean,
mi.getArguments());
} catch (InvocationTargetException e) {
// try next bean or throw exception if this is the last
bean
if (!iter.hasNext()) {
throw e.getCause();
}
}
}
return null;
}
}
Subscribe to:
Posts (Atom)