Results 1 to 2 of 2

Thread: spring-surf-application-test

  1. #1
    Join Date
    Mar 2010
    Posts
    20

    Default spring-surf-application-test

    I am playing with the "spring-surf-application-test" example from the trunk, against an Alfresco 3.2r2 repository.

    This is the config:

    Code:
    <config evaluator="string-compare" condition="Remote">
          <remote>
    
             <!-- Test Endpoint -->
    	     <endpoint>
    	        <id>alfresco-test</id>
    	        <name>Alfresco - test access</name>
    	        <description>Test account access to Alfresco</description>
    	        <connector-id>alfresco</connector-id>
    	        <endpoint-url>http://localhost:8080/alfresco/service</endpoint-url>
    	        <identity>declared</identity>
    	        <username>admin</username>
    	        <password>admin</password>
    	        <unsecure>true</unsecure>
    	     </endpoint>
    	
    	  </remote>
        </config>

    This is how the connector is then used in the webscripts:

    Code:
    var connector = remote.connect("alfresco");
    ...but this doesn't work.

    If I change the webscript to this:

    Code:
    var connector = remote.connect("alfresco-test");
    ...then it is OK.

    Typo?

    Anyways, what is the difference between the "id" and the "connector-id" property, and in what case either of them should be used?
    Last edited by psvent; Mar 25th, 2010 at 01:51 AM.

  2. #2
    Join Date
    Jul 2009
    Posts
    21

    Default

    Good questions. In the case you've cited, the endpoint ID is "alfresco-test". That's what you have to pass in to the remote.connect() method since this method expects an endpoint ID. The method is basically saying "make a connection for me to this endpoint".

    The idea of an endpoint is that it is something to which you can connect and communicate. The protocol for the connection, the authentication handshaking and the session with the endpoint are all handled for you behind the scenes. In fact, that's what the configuration for the endpoint describes. It describes what kind of connector use and, in turn, what kind of authenticator to use.

    The endpoint configuration you've provided indicates that the endpoint is communciated with using an "alfresco" connector. It so happens that the Alfresco connector is an authenticating connector that knows how to speak to Alfresco. When Alfresco challenges the connector for authentication, the connector knows how to do an authentication handshake with the Alfresco server's login web script and receive back a ticket. It knows how to store this ticket on the connector session and reuse it on subsequent connections.

    These abstractions exist so as to support the code that you've indicated. You can write a bit of code, for example, that talks to a CMIS REST endpoint (perhaps an Alfresco server). Your code might do a query and display the results in a nice user interface. By having the connection details solved for you, your code now becomes portable. You can use it against multiple CMIS repositories and even against multiple types of environments (development, test, QA, live) during your web site's lifecycle.

    Hopefully that makes some sense. It might be a bit abstract. In the end, the idea is that your code interacts with endpoint IDs. The endpoints and their connection properties are configured in Spring once and the reused.

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •