Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
net.anotheria.anosite.photoserver.service.blur.generated.RemoteBlurSettingsServiceStub Maven / Gradle / Ivy
package net.anotheria.anosite.photoserver.service.blur.generated;
//CHECKSTYLE:OFF
import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.log4j.Logger;
import java.rmi.RemoteException;
import java.rmi.NotBoundException;
import org.distributeme.core.RegistryUtil;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import org.distributeme.core.ServiceDescriptor;
import org.distributeme.core.ServiceDescriptor.Protocol;
import org.distributeme.core.DiscoveryMode;
import org.distributeme.core.failing.FailingStrategy;
import org.distributeme.core.concurrencycontrol.ConcurrencyControlStrategy;
import org.distributeme.core.failing.FailDecision;
import org.distributeme.core.ClientSideCallContext;
import org.distributeme.core.exception.DistributemeRuntimeException;
import org.distributeme.core.exception.NoConnectionToServerException;
import org.distributeme.core.exception.ServiceUnavailableException;
import org.distributeme.core.Defaults;
import org.distributeme.core.interceptor.ClientSideRequestInterceptor;
import org.distributeme.core.interceptor.InterceptorRegistry;
import org.distributeme.core.interceptor.InterceptorResponse;
import org.distributeme.core.interceptor.InterceptionContext;
import org.distributeme.core.interceptor.InterceptionPhase;
public class RemoteBlurSettingsServiceStub implements net.anotheria.anosite.photoserver.service.blur.BlurSettingsService{
private volatile ConcurrentMap delegates = new ConcurrentHashMap();
private DiscoveryMode discoveryMode = DiscoveryMode.AUTO;
// ROUTER DECL V2
// No class-wide-router set, skipping.
// Method wide routers if applicable
// Method wide routers END
// ROUTER DECL V2 end
// Failing
// Class wide failing strategy
private FailingStrategy clazzWideFailingStrategy = Defaults.getDefaultFailingStrategy();
private FailingStrategy readBlurSettingsFailingStrategy_longalbumId_javautilListpictureIds_javalangStringuserId = clazzWideFailingStrategy;
private FailingStrategy readBlurSettingsFailingStrategy_longalbumId_javautilListpictureIds = clazzWideFailingStrategy;
private FailingStrategy blurAlbumFailingStrategy_longalbumId = clazzWideFailingStrategy;
private FailingStrategy blurAlbumFailingStrategy_longalbumId_javalangStringuserId = clazzWideFailingStrategy;
private FailingStrategy blurPictureFailingStrategy_longalbumId_longpictureId_javalangStringuserId = clazzWideFailingStrategy;
private FailingStrategy blurPictureFailingStrategy_longalbumId_longpictureId = clazzWideFailingStrategy;
private FailingStrategy unBlurAlbumFailingStrategy_longalbumId = clazzWideFailingStrategy;
private FailingStrategy unBlurAlbumFailingStrategy_longalbumId_javalangStringuserId = clazzWideFailingStrategy;
private FailingStrategy unBlurPictureFailingStrategy_longalbumId_longpictureId_javalangStringuserId = clazzWideFailingStrategy;
private FailingStrategy unBlurPictureFailingStrategy_longalbumId_longpictureId = clazzWideFailingStrategy;
private FailingStrategy removeBlurSettingsFailingStrategy_longalbumId = clazzWideFailingStrategy;
// Failing end
// CONCURRENCY CONTROL
// Class wide concurrency control strategy
private ConcurrencyControlStrategy clazzWideCCStrategy = Defaults.getDefaultConcurrencyControlStrategy();
private ConcurrencyControlStrategy readBlurSettingsCCStrategy_longalbumId_javautilListpictureIds_javalangStringuserId = clazzWideCCStrategy;
private ConcurrencyControlStrategy readBlurSettingsCCStrategy_longalbumId_javautilListpictureIds = clazzWideCCStrategy;
private ConcurrencyControlStrategy blurAlbumCCStrategy_longalbumId = clazzWideCCStrategy;
private ConcurrencyControlStrategy blurAlbumCCStrategy_longalbumId_javalangStringuserId = clazzWideCCStrategy;
private ConcurrencyControlStrategy blurPictureCCStrategy_longalbumId_longpictureId_javalangStringuserId = clazzWideCCStrategy;
private ConcurrencyControlStrategy blurPictureCCStrategy_longalbumId_longpictureId = clazzWideCCStrategy;
private ConcurrencyControlStrategy unBlurAlbumCCStrategy_longalbumId = clazzWideCCStrategy;
private ConcurrencyControlStrategy unBlurAlbumCCStrategy_longalbumId_javalangStringuserId = clazzWideCCStrategy;
private ConcurrencyControlStrategy unBlurPictureCCStrategy_longalbumId_longpictureId_javalangStringuserId = clazzWideCCStrategy;
private ConcurrencyControlStrategy unBlurPictureCCStrategy_longalbumId_longpictureId = clazzWideCCStrategy;
private ConcurrencyControlStrategy removeBlurSettingsCCStrategy_longalbumId = clazzWideCCStrategy;
// CONCURRENCY CONTROL end
public RemoteBlurSettingsServiceStub(){
discoveryMode = DiscoveryMode.AUTO;
}
private ServiceDescriptor manuallySetDescriptor;
private RemoteBlurSettingsService manuallySetTarget;
public RemoteBlurSettingsServiceStub(ServiceDescriptor target){
discoveryMode = DiscoveryMode.MANUAL;
manuallySetDescriptor = target;
try{
manuallySetTarget = lookup(manuallySetDescriptor);
}catch(NoConnectionToServerException e){
throw new IllegalStateException("Can not resolve manually set reference", e);
}
}
public java.util.Map readBlurSettings(long albumId, java.util.List pictureIds, java.lang.String userId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
return readBlurSettings(albumId, pictureIds, userId, (ClientSideCallContext)null);
} //...public java.util.Map readBlurSettings(long albumId, java.util.List pictureIds, java.lang.String userId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException
private java.util.Map readBlurSettings(long albumId, java.util.List pictureIds, java.lang.String userId, org.distributeme.core.ClientSideCallContext diMeCallContext) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
List __fromServerSide = null;;
Exception exceptionInMethod = null;
if (diMeCallContext == null)
diMeCallContext = new ClientSideCallContext("readBlurSettings");
if (discoveryMode==DiscoveryMode.AUTO && diMeCallContext.getServiceId()==null)
diMeCallContext.setServiceId(BlurSettingsServiceConstants.getServiceId());
HashMap __transportableCallContext = diMeCallContext.getTransportableCallContext();
// Initialize interceptors
List diMeInterceptors = InterceptorRegistry.getInstance().getClientSideRequestInterceptors();
InterceptionContext diMeInterceptionContext = new InterceptionContext();
// Concurrency control, client side - start
readBlurSettingsCCStrategy_longalbumId_javautilListpictureIds_javalangStringuserId.notifyClientSideCallStarted(diMeCallContext);
ArrayList diMeParameters = new ArrayList();
diMeParameters.add(albumId);
diMeParameters.add(pictureIds);
diMeParameters.add(userId);
diMeCallContext.setParameters(diMeParameters);
try{
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.BEFORE_SERVICE_CALL);
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.beforeServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return (java.util.Map) interceptorResponse.getReturnValue();
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
// Reparse parameters in case an interceptor modified them
albumId = ((Long)diMeParameters.get(0)).longValue();
pictureIds = (java.util.List) diMeParameters.get(1);
userId = (java.lang.String) diMeParameters.get(2);
__fromServerSide = getDelegate(diMeCallContext.getServiceId()).readBlurSettings(albumId, pictureIds, userId, __transportableCallContext);
__transportableCallContext.putAll(((HashMap)__fromServerSide.get(1)));
return (java.util.Map) __fromServerSide.get(0);
}catch(RemoteException e){
// handle exceptions properly
e.printStackTrace();
notifyDelegateFailed(diMeCallContext.getServiceId());
exceptionInMethod = e;
}catch(NoConnectionToServerException e){
exceptionInMethod = e;
}finally{
// Concurrency control, client side - end
readBlurSettingsCCStrategy_longalbumId_javautilListpictureIds_javalangStringuserId.notifyClientSideCallFinished(diMeCallContext);
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.AFTER_SERVICE_CALL);
if (__fromServerSide!=null){
diMeInterceptionContext.setReturnValue(__fromServerSide.get(0));
}
diMeInterceptionContext.setException(exceptionInMethod);
boolean diMeReturnOverriden = false;
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.afterServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return (java.util.Map) interceptorResponse.getReturnValue();
case OVERWRITE_RETURN_AND_CONTINUE:
__fromServerSide.set(0, interceptorResponse.getReturnValue());
diMeInterceptionContext.setReturnValue(interceptorResponse.getReturnValue());
diMeReturnOverriden = true;
break;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
if (diMeReturnOverriden)
return (java.util.Map) __fromServerSide.get(0);
}
// Failing
if (exceptionInMethod!=null){
FailDecision failDecision = readBlurSettingsFailingStrategy_longalbumId_javautilListpictureIds_javalangStringuserId.callFailed(diMeCallContext);
if (failDecision.getTargetService()!=null)
diMeCallContext.setServiceId(failDecision.getTargetService());
switch(failDecision.getReaction()){
case RETRY:
return readBlurSettings(albumId, pictureIds, userId, diMeCallContext.increaseCallCount());
case RETRYONCE:
// Only retry if its the first call
if (!diMeCallContext.isFirstCall())
break;
return readBlurSettings(albumId, pictureIds, userId, diMeCallContext.increaseCallCount());
case FAIL:
default:
// Fail or default is to do nothing at all and let the request fail
} //...switch(failDecision)
}
// fail through, if we are here, we must have had an exception before.
throw mapException(exceptionInMethod);
}
public java.util.Map readBlurSettings(long albumId, java.util.List pictureIds) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
return readBlurSettings(albumId, pictureIds, (ClientSideCallContext)null);
} //...public java.util.Map readBlurSettings(long albumId, java.util.List pictureIds) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException
private java.util.Map readBlurSettings(long albumId, java.util.List pictureIds, org.distributeme.core.ClientSideCallContext diMeCallContext) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
List __fromServerSide = null;;
Exception exceptionInMethod = null;
if (diMeCallContext == null)
diMeCallContext = new ClientSideCallContext("readBlurSettings");
if (discoveryMode==DiscoveryMode.AUTO && diMeCallContext.getServiceId()==null)
diMeCallContext.setServiceId(BlurSettingsServiceConstants.getServiceId());
HashMap __transportableCallContext = diMeCallContext.getTransportableCallContext();
// Initialize interceptors
List diMeInterceptors = InterceptorRegistry.getInstance().getClientSideRequestInterceptors();
InterceptionContext diMeInterceptionContext = new InterceptionContext();
// Concurrency control, client side - start
readBlurSettingsCCStrategy_longalbumId_javautilListpictureIds.notifyClientSideCallStarted(diMeCallContext);
ArrayList diMeParameters = new ArrayList();
diMeParameters.add(albumId);
diMeParameters.add(pictureIds);
diMeCallContext.setParameters(diMeParameters);
try{
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.BEFORE_SERVICE_CALL);
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.beforeServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return (java.util.Map) interceptorResponse.getReturnValue();
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
// Reparse parameters in case an interceptor modified them
albumId = ((Long)diMeParameters.get(0)).longValue();
pictureIds = (java.util.List) diMeParameters.get(1);
__fromServerSide = getDelegate(diMeCallContext.getServiceId()).readBlurSettings(albumId, pictureIds, __transportableCallContext);
__transportableCallContext.putAll(((HashMap)__fromServerSide.get(1)));
return (java.util.Map) __fromServerSide.get(0);
}catch(RemoteException e){
// handle exceptions properly
e.printStackTrace();
notifyDelegateFailed(diMeCallContext.getServiceId());
exceptionInMethod = e;
}catch(NoConnectionToServerException e){
exceptionInMethod = e;
}finally{
// Concurrency control, client side - end
readBlurSettingsCCStrategy_longalbumId_javautilListpictureIds.notifyClientSideCallFinished(diMeCallContext);
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.AFTER_SERVICE_CALL);
if (__fromServerSide!=null){
diMeInterceptionContext.setReturnValue(__fromServerSide.get(0));
}
diMeInterceptionContext.setException(exceptionInMethod);
boolean diMeReturnOverriden = false;
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.afterServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return (java.util.Map) interceptorResponse.getReturnValue();
case OVERWRITE_RETURN_AND_CONTINUE:
__fromServerSide.set(0, interceptorResponse.getReturnValue());
diMeInterceptionContext.setReturnValue(interceptorResponse.getReturnValue());
diMeReturnOverriden = true;
break;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
if (diMeReturnOverriden)
return (java.util.Map) __fromServerSide.get(0);
}
// Failing
if (exceptionInMethod!=null){
FailDecision failDecision = readBlurSettingsFailingStrategy_longalbumId_javautilListpictureIds.callFailed(diMeCallContext);
if (failDecision.getTargetService()!=null)
diMeCallContext.setServiceId(failDecision.getTargetService());
switch(failDecision.getReaction()){
case RETRY:
return readBlurSettings(albumId, pictureIds, diMeCallContext.increaseCallCount());
case RETRYONCE:
// Only retry if its the first call
if (!diMeCallContext.isFirstCall())
break;
return readBlurSettings(albumId, pictureIds, diMeCallContext.increaseCallCount());
case FAIL:
default:
// Fail or default is to do nothing at all and let the request fail
} //...switch(failDecision)
}
// fail through, if we are here, we must have had an exception before.
throw mapException(exceptionInMethod);
}
public void blurAlbum(long albumId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
blurAlbum(albumId, (ClientSideCallContext)null);
} //...public void blurAlbum(long albumId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException
private void blurAlbum(long albumId, org.distributeme.core.ClientSideCallContext diMeCallContext) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
List __fromServerSide = null;;
Exception exceptionInMethod = null;
if (diMeCallContext == null)
diMeCallContext = new ClientSideCallContext("blurAlbum");
if (discoveryMode==DiscoveryMode.AUTO && diMeCallContext.getServiceId()==null)
diMeCallContext.setServiceId(BlurSettingsServiceConstants.getServiceId());
HashMap __transportableCallContext = diMeCallContext.getTransportableCallContext();
// Initialize interceptors
List diMeInterceptors = InterceptorRegistry.getInstance().getClientSideRequestInterceptors();
InterceptionContext diMeInterceptionContext = new InterceptionContext();
// Concurrency control, client side - start
blurAlbumCCStrategy_longalbumId.notifyClientSideCallStarted(diMeCallContext);
ArrayList diMeParameters = new ArrayList();
diMeParameters.add(albumId);
diMeCallContext.setParameters(diMeParameters);
try{
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.BEFORE_SERVICE_CALL);
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.beforeServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
// Reparse parameters in case an interceptor modified them
albumId = ((Long)diMeParameters.get(0)).longValue();
__fromServerSide = getDelegate(diMeCallContext.getServiceId()).blurAlbum(albumId, __transportableCallContext);
__transportableCallContext.putAll(((HashMap)__fromServerSide.get(1)));
return;
}catch(RemoteException e){
// handle exceptions properly
e.printStackTrace();
notifyDelegateFailed(diMeCallContext.getServiceId());
exceptionInMethod = e;
}catch(NoConnectionToServerException e){
exceptionInMethod = e;
}finally{
// Concurrency control, client side - end
blurAlbumCCStrategy_longalbumId.notifyClientSideCallFinished(diMeCallContext);
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.AFTER_SERVICE_CALL);
if (__fromServerSide!=null){
diMeInterceptionContext.setReturnValue(__fromServerSide.get(0));
}
diMeInterceptionContext.setException(exceptionInMethod);
boolean diMeReturnOverriden = false;
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.afterServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
}
// Failing
if (exceptionInMethod!=null){
FailDecision failDecision = blurAlbumFailingStrategy_longalbumId.callFailed(diMeCallContext);
if (failDecision.getTargetService()!=null)
diMeCallContext.setServiceId(failDecision.getTargetService());
switch(failDecision.getReaction()){
case RETRY:
blurAlbum(albumId, diMeCallContext.increaseCallCount());
return;
case RETRYONCE:
// Only retry if its the first call
if (!diMeCallContext.isFirstCall())
break;
blurAlbum(albumId, diMeCallContext.increaseCallCount());
return;
case FAIL:
default:
// Fail or default is to do nothing at all and let the request fail
} //...switch(failDecision)
}
// fail through, if we are here, we must have had an exception before.
throw mapException(exceptionInMethod);
}
public void blurAlbum(long albumId, java.lang.String userId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
blurAlbum(albumId, userId, (ClientSideCallContext)null);
} //...public void blurAlbum(long albumId, java.lang.String userId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException
private void blurAlbum(long albumId, java.lang.String userId, org.distributeme.core.ClientSideCallContext diMeCallContext) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
List __fromServerSide = null;;
Exception exceptionInMethod = null;
if (diMeCallContext == null)
diMeCallContext = new ClientSideCallContext("blurAlbum");
if (discoveryMode==DiscoveryMode.AUTO && diMeCallContext.getServiceId()==null)
diMeCallContext.setServiceId(BlurSettingsServiceConstants.getServiceId());
HashMap __transportableCallContext = diMeCallContext.getTransportableCallContext();
// Initialize interceptors
List diMeInterceptors = InterceptorRegistry.getInstance().getClientSideRequestInterceptors();
InterceptionContext diMeInterceptionContext = new InterceptionContext();
// Concurrency control, client side - start
blurAlbumCCStrategy_longalbumId_javalangStringuserId.notifyClientSideCallStarted(diMeCallContext);
ArrayList diMeParameters = new ArrayList();
diMeParameters.add(albumId);
diMeParameters.add(userId);
diMeCallContext.setParameters(diMeParameters);
try{
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.BEFORE_SERVICE_CALL);
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.beforeServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
// Reparse parameters in case an interceptor modified them
albumId = ((Long)diMeParameters.get(0)).longValue();
userId = (java.lang.String) diMeParameters.get(1);
__fromServerSide = getDelegate(diMeCallContext.getServiceId()).blurAlbum(albumId, userId, __transportableCallContext);
__transportableCallContext.putAll(((HashMap)__fromServerSide.get(1)));
return;
}catch(RemoteException e){
// handle exceptions properly
e.printStackTrace();
notifyDelegateFailed(diMeCallContext.getServiceId());
exceptionInMethod = e;
}catch(NoConnectionToServerException e){
exceptionInMethod = e;
}finally{
// Concurrency control, client side - end
blurAlbumCCStrategy_longalbumId_javalangStringuserId.notifyClientSideCallFinished(diMeCallContext);
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.AFTER_SERVICE_CALL);
if (__fromServerSide!=null){
diMeInterceptionContext.setReturnValue(__fromServerSide.get(0));
}
diMeInterceptionContext.setException(exceptionInMethod);
boolean diMeReturnOverriden = false;
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.afterServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
}
// Failing
if (exceptionInMethod!=null){
FailDecision failDecision = blurAlbumFailingStrategy_longalbumId_javalangStringuserId.callFailed(diMeCallContext);
if (failDecision.getTargetService()!=null)
diMeCallContext.setServiceId(failDecision.getTargetService());
switch(failDecision.getReaction()){
case RETRY:
blurAlbum(albumId, userId, diMeCallContext.increaseCallCount());
return;
case RETRYONCE:
// Only retry if its the first call
if (!diMeCallContext.isFirstCall())
break;
blurAlbum(albumId, userId, diMeCallContext.increaseCallCount());
return;
case FAIL:
default:
// Fail or default is to do nothing at all and let the request fail
} //...switch(failDecision)
}
// fail through, if we are here, we must have had an exception before.
throw mapException(exceptionInMethod);
}
public void blurPicture(long albumId, long pictureId, java.lang.String userId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
blurPicture(albumId, pictureId, userId, (ClientSideCallContext)null);
} //...public void blurPicture(long albumId, long pictureId, java.lang.String userId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException
private void blurPicture(long albumId, long pictureId, java.lang.String userId, org.distributeme.core.ClientSideCallContext diMeCallContext) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
List __fromServerSide = null;;
Exception exceptionInMethod = null;
if (diMeCallContext == null)
diMeCallContext = new ClientSideCallContext("blurPicture");
if (discoveryMode==DiscoveryMode.AUTO && diMeCallContext.getServiceId()==null)
diMeCallContext.setServiceId(BlurSettingsServiceConstants.getServiceId());
HashMap __transportableCallContext = diMeCallContext.getTransportableCallContext();
// Initialize interceptors
List diMeInterceptors = InterceptorRegistry.getInstance().getClientSideRequestInterceptors();
InterceptionContext diMeInterceptionContext = new InterceptionContext();
// Concurrency control, client side - start
blurPictureCCStrategy_longalbumId_longpictureId_javalangStringuserId.notifyClientSideCallStarted(diMeCallContext);
ArrayList diMeParameters = new ArrayList();
diMeParameters.add(albumId);
diMeParameters.add(pictureId);
diMeParameters.add(userId);
diMeCallContext.setParameters(diMeParameters);
try{
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.BEFORE_SERVICE_CALL);
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.beforeServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
// Reparse parameters in case an interceptor modified them
albumId = ((Long)diMeParameters.get(0)).longValue();
pictureId = ((Long)diMeParameters.get(1)).longValue();
userId = (java.lang.String) diMeParameters.get(2);
__fromServerSide = getDelegate(diMeCallContext.getServiceId()).blurPicture(albumId, pictureId, userId, __transportableCallContext);
__transportableCallContext.putAll(((HashMap)__fromServerSide.get(1)));
return;
}catch(RemoteException e){
// handle exceptions properly
e.printStackTrace();
notifyDelegateFailed(diMeCallContext.getServiceId());
exceptionInMethod = e;
}catch(NoConnectionToServerException e){
exceptionInMethod = e;
}finally{
// Concurrency control, client side - end
blurPictureCCStrategy_longalbumId_longpictureId_javalangStringuserId.notifyClientSideCallFinished(diMeCallContext);
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.AFTER_SERVICE_CALL);
if (__fromServerSide!=null){
diMeInterceptionContext.setReturnValue(__fromServerSide.get(0));
}
diMeInterceptionContext.setException(exceptionInMethod);
boolean diMeReturnOverriden = false;
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.afterServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
}
// Failing
if (exceptionInMethod!=null){
FailDecision failDecision = blurPictureFailingStrategy_longalbumId_longpictureId_javalangStringuserId.callFailed(diMeCallContext);
if (failDecision.getTargetService()!=null)
diMeCallContext.setServiceId(failDecision.getTargetService());
switch(failDecision.getReaction()){
case RETRY:
blurPicture(albumId, pictureId, userId, diMeCallContext.increaseCallCount());
return;
case RETRYONCE:
// Only retry if its the first call
if (!diMeCallContext.isFirstCall())
break;
blurPicture(albumId, pictureId, userId, diMeCallContext.increaseCallCount());
return;
case FAIL:
default:
// Fail or default is to do nothing at all and let the request fail
} //...switch(failDecision)
}
// fail through, if we are here, we must have had an exception before.
throw mapException(exceptionInMethod);
}
public void blurPicture(long albumId, long pictureId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
blurPicture(albumId, pictureId, (ClientSideCallContext)null);
} //...public void blurPicture(long albumId, long pictureId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException
private void blurPicture(long albumId, long pictureId, org.distributeme.core.ClientSideCallContext diMeCallContext) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
List __fromServerSide = null;;
Exception exceptionInMethod = null;
if (diMeCallContext == null)
diMeCallContext = new ClientSideCallContext("blurPicture");
if (discoveryMode==DiscoveryMode.AUTO && diMeCallContext.getServiceId()==null)
diMeCallContext.setServiceId(BlurSettingsServiceConstants.getServiceId());
HashMap __transportableCallContext = diMeCallContext.getTransportableCallContext();
// Initialize interceptors
List diMeInterceptors = InterceptorRegistry.getInstance().getClientSideRequestInterceptors();
InterceptionContext diMeInterceptionContext = new InterceptionContext();
// Concurrency control, client side - start
blurPictureCCStrategy_longalbumId_longpictureId.notifyClientSideCallStarted(diMeCallContext);
ArrayList diMeParameters = new ArrayList();
diMeParameters.add(albumId);
diMeParameters.add(pictureId);
diMeCallContext.setParameters(diMeParameters);
try{
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.BEFORE_SERVICE_CALL);
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.beforeServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
// Reparse parameters in case an interceptor modified them
albumId = ((Long)diMeParameters.get(0)).longValue();
pictureId = ((Long)diMeParameters.get(1)).longValue();
__fromServerSide = getDelegate(diMeCallContext.getServiceId()).blurPicture(albumId, pictureId, __transportableCallContext);
__transportableCallContext.putAll(((HashMap)__fromServerSide.get(1)));
return;
}catch(RemoteException e){
// handle exceptions properly
e.printStackTrace();
notifyDelegateFailed(diMeCallContext.getServiceId());
exceptionInMethod = e;
}catch(NoConnectionToServerException e){
exceptionInMethod = e;
}finally{
// Concurrency control, client side - end
blurPictureCCStrategy_longalbumId_longpictureId.notifyClientSideCallFinished(diMeCallContext);
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.AFTER_SERVICE_CALL);
if (__fromServerSide!=null){
diMeInterceptionContext.setReturnValue(__fromServerSide.get(0));
}
diMeInterceptionContext.setException(exceptionInMethod);
boolean diMeReturnOverriden = false;
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.afterServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
}
// Failing
if (exceptionInMethod!=null){
FailDecision failDecision = blurPictureFailingStrategy_longalbumId_longpictureId.callFailed(diMeCallContext);
if (failDecision.getTargetService()!=null)
diMeCallContext.setServiceId(failDecision.getTargetService());
switch(failDecision.getReaction()){
case RETRY:
blurPicture(albumId, pictureId, diMeCallContext.increaseCallCount());
return;
case RETRYONCE:
// Only retry if its the first call
if (!diMeCallContext.isFirstCall())
break;
blurPicture(albumId, pictureId, diMeCallContext.increaseCallCount());
return;
case FAIL:
default:
// Fail or default is to do nothing at all and let the request fail
} //...switch(failDecision)
}
// fail through, if we are here, we must have had an exception before.
throw mapException(exceptionInMethod);
}
public void unBlurAlbum(long albumId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
unBlurAlbum(albumId, (ClientSideCallContext)null);
} //...public void unBlurAlbum(long albumId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException
private void unBlurAlbum(long albumId, org.distributeme.core.ClientSideCallContext diMeCallContext) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
List __fromServerSide = null;;
Exception exceptionInMethod = null;
if (diMeCallContext == null)
diMeCallContext = new ClientSideCallContext("unBlurAlbum");
if (discoveryMode==DiscoveryMode.AUTO && diMeCallContext.getServiceId()==null)
diMeCallContext.setServiceId(BlurSettingsServiceConstants.getServiceId());
HashMap __transportableCallContext = diMeCallContext.getTransportableCallContext();
// Initialize interceptors
List diMeInterceptors = InterceptorRegistry.getInstance().getClientSideRequestInterceptors();
InterceptionContext diMeInterceptionContext = new InterceptionContext();
// Concurrency control, client side - start
unBlurAlbumCCStrategy_longalbumId.notifyClientSideCallStarted(diMeCallContext);
ArrayList diMeParameters = new ArrayList();
diMeParameters.add(albumId);
diMeCallContext.setParameters(diMeParameters);
try{
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.BEFORE_SERVICE_CALL);
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.beforeServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
// Reparse parameters in case an interceptor modified them
albumId = ((Long)diMeParameters.get(0)).longValue();
__fromServerSide = getDelegate(diMeCallContext.getServiceId()).unBlurAlbum(albumId, __transportableCallContext);
__transportableCallContext.putAll(((HashMap)__fromServerSide.get(1)));
return;
}catch(RemoteException e){
// handle exceptions properly
e.printStackTrace();
notifyDelegateFailed(diMeCallContext.getServiceId());
exceptionInMethod = e;
}catch(NoConnectionToServerException e){
exceptionInMethod = e;
}finally{
// Concurrency control, client side - end
unBlurAlbumCCStrategy_longalbumId.notifyClientSideCallFinished(diMeCallContext);
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.AFTER_SERVICE_CALL);
if (__fromServerSide!=null){
diMeInterceptionContext.setReturnValue(__fromServerSide.get(0));
}
diMeInterceptionContext.setException(exceptionInMethod);
boolean diMeReturnOverriden = false;
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.afterServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
}
// Failing
if (exceptionInMethod!=null){
FailDecision failDecision = unBlurAlbumFailingStrategy_longalbumId.callFailed(diMeCallContext);
if (failDecision.getTargetService()!=null)
diMeCallContext.setServiceId(failDecision.getTargetService());
switch(failDecision.getReaction()){
case RETRY:
unBlurAlbum(albumId, diMeCallContext.increaseCallCount());
return;
case RETRYONCE:
// Only retry if its the first call
if (!diMeCallContext.isFirstCall())
break;
unBlurAlbum(albumId, diMeCallContext.increaseCallCount());
return;
case FAIL:
default:
// Fail or default is to do nothing at all and let the request fail
} //...switch(failDecision)
}
// fail through, if we are here, we must have had an exception before.
throw mapException(exceptionInMethod);
}
public void unBlurAlbum(long albumId, java.lang.String userId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
unBlurAlbum(albumId, userId, (ClientSideCallContext)null);
} //...public void unBlurAlbum(long albumId, java.lang.String userId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException
private void unBlurAlbum(long albumId, java.lang.String userId, org.distributeme.core.ClientSideCallContext diMeCallContext) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
List __fromServerSide = null;;
Exception exceptionInMethod = null;
if (diMeCallContext == null)
diMeCallContext = new ClientSideCallContext("unBlurAlbum");
if (discoveryMode==DiscoveryMode.AUTO && diMeCallContext.getServiceId()==null)
diMeCallContext.setServiceId(BlurSettingsServiceConstants.getServiceId());
HashMap __transportableCallContext = diMeCallContext.getTransportableCallContext();
// Initialize interceptors
List diMeInterceptors = InterceptorRegistry.getInstance().getClientSideRequestInterceptors();
InterceptionContext diMeInterceptionContext = new InterceptionContext();
// Concurrency control, client side - start
unBlurAlbumCCStrategy_longalbumId_javalangStringuserId.notifyClientSideCallStarted(diMeCallContext);
ArrayList diMeParameters = new ArrayList();
diMeParameters.add(albumId);
diMeParameters.add(userId);
diMeCallContext.setParameters(diMeParameters);
try{
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.BEFORE_SERVICE_CALL);
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.beforeServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
// Reparse parameters in case an interceptor modified them
albumId = ((Long)diMeParameters.get(0)).longValue();
userId = (java.lang.String) diMeParameters.get(1);
__fromServerSide = getDelegate(diMeCallContext.getServiceId()).unBlurAlbum(albumId, userId, __transportableCallContext);
__transportableCallContext.putAll(((HashMap)__fromServerSide.get(1)));
return;
}catch(RemoteException e){
// handle exceptions properly
e.printStackTrace();
notifyDelegateFailed(diMeCallContext.getServiceId());
exceptionInMethod = e;
}catch(NoConnectionToServerException e){
exceptionInMethod = e;
}finally{
// Concurrency control, client side - end
unBlurAlbumCCStrategy_longalbumId_javalangStringuserId.notifyClientSideCallFinished(diMeCallContext);
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.AFTER_SERVICE_CALL);
if (__fromServerSide!=null){
diMeInterceptionContext.setReturnValue(__fromServerSide.get(0));
}
diMeInterceptionContext.setException(exceptionInMethod);
boolean diMeReturnOverriden = false;
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.afterServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
}
// Failing
if (exceptionInMethod!=null){
FailDecision failDecision = unBlurAlbumFailingStrategy_longalbumId_javalangStringuserId.callFailed(diMeCallContext);
if (failDecision.getTargetService()!=null)
diMeCallContext.setServiceId(failDecision.getTargetService());
switch(failDecision.getReaction()){
case RETRY:
unBlurAlbum(albumId, userId, diMeCallContext.increaseCallCount());
return;
case RETRYONCE:
// Only retry if its the first call
if (!diMeCallContext.isFirstCall())
break;
unBlurAlbum(albumId, userId, diMeCallContext.increaseCallCount());
return;
case FAIL:
default:
// Fail or default is to do nothing at all and let the request fail
} //...switch(failDecision)
}
// fail through, if we are here, we must have had an exception before.
throw mapException(exceptionInMethod);
}
public void unBlurPicture(long albumId, long pictureId, java.lang.String userId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
unBlurPicture(albumId, pictureId, userId, (ClientSideCallContext)null);
} //...public void unBlurPicture(long albumId, long pictureId, java.lang.String userId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException
private void unBlurPicture(long albumId, long pictureId, java.lang.String userId, org.distributeme.core.ClientSideCallContext diMeCallContext) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
List __fromServerSide = null;;
Exception exceptionInMethod = null;
if (diMeCallContext == null)
diMeCallContext = new ClientSideCallContext("unBlurPicture");
if (discoveryMode==DiscoveryMode.AUTO && diMeCallContext.getServiceId()==null)
diMeCallContext.setServiceId(BlurSettingsServiceConstants.getServiceId());
HashMap __transportableCallContext = diMeCallContext.getTransportableCallContext();
// Initialize interceptors
List diMeInterceptors = InterceptorRegistry.getInstance().getClientSideRequestInterceptors();
InterceptionContext diMeInterceptionContext = new InterceptionContext();
// Concurrency control, client side - start
unBlurPictureCCStrategy_longalbumId_longpictureId_javalangStringuserId.notifyClientSideCallStarted(diMeCallContext);
ArrayList diMeParameters = new ArrayList();
diMeParameters.add(albumId);
diMeParameters.add(pictureId);
diMeParameters.add(userId);
diMeCallContext.setParameters(diMeParameters);
try{
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.BEFORE_SERVICE_CALL);
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.beforeServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
// Reparse parameters in case an interceptor modified them
albumId = ((Long)diMeParameters.get(0)).longValue();
pictureId = ((Long)diMeParameters.get(1)).longValue();
userId = (java.lang.String) diMeParameters.get(2);
__fromServerSide = getDelegate(diMeCallContext.getServiceId()).unBlurPicture(albumId, pictureId, userId, __transportableCallContext);
__transportableCallContext.putAll(((HashMap)__fromServerSide.get(1)));
return;
}catch(RemoteException e){
// handle exceptions properly
e.printStackTrace();
notifyDelegateFailed(diMeCallContext.getServiceId());
exceptionInMethod = e;
}catch(NoConnectionToServerException e){
exceptionInMethod = e;
}finally{
// Concurrency control, client side - end
unBlurPictureCCStrategy_longalbumId_longpictureId_javalangStringuserId.notifyClientSideCallFinished(diMeCallContext);
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.AFTER_SERVICE_CALL);
if (__fromServerSide!=null){
diMeInterceptionContext.setReturnValue(__fromServerSide.get(0));
}
diMeInterceptionContext.setException(exceptionInMethod);
boolean diMeReturnOverriden = false;
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.afterServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
}
// Failing
if (exceptionInMethod!=null){
FailDecision failDecision = unBlurPictureFailingStrategy_longalbumId_longpictureId_javalangStringuserId.callFailed(diMeCallContext);
if (failDecision.getTargetService()!=null)
diMeCallContext.setServiceId(failDecision.getTargetService());
switch(failDecision.getReaction()){
case RETRY:
unBlurPicture(albumId, pictureId, userId, diMeCallContext.increaseCallCount());
return;
case RETRYONCE:
// Only retry if its the first call
if (!diMeCallContext.isFirstCall())
break;
unBlurPicture(albumId, pictureId, userId, diMeCallContext.increaseCallCount());
return;
case FAIL:
default:
// Fail or default is to do nothing at all and let the request fail
} //...switch(failDecision)
}
// fail through, if we are here, we must have had an exception before.
throw mapException(exceptionInMethod);
}
public void unBlurPicture(long albumId, long pictureId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
unBlurPicture(albumId, pictureId, (ClientSideCallContext)null);
} //...public void unBlurPicture(long albumId, long pictureId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException
private void unBlurPicture(long albumId, long pictureId, org.distributeme.core.ClientSideCallContext diMeCallContext) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
List __fromServerSide = null;;
Exception exceptionInMethod = null;
if (diMeCallContext == null)
diMeCallContext = new ClientSideCallContext("unBlurPicture");
if (discoveryMode==DiscoveryMode.AUTO && diMeCallContext.getServiceId()==null)
diMeCallContext.setServiceId(BlurSettingsServiceConstants.getServiceId());
HashMap __transportableCallContext = diMeCallContext.getTransportableCallContext();
// Initialize interceptors
List diMeInterceptors = InterceptorRegistry.getInstance().getClientSideRequestInterceptors();
InterceptionContext diMeInterceptionContext = new InterceptionContext();
// Concurrency control, client side - start
unBlurPictureCCStrategy_longalbumId_longpictureId.notifyClientSideCallStarted(diMeCallContext);
ArrayList diMeParameters = new ArrayList();
diMeParameters.add(albumId);
diMeParameters.add(pictureId);
diMeCallContext.setParameters(diMeParameters);
try{
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.BEFORE_SERVICE_CALL);
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.beforeServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
// Reparse parameters in case an interceptor modified them
albumId = ((Long)diMeParameters.get(0)).longValue();
pictureId = ((Long)diMeParameters.get(1)).longValue();
__fromServerSide = getDelegate(diMeCallContext.getServiceId()).unBlurPicture(albumId, pictureId, __transportableCallContext);
__transportableCallContext.putAll(((HashMap)__fromServerSide.get(1)));
return;
}catch(RemoteException e){
// handle exceptions properly
e.printStackTrace();
notifyDelegateFailed(diMeCallContext.getServiceId());
exceptionInMethod = e;
}catch(NoConnectionToServerException e){
exceptionInMethod = e;
}finally{
// Concurrency control, client side - end
unBlurPictureCCStrategy_longalbumId_longpictureId.notifyClientSideCallFinished(diMeCallContext);
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.AFTER_SERVICE_CALL);
if (__fromServerSide!=null){
diMeInterceptionContext.setReturnValue(__fromServerSide.get(0));
}
diMeInterceptionContext.setException(exceptionInMethod);
boolean diMeReturnOverriden = false;
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.afterServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
}
// Failing
if (exceptionInMethod!=null){
FailDecision failDecision = unBlurPictureFailingStrategy_longalbumId_longpictureId.callFailed(diMeCallContext);
if (failDecision.getTargetService()!=null)
diMeCallContext.setServiceId(failDecision.getTargetService());
switch(failDecision.getReaction()){
case RETRY:
unBlurPicture(albumId, pictureId, diMeCallContext.increaseCallCount());
return;
case RETRYONCE:
// Only retry if its the first call
if (!diMeCallContext.isFirstCall())
break;
unBlurPicture(albumId, pictureId, diMeCallContext.increaseCallCount());
return;
case FAIL:
default:
// Fail or default is to do nothing at all and let the request fail
} //...switch(failDecision)
}
// fail through, if we are here, we must have had an exception before.
throw mapException(exceptionInMethod);
}
public void removeBlurSettings(long albumId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
removeBlurSettings(albumId, (ClientSideCallContext)null);
} //...public void removeBlurSettings(long albumId) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException
private void removeBlurSettings(long albumId, org.distributeme.core.ClientSideCallContext diMeCallContext) throws net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException{
List __fromServerSide = null;;
Exception exceptionInMethod = null;
if (diMeCallContext == null)
diMeCallContext = new ClientSideCallContext("removeBlurSettings");
if (discoveryMode==DiscoveryMode.AUTO && diMeCallContext.getServiceId()==null)
diMeCallContext.setServiceId(BlurSettingsServiceConstants.getServiceId());
HashMap __transportableCallContext = diMeCallContext.getTransportableCallContext();
// Initialize interceptors
List diMeInterceptors = InterceptorRegistry.getInstance().getClientSideRequestInterceptors();
InterceptionContext diMeInterceptionContext = new InterceptionContext();
// Concurrency control, client side - start
removeBlurSettingsCCStrategy_longalbumId.notifyClientSideCallStarted(diMeCallContext);
ArrayList diMeParameters = new ArrayList();
diMeParameters.add(albumId);
diMeCallContext.setParameters(diMeParameters);
try{
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.BEFORE_SERVICE_CALL);
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.beforeServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
// Reparse parameters in case an interceptor modified them
albumId = ((Long)diMeParameters.get(0)).longValue();
__fromServerSide = getDelegate(diMeCallContext.getServiceId()).removeBlurSettings(albumId, __transportableCallContext);
__transportableCallContext.putAll(((HashMap)__fromServerSide.get(1)));
return;
}catch(RemoteException e){
// handle exceptions properly
e.printStackTrace();
notifyDelegateFailed(diMeCallContext.getServiceId());
exceptionInMethod = e;
}catch(NoConnectionToServerException e){
exceptionInMethod = e;
}finally{
// Concurrency control, client side - end
removeBlurSettingsCCStrategy_longalbumId.notifyClientSideCallFinished(diMeCallContext);
diMeInterceptionContext.setCurrentPhase(InterceptionPhase.AFTER_SERVICE_CALL);
if (__fromServerSide!=null){
diMeInterceptionContext.setReturnValue(__fromServerSide.get(0));
}
diMeInterceptionContext.setException(exceptionInMethod);
boolean diMeReturnOverriden = false;
for (ClientSideRequestInterceptor interceptor : diMeInterceptors){
InterceptorResponse interceptorResponse = interceptor.afterServiceCall(diMeCallContext, diMeInterceptionContext);
switch(interceptorResponse.getCommand()){
case ABORT:
if (interceptorResponse.getException() instanceof RuntimeException)
throw (RuntimeException) interceptorResponse.getException();
if (interceptorResponse.getException() instanceof net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException)
throw (net.anotheria.anosite.photoserver.service.blur.BlurSettingsServiceException) interceptorResponse.getException();
throw new RuntimeException("Interceptor exception",interceptorResponse.getException());
case RETURN:
return;
case CONTINUE:
break;
default:
throw new IllegalStateException("Unsupported or unexpected command from interceptor " + interceptorResponse.getCommand()+ " in phase:"+diMeInterceptionContext.getCurrentPhase());
} //...switch
} //...for
}
// Failing
if (exceptionInMethod!=null){
FailDecision failDecision = removeBlurSettingsFailingStrategy_longalbumId.callFailed(diMeCallContext);
if (failDecision.getTargetService()!=null)
diMeCallContext.setServiceId(failDecision.getTargetService());
switch(failDecision.getReaction()){
case RETRY:
removeBlurSettings(albumId, diMeCallContext.increaseCallCount());
return;
case RETRYONCE:
// Only retry if its the first call
if (!diMeCallContext.isFirstCall())
break;
removeBlurSettings(albumId, diMeCallContext.increaseCallCount());
return;
case FAIL:
default:
// Fail or default is to do nothing at all and let the request fail
} //...switch(failDecision)
}
// fail through, if we are here, we must have had an exception before.
throw mapException(exceptionInMethod);
}
private void notifyDelegateFailed(){
notifyDelegateFailed(BlurSettingsServiceConstants.getServiceId());
}
private void notifyDelegateFailed(String serviceId){
if (serviceId!=null)
delegates.remove(serviceId);
}
private RemoteBlurSettingsService getDelegate() throws NoConnectionToServerException{
if (discoveryMode==DiscoveryMode.MANUAL)
return manuallySetTarget;
return getDelegate(BlurSettingsServiceConstants.getServiceId());
}
private RemoteBlurSettingsService getDelegate(String serviceId) throws NoConnectionToServerException{
// if no serviceid is provided, fallback to default resolve with manual mode
if (serviceId==null)
return getDelegate();
RemoteBlurSettingsService delegate = delegates.get(serviceId);
if (delegate==null){
try{
delegate = lookup(serviceId);
delegates.putIfAbsent(serviceId, delegate);
}catch(Exception e){
// //TODO - generate and throw typed exception.
throw new NoConnectionToServerException("Couldn't lookup delegate because: "+e.getMessage()+" at "+RegistryUtil.describeRegistry(), e);
}//try
} //...first if (del==null)
return delegate;
} //...fun
private RemoteBlurSettingsService lookup(String serviceId) throws NoConnectionToServerException{
// //first we need to lookup target host.
ServiceDescriptor toLookup = new ServiceDescriptor(Protocol.RMI, serviceId);
ServiceDescriptor targetService = RegistryUtil.resolve(toLookup);
if (targetService==null)
throw new RuntimeException("Can't resolve host for an instance of "+BlurSettingsServiceConstants.getServiceId());
Registry registry = null;
try{
registry = LocateRegistry.getRegistry(targetService.getHost(), targetService.getPort());
}catch(Exception e){
System.err.println("lookup - couldn't obtain rmi registry on "+targetService+", aborting lookup"); e.printStackTrace();
throw new NoConnectionToServerException("Can't resolve rmi registry for an instance of "+BlurSettingsServiceConstants.getServiceId());
}
try{
return (RemoteBlurSettingsService) registry.lookup(serviceId);
}catch(RemoteException e){
throw new NoConnectionToServerException("Can't lookup service in the target rmi registry for an instance of "+serviceId, e);
}catch(NotBoundException e){
throw new NoConnectionToServerException("Can't lookup service in the target rmi registry for an instance of "+serviceId, e);
}
}
private RemoteBlurSettingsService lookup(ServiceDescriptor serviceDescriptor) throws NoConnectionToServerException{
Registry registry = null;
try{
registry = LocateRegistry.getRegistry(serviceDescriptor.getHost(), serviceDescriptor.getPort());
}catch(Exception e){
System.err.println("lookup - couldn't obtain rmi registry on "+serviceDescriptor+", aborting lookup"); e.printStackTrace();
throw new NoConnectionToServerException("Can't resolve rmi registry for "+serviceDescriptor);
}
try{
return (RemoteBlurSettingsService) registry.lookup(serviceDescriptor.getServiceId());
}catch(RemoteException e){
throw new NoConnectionToServerException("Can't lookup service in the target rmi registry for an instance of "+serviceDescriptor, e);
}catch(NotBoundException e){
throw new NoConnectionToServerException("Can't lookup service in the target rmi registry for an instance of "+serviceDescriptor, e);
}
}
private DistributemeRuntimeException mapException(Exception in){
if (in instanceof DistributemeRuntimeException)
return (DistributemeRuntimeException) in;
if (in instanceof RemoteException)
return new ServiceUnavailableException ("Service unavailable due to rmi failure: "+in.getMessage(), in);
return new ServiceUnavailableException("Unexpected exception: "+in.getMessage()+" " + in.getClass().getName(), in);
}
}