AnsweredAssumed Answered

custom connector implementation getting error: getConnection().getMetadata(null); in BaseConnection class getMeadata() method not found

Question asked by ontela.chenchaiah598653 on Jan 24, 2017

custom connector implementation getting error: getConnection().getMetadata(null); in BaseConnection class getMeadata() method not found

 

 

I have taken the below code from custom connector sample. while building in eclipse getting build errors.

 

could you tell us how to solve this problem.

 

 

package DemoConnector;

import java.util.Collection;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;


import com.boomi.connector.api.ConnectorException;
import com.boomi.connector.api.ObjectDefinition;
import com.boomi.connector.api.ObjectDefinitionRole;
import com.boomi.connector.api.ObjectDefinitions;
import com.boomi.connector.api.ObjectType;
import com.boomi.connector.api.ObjectTypes;
import com.boomi.connector.util.BaseBrowser;

/**
* Demo browser implementation.
*
* @author James Ahlborn
* @author Jeff Plater
*/
public class DemoConnectorBrowser extends BaseBrowser {

private static final String TYPE_ELEMENT = "type";

public DemoConnectorBrowser(DemoConnectorConnection conn) {
super(conn);
}

@Override
public ObjectTypes getObjectTypes() {
try {
// parse the returned XML data and generate the ObjectTypes
// collection
Document typeDoc = getConnection().getMetadata(null);

NodeList typeList = typeDoc.getElementsByTagName(TYPE_ELEMENT);
ObjectTypes types = new ObjectTypes();
for (int i = 0; i < typeList.getLength(); ++i) {
Element typeEl = (Element) typeList.item(i);
String typeName = typeEl.getTextContent().trim();
ObjectType type = new ObjectType();
type.setId(typeName);
types.getTypes().add(type);
}

return types;

}
catch (Exception e) {
throw new ConnectorException(e);
}
}

@Override
public ObjectDefinitions getObjectDefinitions(String objectTypeId, Collection<ObjectDefinitionRole> roles) {
try {
// parse the returned XML Schema document and construct an
// ObjectDefinition
Document defDoc = getConnection().getMetadata(objectTypeId);
ObjectDefinitions defs = new ObjectDefinitions();
ObjectDefinition def = new ObjectDefinition();
def.setSchema(defDoc.getDocumentElement());
def.setElementName(objectTypeId);
defs.getDefinitions().add(def);

return defs;

}
catch (Exception e) {
throw new ConnectorException(e);
}
}

@Override
public DemoConnectorConnection getConnection() {
return (DemoConnectorConnection) super.getConnection();
}

}

Outcomes