Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into 7239-submods
Browse files Browse the repository at this point in the history
Conflicts:
	components/insight/ivy.xml
  • Loading branch information
joshmoore committed Mar 16, 2012
2 parents 5be7586 + bd69e8b commit 17a7f0f
Show file tree
Hide file tree
Showing 1,011 changed files with 58,813 additions and 82,968 deletions.
3 changes: 2 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,14 @@ java component.
</copy>
<!-- These should eventually be removed in favor of an ivy-based approach -->
<copy todir="target">
<fileset dir="components/insight/target" includes="insight*.zip"/>
<fileset dir="components/insight/target" includes="insight*.zip" excludes="*-ij*.zip"/>
<mapper type="regexp" from="insight(.*).zip" to="OMERO.insight-${omero.version}\1.zip"/>
</copy>
<copy todir="target">
<fileset dir="components/insight/target" includes="editor*.zip"/>
<mapper type="regexp" from="editor(.*).zip" to="OMERO.editor-${omero.version}\1.zip"/>
</copy>
<copy file="components/insight/target/insight-ij.zip" tofile="target/OMERO.insight-ij-${omero.version}.zip"/>
</target>

<target name="release-src" description="Zip the git source into OMERO.source-${omero.version}.zip">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,12 @@
==============================================================================
-->

<bean id="::omero::cmd::Handle" class="omero.cmd.HandleI" singleton="false">
<constructor-arg value="${omero.threads.cancel_timeout}"/>
<bean id="::omero::cmd::Handle" class="omero.cmd._HandleTie" singleton="false">
<constructor-arg>
<bean class="omero.cmd.HandleI" singleton="false">
<constructor-arg value="${omero.threads.cancel_timeout}"/>
</bean>
</constructor-arg>
</bean>

<bean class="omero.cmd.RequestObjectFactoryRegistry">
Expand Down
6 changes: 3 additions & 3 deletions components/blitz/resources/omero/ServerErrors.ice
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,14 @@ module omero
{
};

exception GroupSecurityViolation extends ServerError
exception GroupSecurityViolation extends SecurityViolation
{
};

exception PermissionMismatchGroupSecurityViolation extends ServerError
exception PermissionMismatchGroupSecurityViolation extends SecurityViolation
{
};
exception ReadOnlyGroupSecurityViolation extends ServerError
exception ReadOnlyGroupSecurityViolation extends SecurityViolation
{
};

