[Join-cvs] join1/src/main/org/figure8/join/services/remoting/services ArtifactServiceImpl.java, 1.
Brought to you by:
lbroudoux
|
From: Laurent B. <lbr...@us...> - 2008-02-03 22:46:16
|
Update of /cvsroot/join/join1/src/main/org/figure8/join/services/remoting/services In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4086/services/remoting/services Modified Files: ArtifactServiceImpl.java BeansHelper.java CronServiceImpl.java MessagingServiceImpl.java Log Message: Fix checstyle issues Index: BeansHelper.java =================================================================== RCS file: /cvsroot/join/join1/src/main/org/figure8/join/services/remoting/services/BeansHelper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BeansHelper.java 6 Feb 2007 20:10:51 -0000 1.3 --- BeansHelper.java 3 Feb 2008 22:46:10 -0000 1.4 *************** *** 1,4 **** /** ! * Copyright 2005-2006 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the --- 1,4 ---- /** ! * Copyright 2005-2008 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the *************** *** 15,18 **** --- 15,19 ---- package org.figure8.join.services.remoting.services; + import org.figure8.join.core.InvalidParameterException; import org.figure8.join.core.messaging.JMSConsumerBeanInfo; import org.figure8.join.core.messaging.JMSConsumerBeanParameterInfo; *************** *** 93,96 **** --- 94,118 ---- /** + * Gets a local view of a {@link RemoteJMSConsumerBeanInfo} remote object + * @param info The remote consumer bean information wrapper + * @throws InvalidParameterException if consumerBeanClass of remote bean is not correct + * (see JMSConsumerBeanInfo documentation for that) + * @return The JMSConsumerBeanInfo corresponding + */ + public static JMSConsumerBeanInfo getLocalObject(RemoteJMSConsumerBeanInfo info) throws InvalidParameterException{ + JMSConsumerBeanInfo result = new JMSConsumerBeanInfo(info.getName(), info.getSelector(), info.getDestination(), + info.getConsumerBeanClass()); + result.setActive(info.isActive()); + result.setThreadSafe(info.isThreadSafe()); + // Add consumer parameters if not empty. + for (int i=0; i<info.getConsumerParameterInfos().size(); i++){ + RemoteParameter param = (RemoteParameter)info.getConsumerParameterInfos().get(i); + JMSConsumerBeanParameterInfo lParam = new JMSConsumerBeanParameterInfo(param.getName(), param.getValue()); + result.addConsumerParameterInfo(lParam); + } + return result; + } + + /** * Gets a remote view of a {@link JMSConsumerBeanInfo} domain object * @param info The consumer bean information wrapper *************** *** 98,105 **** */ public static RemoteJMSConsumerBeanInfo getRemoteObject(JMSConsumerBeanInfo info){ ! RemoteJMSConsumerBeanInfo result = new RemoteJMSConsumerBeanInfo(info.getName(), info.getSelector(), info.getDestination(), ! info.getConsumerBeanClass(), info.isActive(), info.isThreadSafe()); // Add consumer parameters if not empty. ! for (int i=0; i< info.getConsumerParameterInfos().size(); i++){ JMSConsumerBeanParameterInfo param = (JMSConsumerBeanParameterInfo)info.getConsumerParameterInfos().get(i); RemoteParameter rParam = new RemoteParameter(param.getName(), param.getValue()); --- 120,127 ---- */ public static RemoteJMSConsumerBeanInfo getRemoteObject(JMSConsumerBeanInfo info){ ! RemoteJMSConsumerBeanInfo result = new RemoteJMSConsumerBeanInfo(info.getName(), info.getSelector(), ! info.getDestination(), info.getConsumerBeanClass(), info.isActive(), info.isThreadSafe()); // Add consumer parameters if not empty. ! for (int i=0; i<info.getConsumerParameterInfos().size(); i++){ JMSConsumerBeanParameterInfo param = (JMSConsumerBeanParameterInfo)info.getConsumerParameterInfos().get(i); RemoteParameter rParam = new RemoteParameter(param.getName(), param.getValue()); *************** *** 111,114 **** --- 133,161 ---- /** + * Gets a local view of a {@link RemoteQuartzCronInfo} remote object + * @param info The remote cron information wrapper + * @throws InvalidParameterException if jobClass of remote bean is not correct + * (see QuartzCronInfo documentation for that) + * @return The QuartzCronInfo corresponding + */ + public static QuartzCronInfo getLocalObject(RemoteQuartzCronInfo info) throws InvalidParameterException{ + QuartzCronInfo result = new QuartzCronInfo(info.getName(), info.getCronExpression(), + info.getJobType(), info.getJobClass()); + // Add cron job parameters if not empty. + for (int i=0; i<info.getJobParameters().size(); i++){ + RemoteParameter param = (RemoteParameter)info.getJobParameters().get(i); + QuartzCronParameterInfo lParam = new QuartzCronParameterInfo(param.getName(), param.getValue(), true); + result.addJobParameterInfo(lParam); + } + // Add cron user parameters if not empty. + for (int i=0; i<info.getUserParameters().size(); i++){ + RemoteParameter param = (RemoteParameter)info.getUserParameters().get(i); + QuartzCronParameterInfo lParam = new QuartzCronParameterInfo(param.getName(), param.getValue(), false); + result.addJobParameterInfo(lParam); + } + return result; + } + + /** * Gets a remote view of a {@link QuartzCronInfo} domain object * @param info The cron bean information wrapper. *************** *** 116,121 **** */ public static RemoteQuartzCronInfo getRemoteObject(QuartzCronInfo info){ ! RemoteQuartzCronInfo result = new RemoteQuartzCronInfo(info.getName(), info.getCronExpression(), info.getJobType(), ! info.getJobClass()); // Add info parameters if not empty for (int i=0; i<info.getJobParameterInfos().size(); i++){ --- 163,168 ---- */ public static RemoteQuartzCronInfo getRemoteObject(QuartzCronInfo info){ ! RemoteQuartzCronInfo result = new RemoteQuartzCronInfo(info.getName(), info.getCronExpression(), ! info.getJobType(), info.getJobClass()); // Add info parameters if not empty for (int i=0; i<info.getJobParameterInfos().size(); i++){ Index: MessagingServiceImpl.java =================================================================== RCS file: /cvsroot/join/join1/src/main/org/figure8/join/services/remoting/services/MessagingServiceImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MessagingServiceImpl.java 20 Dec 2006 22:36:19 -0000 1.2 --- MessagingServiceImpl.java 3 Feb 2008 22:46:10 -0000 1.3 *************** *** 1,4 **** /** ! * Copyright 2005-2006 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the --- 1,4 ---- /** ! * Copyright 2005-2008 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the *************** *** 20,26 **** --- 20,28 ---- import org.figure8.join.core.messaging.JMSConsumerBeanInfo; import org.figure8.join.core.messaging.JMSConsumerBeanManager; + import org.figure8.join.core.messaging.JMSConsumerBeanParameterInfo; import org.figure8.join.services.remoting.MessagingService; import org.figure8.join.services.remoting.InvalidSessionException; import org.figure8.join.services.remoting.beans.RemoteJMSConsumerBeanInfo; + import org.figure8.join.services.remoting.beans.RemoteParameter; import org.figure8.join.businessobjects.security.Role; import org.figure8.join.view.UserView; *************** *** 83,88 **** * @throws RemoteException if an exception occurs during the remote conversation */ ! public void saveConsumerBeanInfo(String token, RemoteJMSConsumerBeanInfo info) throws InvalidSessionException, InvalidParameterException, ! DuplicateEntityException, InfrastructureException, RemoteException{ log.info("Saving consumer bean info with name: " + info.getName()); // Ensure token is still valid, get required role. --- 85,90 ---- * @throws RemoteException if an exception occurs during the remote conversation */ ! public void saveConsumerBeanInfo(String token, RemoteJMSConsumerBeanInfo info) throws InvalidSessionException, ! InvalidParameterException, DuplicateEntityException, InfrastructureException, RemoteException{ log.info("Saving consumer bean info with name: " + info.getName()); // Ensure token is still valid, get required role. *************** *** 105,108 **** --- 107,119 ---- bean.setDestination(info.getDestination()); bean.setConsumerBeanClass(info.getConsumerBeanClass()); + // Clear and add parameters if provided. + bean.getConsumerParameterInfos().clear(); + if (info.getConsumerParameterInfos() != null && !info.getConsumerParameterInfos().isEmpty()){ + for (int i=0; i<info.getConsumerParameterInfos().size(); i++){ + RemoteParameter infoP = (RemoteParameter)info.getConsumerParameterInfos().get(i); + JMSConsumerBeanParameterInfo param = new JMSConsumerBeanParameterInfo(infoP.getName(), infoP.getValue()); + bean.addConsumerParameterInfo(param); + } + } // Delegate save to manager. consumerManager.saveConsumerBeanInfo(bean); *************** *** 177,181 **** * @return An array of {@link RemoteJMSConsumerBeanInfo} objects. */ ! public RemoteJMSConsumerBeanInfo[] getConsumerBeanInfos(String token) throws InvalidSessionException, RemoteException{ log.debug("Retrieving consumer bean informations."); // Ensure token is still valid, get required role. --- 188,193 ---- * @return An array of {@link RemoteJMSConsumerBeanInfo} objects. */ ! public RemoteJMSConsumerBeanInfo[] getConsumerBeanInfos(String token) throws InvalidSessionException, ! RemoteException{ log.debug("Retrieving consumer bean informations."); // Ensure token is still valid, get required role. Index: CronServiceImpl.java =================================================================== RCS file: /cvsroot/join/join1/src/main/org/figure8/join/services/remoting/services/CronServiceImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CronServiceImpl.java 25 Jul 2006 12:29:22 -0000 1.2 --- CronServiceImpl.java 3 Feb 2008 22:46:10 -0000 1.3 *************** *** 1,4 **** /** ! * Copyright 2005-2006 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the --- 1,4 ---- /** ! * Copyright 2005-2008 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the *************** *** 78,83 **** * @throws RemoteException if an exception occurs during the remote conversation */ ! public void saveCron(String token, RemoteQuartzCronInfo remoteCron) throws InvalidSessionException, InvalidParameterException, ! DuplicateEntityException, RemoteException{ // Ensure token is still valid, get required role. UserView user = getAuthenticatedUser(token); --- 78,83 ---- * @throws RemoteException if an exception occurs during the remote conversation */ ! public void saveCron(String token, RemoteQuartzCronInfo remoteCron) throws InvalidSessionException, ! InvalidParameterException, DuplicateEntityException, RemoteException{ // Ensure token is still valid, get required role. UserView user = getAuthenticatedUser(token); *************** *** 87,91 **** if (user.hasPermission(adminRole)){ QuartzCronInfo cron = manager.getQuartzCron(remoteCron.getName()); ! if (cron==null){ cron = new QuartzCronInfo(); cron.setName(remoteCron.getName()); --- 87,91 ---- if (user.hasPermission(adminRole)){ QuartzCronInfo cron = manager.getQuartzCron(remoteCron.getName()); ! if (cron == null){ cron = new QuartzCronInfo(); cron.setName(remoteCron.getName()); *************** *** 99,103 **** while (itParameters.hasNext()){ RemoteParameter remoteParameter = (RemoteParameter)itParameters.next(); ! QuartzCronParameterInfo parameter = new QuartzCronParameterInfo(remoteParameter.getName(), remoteParameter.getValue(), true); cron.addJobParameterInfo(parameter); } --- 99,104 ---- while (itParameters.hasNext()){ RemoteParameter remoteParameter = (RemoteParameter)itParameters.next(); ! QuartzCronParameterInfo parameter = new QuartzCronParameterInfo(remoteParameter.getName(), ! remoteParameter.getValue(), true); cron.addJobParameterInfo(parameter); } *************** *** 106,110 **** while (itParameters.hasNext()){ RemoteParameter remoteParameter = (RemoteParameter)itParameters.next(); ! QuartzCronParameterInfo parameter = new QuartzCronParameterInfo(remoteParameter.getName(), remoteParameter.getValue(), false); cron.addJobParameterInfo(parameter); } --- 107,112 ---- while (itParameters.hasNext()){ RemoteParameter remoteParameter = (RemoteParameter)itParameters.next(); ! QuartzCronParameterInfo parameter = new QuartzCronParameterInfo(remoteParameter.getName(), ! remoteParameter.getValue(), false); cron.addJobParameterInfo(parameter); } *************** *** 122,126 **** * @throws RemoteException if an exception occurs during the remote conversation */ ! public void removeCron(String token, RemoteQuartzCronInfo remoteCron) throws InvalidSessionException, RemoteException{ // Ensure token is still valid, get required role. UserView user = getAuthenticatedUser(token); --- 124,129 ---- * @throws RemoteException if an exception occurs during the remote conversation */ ! public void removeCron(String token, RemoteQuartzCronInfo remoteCron) throws InvalidSessionException, ! RemoteException{ // Ensure token is still valid, get required role. UserView user = getAuthenticatedUser(token); Index: ArtifactServiceImpl.java =================================================================== RCS file: /cvsroot/join/join1/src/main/org/figure8/join/services/remoting/services/ArtifactServiceImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ArtifactServiceImpl.java 14 Jan 2007 14:35:56 -0000 1.2 --- ArtifactServiceImpl.java 3 Feb 2008 22:46:10 -0000 1.3 *************** *** 1,4 **** /** ! * Copyright 2005-2006 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the --- 1,4 ---- /** ! * Copyright 2005-2008 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the *************** *** 23,27 **** import org.figure8.join.services.remoting.beans.RemoteDeliverable; import org.figure8.join.services.remoting.beans.RemoteDeliverableType; - import org.figure8.join.businessobjects.artifact.Build; import org.figure8.join.businessobjects.artifact.Assembly; import org.figure8.join.businessobjects.artifact.Component; --- 23,26 ---- *************** *** 213,217 **** else{ // Warn and raise exception. ! log.warn("User '" + user.getUser().getLogin() + "' do not have required permission for supplying " + type.getLabel()); throw new InvalidSessionException("Permission is required for supplying " + type.getLabel()); } --- 212,217 ---- else{ // Warn and raise exception. ! log.warn("User '" + user.getUser().getLogin() + "' do not have required permission for supplying " ! + type.getLabel()); throw new InvalidSessionException("Permission is required for supplying " + type.getLabel()); } *************** *** 237,241 **** ComponentType type = artifactManager.getComponentType(component.getComponentTypeKey()); if (type == null) ! throw new InvalidParameterException(component.getComponentTypeKey() + " does not represent an existing component type !"); // Create corresponding component. Component comp = new Component(component.getVersionInfo(), component.getSize(), type); --- 237,242 ---- ComponentType type = artifactManager.getComponentType(component.getComponentTypeKey()); if (type == null) ! throw new InvalidParameterException(component.getComponentTypeKey() ! + " does not represent an existing component type !"); // Create corresponding component. Component comp = new Component(component.getVersionInfo(), component.getSize(), type); |