mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Enhancements to FSR.
1) Performance imporvements (client and server are now multi-threaded + other performance work) 2) Pluggable transport protocols (ENH-145) 3) Changes to initialisation (ALFCOM-135) 4) Changes to the action service to enable multiple async event queues. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11022 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
package org.alfresco.repo.deploy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.deployment.DeploymentTransportOutputFilter;
|
||||
|
||||
/**
|
||||
* Abstract Transport Adapter.
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractDeploymentReceiverTransportAdapter {
|
||||
|
||||
List<DeploymentTransportOutputFilter> transformers;
|
||||
|
||||
/**
|
||||
* Get the content transformers for this transport - if the transport does not support
|
||||
* content transformation then simply return null;
|
||||
* @return the content transformers or null if there are no transformers.
|
||||
*/
|
||||
public List<DeploymentTransportOutputFilter>getTransformers() {
|
||||
return transformers;
|
||||
}
|
||||
/**
|
||||
* Set the content transformers for this transport - if the transport does not support
|
||||
* content transformation then simply set null or do not call this method.
|
||||
*/
|
||||
public void setTransformers( List<DeploymentTransportOutputFilter> transformers) {
|
||||
this.transformers = transformers;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.deploy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.alfresco.deployment.DeploymentReceiverTransport;
|
||||
|
||||
/**
|
||||
* OutputStream used by client side to talk to
|
||||
* the deployment receiver.
|
||||
* @author britt
|
||||
*/
|
||||
public class DeploymentClientOutputStream extends OutputStream
|
||||
{
|
||||
private DeploymentReceiverTransport fTransport;
|
||||
|
||||
private String fTicket;
|
||||
|
||||
private String fOutputToken;
|
||||
|
||||
/**
|
||||
* Make one up.
|
||||
* @param transport
|
||||
* @param ticket
|
||||
* @param outputToken
|
||||
*/
|
||||
public DeploymentClientOutputStream(DeploymentReceiverTransport transport,
|
||||
String ticket,
|
||||
String outputToken)
|
||||
{
|
||||
fTransport = transport;
|
||||
fTicket = ticket;
|
||||
fOutputToken = outputToken;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.OutputStream#write(int)
|
||||
*/
|
||||
@Override
|
||||
public void write(int b) throws IOException
|
||||
{
|
||||
byte[] buff = new byte[1];
|
||||
buff[0] = (byte)b;
|
||||
write(buff);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.OutputStream#close()
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
// NO OP
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.OutputStream#flush()
|
||||
*/
|
||||
@Override
|
||||
public void flush() throws IOException
|
||||
{
|
||||
// NO OP
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.OutputStream#write(byte[], int, int)
|
||||
*/
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException
|
||||
{
|
||||
fTransport.write(fTicket, fOutputToken, b, off, len);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.OutputStream#write(byte[])
|
||||
*/
|
||||
@Override
|
||||
public void write(byte[] b) throws IOException
|
||||
{
|
||||
write(b, 0, b.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the deployment ticket.
|
||||
* @return
|
||||
*/
|
||||
public String getTicket()
|
||||
{
|
||||
return fTicket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the output token.
|
||||
* @return
|
||||
*/
|
||||
public String getOutputToken()
|
||||
{
|
||||
return fOutputToken;
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.deploy;
|
||||
|
||||
/**
|
||||
* Class to hold Deployment destination information.
|
||||
* Used as a lock to serialize deployments to the same
|
||||
* destination.
|
||||
* @author britt
|
||||
*/
|
||||
public class DeploymentDestination
|
||||
{
|
||||
private String fHost;
|
||||
|
||||
private int fPort;
|
||||
|
||||
DeploymentDestination(String host, int port)
|
||||
{
|
||||
fHost = host;
|
||||
fPort = port;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof DeploymentDestination))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
DeploymentDestination other = (DeploymentDestination)obj;
|
||||
return fHost.equals(other.fHost) && fPort == other.fPort;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return fHost.hashCode() + fPort;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return fHost;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.deploy;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.deployment.DeploymentReceiverService;
|
||||
import org.alfresco.deployment.DeploymentReceiverTransport;
|
||||
import org.alfresco.deployment.FileDescriptor;
|
||||
|
||||
/**
|
||||
* Client side implementation of DeploymentReceiverService which decorates a
|
||||
* DeploymentReceiverTransport instance.
|
||||
*
|
||||
* This class adds code to the send and finishSend methods.
|
||||
*
|
||||
* @author britt
|
||||
*/
|
||||
public class DeploymentReceiverServiceClient implements
|
||||
DeploymentReceiverService
|
||||
{
|
||||
/**
|
||||
* The underlying transport.
|
||||
*/
|
||||
private DeploymentReceiverTransport fTransport;
|
||||
|
||||
public DeploymentReceiverServiceClient()
|
||||
{
|
||||
}
|
||||
|
||||
public void setDeploymentReceiverTransport(DeploymentReceiverTransport transport)
|
||||
{
|
||||
fTransport = transport;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.deployment.DeploymentReceiverService#abort(java.lang.String)
|
||||
*/
|
||||
public void abort(String ticket)
|
||||
{
|
||||
fTransport.abort(ticket);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.deployment.DeploymentReceiverService#begin(java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public String begin(String target, String user, String password)
|
||||
{
|
||||
return fTransport.begin(target, user, password);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.deployment.DeploymentReceiverService#commit(java.lang.String)
|
||||
*/
|
||||
public void commit(String ticket)
|
||||
{
|
||||
fTransport.commit(ticket);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.deployment.DeploymentReceiverService#delete(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void delete(String ticket, String path)
|
||||
{
|
||||
fTransport.delete(ticket, path);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.deployment.DeploymentReceiverService#finishSend(java.lang.String, java.io.OutputStream)
|
||||
*/
|
||||
public void finishSend(String ticket, OutputStream out)
|
||||
{
|
||||
DeploymentClientOutputStream dcOut = (DeploymentClientOutputStream)out;
|
||||
fTransport.finishSend(dcOut.getTicket(), dcOut.getOutputToken());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.deployment.DeploymentReceiverService#getListing(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public List<FileDescriptor> getListing(String ticket, String path)
|
||||
{
|
||||
return fTransport.getListing(ticket, path);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.deployment.DeploymentReceiverService#mkdir(java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void mkdir(String ticket, String path, String guid)
|
||||
{
|
||||
fTransport.mkdir(ticket, path, guid);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.deployment.DeploymentReceiverService#send(java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public OutputStream send(String ticket, String path, String guid)
|
||||
{
|
||||
String outputToken = fTransport.getSendToken(ticket, path, guid);
|
||||
return new DeploymentClientOutputStream(fTransport, ticket, outputToken);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.deployment.DeploymentReceiverService#shutDown(java.lang.String, java.lang.String)
|
||||
*/
|
||||
public void shutDown(String user, String password)
|
||||
{
|
||||
fTransport.shutDown(user, password);
|
||||
}
|
||||
|
||||
public void setGuid(String ticket, String path, String guid)
|
||||
{
|
||||
fTransport.setGuid(ticket, path, guid);
|
||||
}
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
package org.alfresco.repo.deploy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.deployment.DeploymentReceiverTransport;
|
||||
import org.alfresco.deployment.DeploymentTransportOutputFilter;
|
||||
/**
|
||||
*
|
||||
* DeploymentReceiverTransportAdapter are used to adapt the interface used by the FSR Client to the
|
||||
* interface used by the underlying transport implementation.
|
||||
*
|
||||
* The DeploymentReceiverTransport objects returned will typically be proxy classes to a remote service.
|
||||
*
|
||||
* @see org.alfresco.deployment.impl.client.DeploymentReceiverTransportAdapterRMI
|
||||
* @see org.alfresco.deployment.impl.client.DeploymentReceiverTransportAdapterSpringHTTP
|
||||
* @see org.alfresco.deployment.impl.client.DeploymentReceiverTransportAdapterHessian
|
||||
*
|
||||
* @author mrogers
|
||||
*
|
||||
*/
|
||||
public interface DeploymentReceiverTransportAdapter
|
||||
{
|
||||
|
||||
/**
|
||||
* getObject is a factory method to get a DeploymentReceiverTransport object, which will typically
|
||||
* be a proxy to a remote service.
|
||||
*
|
||||
* It is up to the adapters themselves to decide whether hostName, port or URL takes precedence.
|
||||
*
|
||||
* @param adapterName the name of this adapter
|
||||
* @param hostName the name of the host to connect to
|
||||
* @param port the port to connect to
|
||||
* @param version the version of the website
|
||||
* @param the path of the website to be deployed
|
||||
* @return a DeploymentRecieverTransport
|
||||
*/
|
||||
public DeploymentReceiverTransport getTransport(String hostName, int port, int version, String srcPath);
|
||||
|
||||
/**
|
||||
* Get the content transformers for this transport - if the transport does not support
|
||||
* content transformation then simply return null;
|
||||
* @return the content transformers or null if there are no transformers.
|
||||
*/
|
||||
public List<DeploymentTransportOutputFilter>getTransformers();
|
||||
}
|
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
package org.alfresco.repo.deploy;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import org.alfresco.deployment.DeploymentReceiverTransport;
|
||||
import org.springframework.remoting.caucho.HessianProxyFactoryBean;
|
||||
|
||||
/**
|
||||
* This class adapts the Hessian protocol to DeploymentReceiverTransport
|
||||
*
|
||||
* @author mrogers
|
||||
*/
|
||||
public class DeploymentReceiverTransportAdapterHessian extends AbstractDeploymentReceiverTransportAdapter implements DeploymentReceiverTransportAdapter
|
||||
{
|
||||
/**
|
||||
* The pattern to use when constructing the URL from hostname and port
|
||||
*
|
||||
* eg http://localhost:8080/FSR/deployment
|
||||
*/
|
||||
private String urlPattern = "http://{1}:{2}/FSR/deployment";
|
||||
|
||||
public DeploymentReceiverTransport getTransport(String host,
|
||||
int port, int version, String srcPath)
|
||||
{
|
||||
MessageFormat f = new MessageFormat(urlPattern);
|
||||
Object[] objs = { host, port };
|
||||
String URL = f.format(objs);
|
||||
|
||||
// Code to use Hessian transport provided via Spring
|
||||
HessianProxyFactoryBean factory = new HessianProxyFactoryBean();
|
||||
factory.setServiceInterface(DeploymentReceiverTransport.class);
|
||||
factory.setServiceUrl(URL);
|
||||
factory.afterPropertiesSet();
|
||||
DeploymentReceiverTransport transport = (DeploymentReceiverTransport) factory.getObject();
|
||||
|
||||
return transport;
|
||||
|
||||
}
|
||||
|
||||
public void setUrlPattern(String urlPattern) {
|
||||
this.urlPattern = urlPattern;
|
||||
}
|
||||
|
||||
public String getUrlPattern() {
|
||||
return urlPattern;
|
||||
}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
package org.alfresco.repo.deploy;
|
||||
|
||||
import org.alfresco.deployment.DeploymentReceiverTransport;
|
||||
import org.springframework.remoting.rmi.RmiProxyFactoryBean;
|
||||
|
||||
/**
|
||||
* Transport adapter to connect to the FSR using RMI protocol.
|
||||
*
|
||||
* @author mrogers
|
||||
*
|
||||
*/
|
||||
public class DeploymentReceiverTransportAdapterRMI extends AbstractDeploymentReceiverTransportAdapter implements DeploymentReceiverTransportAdapter {
|
||||
|
||||
public DeploymentReceiverTransport getTransport(String hostName,
|
||||
int port, int version, String srcPath)
|
||||
{
|
||||
|
||||
// Code to use RMI transport
|
||||
RmiProxyFactoryBean factory = new RmiProxyFactoryBean();
|
||||
factory.setRefreshStubOnConnectFailure(true);
|
||||
factory.setServiceInterface(DeploymentReceiverTransport.class);
|
||||
factory.setServiceUrl("rmi://" + hostName + ":" + port + "/deployment");
|
||||
factory.afterPropertiesSet();
|
||||
DeploymentReceiverTransport transport = (DeploymentReceiverTransport)factory.getObject();
|
||||
|
||||
return transport;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing
|
||||
*/
|
||||
package org.alfresco.repo.deploy;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import org.alfresco.deployment.DeploymentReceiverTransport;
|
||||
import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
|
||||
|
||||
/**
|
||||
* Transport adapter to connect to the FSR using Spring over HTTP protocol.
|
||||
*
|
||||
* @author mrogers
|
||||
*
|
||||
*/
|
||||
public class DeploymentReceiverTransportAdapterSpringHTTP extends AbstractDeploymentReceiverTransportAdapter implements DeploymentReceiverTransportAdapter {
|
||||
/**
|
||||
* The pattern to use when constructing the URL from hostname and port
|
||||
* {1} substitues for hostname {2} substitues for port
|
||||
* Default format results in the following URL http://localhost:8080/alfrescoFSR/deployment
|
||||
*/
|
||||
private String urlPattern = "http://{1}:{2}/alfrescoFSR/deployment";
|
||||
|
||||
public DeploymentReceiverTransport getTransport(String host,
|
||||
int port, int version, String srcPath)
|
||||
{
|
||||
|
||||
MessageFormat f = new MessageFormat(getUrlPattern());
|
||||
Object[] objs = { host, port };
|
||||
String URL = f.format(objs);
|
||||
|
||||
// Code to use HTTP spring transport
|
||||
HttpInvokerProxyFactoryBean factory = new HttpInvokerProxyFactoryBean();
|
||||
factory.setServiceInterface(DeploymentReceiverTransport.class);
|
||||
factory.setServiceUrl(URL);
|
||||
factory.afterPropertiesSet();
|
||||
DeploymentReceiverTransport transport = (DeploymentReceiverTransport) factory.getObject();
|
||||
|
||||
return transport;
|
||||
}
|
||||
|
||||
public void setUrlPattern(String urlPattern) {
|
||||
this.urlPattern = urlPattern;
|
||||
}
|
||||
|
||||
public String getUrlPattern() {
|
||||
return urlPattern;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
68
source/java/org/alfresco/repo/deploy/DeploymentWork.java
Normal file
68
source/java/org/alfresco/repo/deploy/DeploymentWork.java
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.deploy;
|
||||
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.avm.deploy.DeploymentEvent;
|
||||
|
||||
class DeploymentWork
|
||||
{
|
||||
private DeploymentEvent event;
|
||||
private AVMNodeDescriptor src;
|
||||
private String ticket;
|
||||
|
||||
public DeploymentWork(DeploymentEvent event, String ticket)
|
||||
{
|
||||
this.event = event;
|
||||
this.ticket = ticket;
|
||||
}
|
||||
|
||||
public DeploymentWork(DeploymentEvent event, String ticket, AVMNodeDescriptor src)
|
||||
{
|
||||
this.event = event;
|
||||
this.ticket = ticket;
|
||||
this.setSrc(src);
|
||||
|
||||
}
|
||||
|
||||
public DeploymentEvent getEvent()
|
||||
{
|
||||
return event;
|
||||
}
|
||||
|
||||
public String getTicket()
|
||||
{
|
||||
return this.ticket;
|
||||
}
|
||||
|
||||
public void setSrc(AVMNodeDescriptor src) {
|
||||
this.src = src;
|
||||
}
|
||||
|
||||
public AVMNodeDescriptor getSrc() {
|
||||
return src;
|
||||
}
|
||||
|
||||
}
|
@@ -26,11 +26,15 @@
|
||||
package org.alfresco.repo.deploy;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.avm.AVMServiceTestBase;
|
||||
import org.alfresco.repo.avm.util.BulkLoader;
|
||||
import org.alfresco.service.cmr.avm.deploy.DeploymentCallback;
|
||||
import org.alfresco.service.cmr.avm.deploy.DeploymentEvent;
|
||||
import org.alfresco.service.cmr.avm.deploy.DeploymentReport;
|
||||
import org.alfresco.service.cmr.avm.deploy.DeploymentReportCallback;
|
||||
import org.alfresco.service.cmr.avm.deploy.DeploymentService;
|
||||
import org.alfresco.util.Deleter;
|
||||
import org.alfresco.util.NameMatcher;
|
||||
@@ -62,7 +66,11 @@ public class FSDeploymentTest extends AVMServiceTestBase
|
||||
NameMatcher matcher = (NameMatcher)fContext.getBean("globalPathExcluder");
|
||||
setupBasicTree();
|
||||
fService.createFile("main:/a/b", "fudge.bak").close();
|
||||
DeploymentReport report = service.deployDifferenceFS(-1, "main:/", "localhost", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, null);
|
||||
DeploymentReport report = new DeploymentReport();
|
||||
List<DeploymentCallback> callbacks = new ArrayList<DeploymentCallback>();
|
||||
callbacks.add(new DeploymentReportCallback(report));
|
||||
|
||||
service.deployDifferenceFS(-1, "main:/", "localhost", "default", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, callbacks);
|
||||
int count = 0;
|
||||
for (DeploymentEvent event : report)
|
||||
{
|
||||
@@ -70,7 +78,14 @@ public class FSDeploymentTest extends AVMServiceTestBase
|
||||
count++;
|
||||
}
|
||||
assertEquals(10, count);
|
||||
report = service.deployDifferenceFS(-1, "main:/", "localhost", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, null);
|
||||
|
||||
report = new DeploymentReport();
|
||||
callbacks = new ArrayList<DeploymentCallback>();
|
||||
callbacks.add(new DeploymentReportCallback(report));
|
||||
|
||||
callbacks.add(new DeploymentReportCallback(report));
|
||||
|
||||
service.deployDifferenceFS(-1, "main:/", "localhost", "default", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, callbacks);
|
||||
count = 0;
|
||||
for (DeploymentEvent event : report)
|
||||
{
|
||||
@@ -80,7 +95,13 @@ public class FSDeploymentTest extends AVMServiceTestBase
|
||||
assertEquals(2, count);
|
||||
fService.createFile("main:/d", "jonathan").close();
|
||||
fService.removeNode("main:/a/b");
|
||||
report = service.deployDifferenceFS(-1, "main:/", "localhost", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, null);
|
||||
|
||||
report = new DeploymentReport();
|
||||
callbacks = new ArrayList<DeploymentCallback>();
|
||||
callbacks.add(new DeploymentReportCallback(report));
|
||||
|
||||
|
||||
service.deployDifferenceFS(-1, "main:/", "localhost", "default", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, callbacks);
|
||||
count = 0;
|
||||
for (DeploymentEvent event : report)
|
||||
{
|
||||
@@ -90,7 +111,12 @@ public class FSDeploymentTest extends AVMServiceTestBase
|
||||
assertEquals(4, count);
|
||||
fService.removeNode("main:/d/e");
|
||||
fService.createFile("main:/d", "e").close();
|
||||
report = service.deployDifferenceFS(-1, "main:/", "localhost", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, null);
|
||||
|
||||
report = new DeploymentReport();
|
||||
callbacks = new ArrayList<DeploymentCallback>();
|
||||
callbacks.add(new DeploymentReportCallback(report));
|
||||
|
||||
service.deployDifferenceFS(-1, "main:/", "localhost", "default", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, callbacks);
|
||||
count = 0;
|
||||
for (DeploymentEvent event : report)
|
||||
{
|
||||
@@ -102,7 +128,11 @@ public class FSDeploymentTest extends AVMServiceTestBase
|
||||
fService.createDirectory("main:/d", "e");
|
||||
fService.createFile("main:/d/e", "Warren.txt").close();
|
||||
fService.createFile("main:/d/e", "It's a silly name.txt").close();
|
||||
report = service.deployDifferenceFS(-1, "main:/", "localhost", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, null);
|
||||
report = new DeploymentReport();
|
||||
callbacks = new ArrayList<DeploymentCallback>();
|
||||
callbacks.add(new DeploymentReportCallback(report));
|
||||
|
||||
service.deployDifferenceFS(-1, "main:/", "localhost", "default", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, callbacks);
|
||||
count = 0;
|
||||
for (DeploymentEvent event : report)
|
||||
{
|
||||
@@ -113,10 +143,18 @@ public class FSDeploymentTest extends AVMServiceTestBase
|
||||
BulkLoader loader = new BulkLoader();
|
||||
loader.setAvmService(fService);
|
||||
loader.recursiveLoad("source/java/org/alfresco/repo/avm", "main:/");
|
||||
report = service.deployDifferenceFS(-1, "main:/", "localhost", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, null);
|
||||
report = new DeploymentReport();
|
||||
callbacks = new ArrayList<DeploymentCallback>();
|
||||
callbacks.add(new DeploymentReportCallback(report));
|
||||
|
||||
service.deployDifferenceFS(-1, "main:/", "localhost", "default", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, callbacks);
|
||||
fService.removeNode("main:/avm/hibernate");
|
||||
fService.getFileOutputStream("main:/avm/AVMServiceTest.java").close();
|
||||
report = service.deployDifferenceFS(-1, "main:/", "localhost", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, null);
|
||||
report = new DeploymentReport();
|
||||
callbacks = new ArrayList<DeploymentCallback>();
|
||||
callbacks.add(new DeploymentReportCallback(report));
|
||||
|
||||
service.deployDifferenceFS(-1, "main:/", "localhost", "default", 44100, "Giles", "Watcher", "sampleTarget", matcher, false, false, false, callbacks);
|
||||
count = 0;
|
||||
for (DeploymentEvent event : report)
|
||||
{
|
||||
|
Reference in New Issue
Block a user