Expand Down
1 change: 1 addition & 0 deletions components/blitz/resources/omero/api/ThumbnailStore.ice
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module omero {
["ami", "amd"] interface ThumbnailStore extends StatefulServiceInterface
{
bool setPixelsId(long pixelsId) throws ServerError;
bool isInProgress() throws ServerError;
void setRenderingDefId(long renderingDefId) throws ServerError;
long getRenderingDefId() throws ServerError;
Ice::ByteSeq getThumbnail(omero::RInt sizeX, omero::RInt sizeY) throws ServerError;
Expand Down
32 changes: 23 additions & 9 deletions components/blitz/src/ome/formats/importer/util/IniFileLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public IniFileLoader(File userConfigFile) {
userPrefs = new IniFile(userConfigFile, Mode.RW);
} catch (BackingStoreException e) {
log.error(e);
throw new RuntimeException("Error accessing ini file", e);
//throw new RuntimeException("Error accessing ini file", e);
}
}

Expand All @@ -126,13 +126,15 @@ public void flushPreferences() {
* Any value lower than null will not call configureDebug.
*/
public int getDebugLevel() {
if (userPrefs == null) return -1;
return userPrefs.node("General").getInt("debug", -1);
}

/**
* @return if quaqua should be used on mac
*/
public boolean getUseQuaqua() {
if (userPrefs == null) return true;
return userPrefs.node("General").getBoolean("useQuaqua", true);
}

Expand Down Expand Up @@ -214,6 +216,7 @@ public boolean getStaticDisableHistory()
*/
public void setUserDisableHistory(boolean b)
{
if (userPrefs == null) return;
userPrefs.node("UI").putBoolean("disableHistory", b);
this.flushPreferences();
}
Expand All @@ -223,6 +226,7 @@ public void setUserDisableHistory(boolean b)
*/
public Boolean getUserDisableHistory()
{
if (userPrefs == null) return true;
return userPrefs.node("UI").getBoolean("disableHistory", true);
}

Expand All @@ -233,6 +237,7 @@ public Boolean getUserDisableHistory()
*/
public void setDebugLevel(int level)
{
if (userPrefs == null) return;
userPrefs.node("General").putInt("debug", level);
this.flushPreferences();
}
Expand All @@ -242,6 +247,7 @@ public void setDebugLevel(int level)
*/
public void setUseQuaqua(boolean b)
{
if (userPrefs == null) return;
userPrefs.node("General").putBoolean("useQuaqua", b);
this.flushPreferences();
}
Expand Down Expand Up @@ -292,6 +298,7 @@ public String getServerPort()
*/
public void updateFlexReaderServerMaps()
{
if (userPrefs == null) return;
Preferences maps = userPrefs.node("FlexReaderServerMaps");
Map<String, List<String>> values = parseFlexMaps(maps);
for (Map.Entry<String, List<String>> entry : values.entrySet()) {
Expand Down Expand Up @@ -338,7 +345,7 @@ public Map<String, List<String>> parseFlexMaps(Preferences maps)
}

/**
* Append kep to server map
* Append keep to server map
*
* @param key
* @param mapValue
Expand Down Expand Up @@ -374,7 +381,7 @@ public Boolean isDebugUI() {
public Rectangle getUIBounds()
{
Rectangle rect = new Rectangle();

if (userPrefs == null) return rect;
rect.width = userPrefs.node("UI").getInt("width", 980);
rect.height = userPrefs.node("UI").getInt("height", 580);
rect.x = userPrefs.node("UI").getInt("xOffset", 10);
Expand All @@ -400,6 +407,7 @@ public void setUIBounds(Rectangle bounds)
if (bounds.height < 100)
bounds.height = 100;

if (userPrefs == null) return;
userPrefs.node("UI").putInt("width", bounds.width);
userPrefs.node("UI").putInt("height", bounds.height);
userPrefs.node("UI").putInt("xOffset", bounds.x);
Expand All @@ -408,32 +416,38 @@ public void setUIBounds(Rectangle bounds)

public boolean getUserFullPath()
{
return userPrefs.node("UI").getBoolean("userFullPath", true);
if (userPrefs == null) return true;
return userPrefs.node("UI").getBoolean("userFullPath", true);
}

public void setUserFullPath(boolean b)
{
userPrefs.node("UI").putBoolean("userFullPath", b);
if (userPrefs != null)
userPrefs.node("UI").putBoolean("userFullPath", b);
}

public boolean getCustomImageNaming()
{
return userPrefs.node("UI").getBoolean("customImageNaming", true);
if (userPrefs == null) return true;
return userPrefs.node("UI").getBoolean("customImageNaming", true);
}

public void setCustomImageNaming(boolean b)
{
userPrefs.node("UI").putBoolean("customImageNaming", b);
if (userPrefs != null)
userPrefs.node("UI").putBoolean("customImageNaming", b);
}

public int getNumOfDirectories()
{
return userPrefs.node("UI").getInt("numOfDirectories", 0);
if (userPrefs == null) return 0;
return userPrefs.node("UI").getInt("numOfDirectories", 0);
}

public void setNumOfDirectories(int i)
{
userPrefs.node("UI").putInt("numOfDirectories", i);
if (userPrefs == null) return;
userPrefs.node("UI").putInt("numOfDirectories", i);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,7 @@ public byte[] getPlane(long pixelsId, int z, int c, int t, Ice.Current current)
}

@Override
protected void preClose() {
try {
close();
} catch (Exception e) {
log.error("Error on OmeroGateway.close()", e);
}
protected void preClose(Ice.Current current) throws Throwable {
close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public final void close_async(AMD_StatefulServiceInterface_close __cb,

// First we call close on the object
try {
preClose();
preClose(__current);
if (service instanceof StatefulServiceInterface) {
StatefulServiceInterface ss = (StatefulServiceInterface) service;
ss.close();
Expand Down Expand Up @@ -258,8 +258,8 @@ public final void close_async(AMD_StatefulServiceInterface_close __cb,

}

protected void preClose() {

protected void preClose(Ice.Current current) throws Throwable {
log.debug("No pre-close define");
}

}
60 changes: 38 additions & 22 deletions components/blitz/src/ome/services/blitz/impl/DeleteHandleI.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,23 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;

import org.apache.commons.io.filefilter.WildcardFileFilter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.exception.ConstraintViolationException;
import org.perf4j.StopWatch;
import org.perf4j.commonslog.CommonsLogStopWatch;
import org.springframework.context.ApplicationContext;
import org.springframework.transaction.annotation.Transactional;

import Ice.Current;

import ome.conditions.InternalException;
import ome.io.bioformats.BfPyramidPixelBuffer;
import ome.io.nio.AbstractFileSystemService;
Expand All @@ -30,24 +43,12 @@
import ome.system.Principal;
import ome.system.ServiceFactory;
import ome.util.SqlAction;

import omero.LockTimeout;
import omero.ServerError;
import omero.api.delete.DeleteCommand;
import omero.api.delete.DeleteReport;
import omero.api.delete._DeleteHandleDisp;
import omero.util.CloseableServant;

import org.apache.commons.io.filefilter.WildcardFileFilter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.exception.ConstraintViolationException;
import org.perf4j.StopWatch;
import org.perf4j.commonslog.CommonsLogStopWatch;
import org.springframework.context.ApplicationContext;
import org.springframework.transaction.annotation.Transactional;

import Ice.Current;
import omero.api.delete._DeleteHandleOperations;

/**
* Servant for the handle proxy from the IDelete service. This is also a
Expand All @@ -70,8 +71,8 @@
* @since 4.2.1
* @see ome.api.IDelete
*/
public class DeleteHandleI extends _DeleteHandleDisp implements
CloseableServant, Runnable {
public class DeleteHandleI extends AbstractAmdServant implements
_DeleteHandleOperations, Runnable {

private static enum State {
CREATED, READY, RUNNING, CANCELLING, CANCELLED, FINISHED;
Expand Down Expand Up @@ -138,20 +139,34 @@ private static class Report extends DeleteReport {

private final ServiceFactoryI sf;

private final Map<String, String> callContext;

/**
* Call the main constructor with a null call context.
*/
public DeleteHandleI(final ApplicationContext ctx, final Ice.Identity id, final ServiceFactoryI sf,
final AbstractFileSystemService afs, final DeleteCommand[] commands, int cancelTimeoutMs) {
this(ctx, id, sf, afs, commands, cancelTimeoutMs, null);
}

/**
* Create and
* Main constructor.
*
* @param id
* @param sf
* @param factory
* @param commands
* @param cancelTimeoutMs
* @param callContext
*/
public DeleteHandleI(final ApplicationContext ctx, final Ice.Identity id, final ServiceFactoryI sf,
final AbstractFileSystemService afs, final DeleteCommand[] commands, int cancelTimeoutMs) {
final AbstractFileSystemService afs, final DeleteCommand[] commands, int cancelTimeoutMs,
Map<String, String> callContext) {
super(null, null);
this.id = id;
this.sf = sf;
this.afs = afs;
this.callContext = callContext;
this.principal = sf.getPrincipal();
this.executor = sf.getExecutor();
this.cancelTimeoutMs = cancelTimeoutMs;
Expand Down Expand Up @@ -297,8 +312,8 @@ public boolean cancel(Current __current) throws ServerError {
// CloseableServant. See documentation in interface.
//

public void close(Ice.Current current) throws ServerError {
sf.unregisterServant(id);
@Override
protected void preClose(Ice.Current current) throws ServerError {
if (!finished(current)) {
log.warn("Handle closed before finished! State=" + state.get());
}
Expand All @@ -322,8 +337,9 @@ public void run() {

StopWatch sw = new CommonsLogStopWatch();
try {
executor.execute(principal, new Executor.SimpleWork(this, "run",
Ice.Util.identityToString(id), "size=" + commands.length) {
executor.execute(callContext, principal,
new Executor.SimpleWork(this, "run",
Ice.Util.identityToString(id), "size=" + commands.length) {
@Transactional(readOnly = false)
public Object doWork(Session session, ServiceFactory sf) {
try {
Expand Down
Loading

0 comments on commit 17a7f0f

Please sign in to comment.