|
Lines 17-24
Link Here
|
| 17 |
import java.util.Iterator; |
17 |
import java.util.Iterator; |
| 18 |
import java.util.List; |
18 |
import java.util.List; |
| 19 |
|
19 |
|
| 20 |
import javax.wsdl.Definition; |
|
|
| 21 |
|
| 22 |
import org.apache.ws.muse.descriptor.CapabilityType; |
20 |
import org.apache.ws.muse.descriptor.CapabilityType; |
| 23 |
import org.apache.ws.muse.descriptor.CustomSerializerType; |
21 |
import org.apache.ws.muse.descriptor.CustomSerializerType; |
| 24 |
import org.apache.ws.muse.descriptor.DescriptorFactory; |
22 |
import org.apache.ws.muse.descriptor.DescriptorFactory; |
|
Lines 54-67
Link Here
|
| 54 |
import org.eclipse.swt.widgets.Table; |
52 |
import org.eclipse.swt.widgets.Table; |
| 55 |
import org.eclipse.swt.widgets.TableItem; |
53 |
import org.eclipse.swt.widgets.TableItem; |
| 56 |
import org.eclipse.swt.widgets.Text; |
54 |
import org.eclipse.swt.widgets.Text; |
| 57 |
import org.eclipse.tptp.wsdm.tooling.codegen.mrt.internal.Generation; |
|
|
| 58 |
import org.eclipse.tptp.wsdm.tooling.editor.dde.internal.DescriptorEditor; |
55 |
import org.eclipse.tptp.wsdm.tooling.editor.dde.internal.DescriptorEditor; |
|
|
56 |
import org.eclipse.tptp.wsdm.tooling.editor.internal.CapabilityDefinition; |
| 59 |
import org.eclipse.tptp.wsdm.tooling.model.capabilities.Capability; |
57 |
import org.eclipse.tptp.wsdm.tooling.model.capabilities.Capability; |
| 60 |
import org.eclipse.tptp.wsdm.tooling.model.capabilities.Property; |
58 |
import org.eclipse.tptp.wsdm.tooling.model.capabilities.Property; |
| 61 |
import org.eclipse.tptp.wsdm.tooling.model.manageableResourceType.ManageableResourceType; |
59 |
import org.eclipse.tptp.wsdm.tooling.model.manageableResourceType.ManageableResourceType; |
| 62 |
import org.eclipse.tptp.wsdm.tooling.nls.messages.dde.internal.Messages; |
60 |
import org.eclipse.tptp.wsdm.tooling.nls.messages.dde.internal.Messages; |
|
|
61 |
import org.eclipse.tptp.wsdm.tooling.util.internal.EclipseUtils; |
| 63 |
import org.eclipse.tptp.wsdm.tooling.util.internal.MrtUtils; |
62 |
import org.eclipse.tptp.wsdm.tooling.util.internal.MrtUtils; |
| 64 |
import org.eclipse.tptp.wsdm.tooling.util.internal.MyDescriptorResourceFactoryImpl; |
63 |
import org.eclipse.tptp.wsdm.tooling.util.internal.MyDescriptorResourceFactoryImpl; |
|
|
64 |
import org.eclipse.tptp.wsdm.tooling.util.internal.WsdlUtils; |
| 65 |
import org.eclipse.tptp.wsdm.tooling.util.internal.WsdmToolingLog; |
65 |
import org.eclipse.tptp.wsdm.tooling.util.internal.WsdmToolingLog; |
| 66 |
import org.eclipse.ui.IWorkbench; |
66 |
import org.eclipse.ui.IWorkbench; |
| 67 |
import org.eclipse.ui.IWorkbenchPage; |
67 |
import org.eclipse.ui.IWorkbenchPage; |
|
Lines 74-80
Link Here
|
| 74 |
|
74 |
|
| 75 |
/** |
75 |
/** |
| 76 |
* This utility class contains some helper methods for DescriptorEditor. |
76 |
* This utility class contains some helper methods for DescriptorEditor. |
| 77 |
* |
77 |
* |
| 78 |
*/ |
78 |
*/ |
| 79 |
public class DdeUtil |
79 |
public class DdeUtil |
| 80 |
{ |
80 |
{ |
|
Lines 95-103
Link Here
|
| 95 |
IWorkbenchPage page = workbenchWindow.getActivePage(); |
95 |
IWorkbenchPage page = workbenchWindow.getActivePage(); |
| 96 |
if (file.getFullPath().toString().startsWith("/plugin/")) //$NON-NLS-1$ |
96 |
if (file.getFullPath().toString().startsWith("/plugin/")) //$NON-NLS-1$ |
| 97 |
{ |
97 |
{ |
| 98 |
MessageDialog.openInformation(page.getActiveEditor() |
98 |
MessageDialog |
| 99 |
.getEditorSite().getShell(), Messages.COMMON_ERROR_TITLE, //$NON-NLS-1$ |
99 |
.openInformation( |
| 100 |
Messages.DU_ERROR_MSG1); //$NON-NLS-1$ |
100 |
page.getActiveEditor().getEditorSite().getShell(), |
|
|
101 |
Messages.COMMON_ERROR_TITLE, //$NON-NLS-1$ |
| 102 |
Messages.DU_ERROR_MSG1); //$NON-NLS-1$ |
| 101 |
return; |
103 |
return; |
| 102 |
} |
104 |
} |
| 103 |
try |
105 |
try |
|
Lines 105-116
Link Here
|
| 105 |
page.openEditor(new FileEditorInput(modelFile), workbench |
107 |
page.openEditor(new FileEditorInput(modelFile), workbench |
| 106 |
.getEditorRegistry().getDefaultEditor(modelFile.getName()) |
108 |
.getEditorRegistry().getDefaultEditor(modelFile.getName()) |
| 107 |
.getId()); |
109 |
.getId()); |
| 108 |
} |
110 |
} catch (Exception ex) |
| 109 |
catch (Exception ex) |
|
|
| 110 |
{ |
111 |
{ |
| 111 |
WsdmToolingLog.logError(NLS.bind( |
112 |
WsdmToolingLog.logError(NLS.bind(Messages.COULDNT_OPEN_DEFAULT_EDITOR_FOR_FILE_ERROR_, file.getName()),ex); |
| 112 |
Messages.COULDNT_OPEN_DEFAULT_EDITOR_FOR_FILE_ERROR_, file |
|
|
| 113 |
.getName()), ex); |
| 114 |
} |
113 |
} |
| 115 |
} |
114 |
} |
| 116 |
|
115 |
|
|
Lines 133-142
Link Here
|
| 133 |
* |
132 |
* |
| 134 |
* @return List object containing the resources in the workspace. |
133 |
* @return List object containing the resources in the workspace. |
| 135 |
*/ |
134 |
*/ |
| 136 |
public static List loadResources() // throws Exception |
135 |
public static List loadResources() //throws Exception |
| 137 |
{ |
136 |
{ |
| 138 |
List resourceList = new ArrayList(); |
137 |
List resourceList = new ArrayList(); |
| 139 |
|
138 |
|
| 140 |
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() |
139 |
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() |
| 141 |
.getProjects(); |
140 |
.getProjects(); |
| 142 |
if (projects != null && projects.length > 0) |
141 |
if (projects != null && projects.length > 0) |
|
Lines 148-159
Link Here
|
| 148 |
{ |
147 |
{ |
| 149 |
projectResources = projects[i].members(); |
148 |
projectResources = projects[i].members(); |
| 150 |
} |
149 |
} |
| 151 |
catch (CoreException ex) |
150 |
catch(CoreException ex) |
| 152 |
{ |
151 |
{ |
| 153 |
// WsdmToolingLog.logError(Messages.FAILED_TO_GET_MEMBERS_FOR_PROJECT_ERROR_ |
152 |
//WsdmToolingLog.logError(Messages.FAILED_TO_GET_MEMBERS_FOR_PROJECT_ERROR_ , ex); this line is commented out because if any project in the workspace is closed, this throws an error in the problems view. |
| 154 |
// , ex); this line is commented out because if any project |
|
|
| 155 |
// in the workspace is closed, this throws an error in the |
| 156 |
// problems view. |
| 157 |
continue; |
153 |
continue; |
| 158 |
} |
154 |
} |
| 159 |
if (projectResources == null || projectResources.length == 0) |
155 |
if (projectResources == null || projectResources.length == 0) |
|
Lines 162-168
Link Here
|
| 162 |
getFilesFromResource(projectResources[j], resourceList); |
158 |
getFilesFromResource(projectResources[j], resourceList); |
| 163 |
} |
159 |
} |
| 164 |
} |
160 |
} |
| 165 |
|
161 |
|
| 166 |
return resourceList; |
162 |
return resourceList; |
| 167 |
} |
163 |
} |
| 168 |
|
164 |
|
|
Lines 176-190
Link Here
|
| 176 |
* @throws Exception |
172 |
* @throws Exception |
| 177 |
*/ |
173 |
*/ |
| 178 |
public static void getFilesFromResource(IResource res, List resourceList) |
174 |
public static void getFilesFromResource(IResource res, List resourceList) |
| 179 |
// throws Exception |
175 |
//throws Exception |
| 180 |
{ |
176 |
{ |
| 181 |
try |
177 |
try |
| 182 |
{ |
178 |
{ |
| 183 |
if (res.getType() == IResource.FILE) |
179 |
if (res.getType() == IResource.FILE) |
| 184 |
{ |
180 |
{ |
| 185 |
resourceList.add(res); |
181 |
resourceList.add(res); |
| 186 |
} |
182 |
} else if (res.getType() == IResource.FOLDER) |
| 187 |
else if (res.getType() == IResource.FOLDER) |
|
|
| 188 |
{ |
183 |
{ |
| 189 |
IResource[] files = ((IFolder) res).members(); |
184 |
IResource[] files = ((IFolder) res).members(); |
| 190 |
if (files == null || files.length == 0) |
185 |
if (files == null || files.length == 0) |
|
Lines 195-205
Link Here
|
| 195 |
} |
190 |
} |
| 196 |
} |
191 |
} |
| 197 |
} |
192 |
} |
| 198 |
catch (CoreException ex) |
193 |
catch(CoreException ex) |
| 199 |
{ |
194 |
{ |
| 200 |
WsdmToolingLog.logError(NLS.bind( |
195 |
WsdmToolingLog.logError(NLS.bind(Messages.FAILED_TO_GET_MEMBERS_FOR_RESOURCE_ERROR_, res.getName()), ex); |
| 201 |
Messages.FAILED_TO_GET_MEMBERS_FOR_RESOURCE_ERROR_, res |
|
|
| 202 |
.getName()), ex); |
| 203 |
} |
196 |
} |
| 204 |
} |
197 |
} |
| 205 |
|
198 |
|
|
Lines 255-276
Link Here
|
| 255 |
.setJavaIdFactoryClass("org.apache.muse.core.routing.CounterResourceIdFactory"); //$NON-NLS-1$ |
248 |
.setJavaIdFactoryClass("org.apache.muse.core.routing.CounterResourceIdFactory"); //$NON-NLS-1$ |
| 256 |
rtd |
249 |
rtd |
| 257 |
.setJavaResourceClass("org.apache.muse.ws.resource.impl.SimpleWsResource"); //$NON-NLS-1$ |
250 |
.setJavaResourceClass("org.apache.muse.ws.resource.impl.SimpleWsResource"); //$NON-NLS-1$ |
| 258 |
|
251 |
|
| 259 |
// Fix for defect 60319 |
252 |
//Fix for defect 60319 |
| 260 |
rtd.setUseRouterPersistence(true); |
253 |
rtd.setUseRouterPersistence(true); |
| 261 |
|
254 |
|
| 262 |
rtd.getCapability().addAll(getCapabilitiesFromMRT(mrt)); |
255 |
rtd.getCapability().addAll(getCapabilitiesFromMRT(mrt)); |
| 263 |
WsdlType wsdlType = DescriptorFactory.eINSTANCE.createWsdlType(); |
256 |
WsdlType wsdlType = DescriptorFactory.eINSTANCE.createWsdlType(); |
| 264 |
wsdlType.setWsdlFile(wsdlName); |
257 |
wsdlType.setWsdlFile(wsdlName); |
| 265 |
|
258 |
|
| 266 |
String namespace = mrt.getNamespace(); |
259 |
String namespace = mrt.getNamespace(); |
| 267 |
String prefix = getOrCreatePrefix(root, namespace); |
260 |
String prefix = getOrCreatePrefix(root, namespace); |
| 268 |
String localPart = Messages.DU_PORT_TYPE_LOCAL_PART; // Only |
261 |
String localPart = Messages.DU_PORT_TYPE_LOCAL_PART; // Only "PortType" should come with the //$NON-NLS-1$ |
| 269 |
// "PortType" |
262 |
wsdlType.setWsdlPortType(prefix+":"+localPart); |
| 270 |
// should come |
|
|
| 271 |
// with the |
| 272 |
// //$NON-NLS-1$ |
| 273 |
wsdlType.setWsdlPortType(prefix + ":" + localPart); |
| 274 |
|
263 |
|
| 275 |
rtd.setWsdl(wsdlType); |
264 |
rtd.setWsdl(wsdlType); |
| 276 |
|
265 |
|
|
Lines 356-371
Link Here
|
| 356 |
*/ |
345 |
*/ |
| 357 |
public static MuseType loadDecriptorFile(IFile file) |
346 |
public static MuseType loadDecriptorFile(IFile file) |
| 358 |
{ |
347 |
{ |
| 359 |
URI uri = URI.createPlatformResourceURI(file.getFullPath().toString()); |
348 |
MuseType mt = loadMuseType(file); |
| 360 |
if (uri == null) |
|
|
| 361 |
return null; |
| 362 |
MuseType mt = loadMuseType(uri); |
| 363 |
return mt; |
349 |
return mt; |
| 364 |
} |
350 |
} |
| 365 |
|
351 |
|
| 366 |
// Return MuseType at URI. |
352 |
// Return MuseType at URI. |
| 367 |
private static MuseType loadMuseType(URI uri) |
353 |
private static MuseType loadMuseType(IFile file) |
|
|
354 |
{ |
| 355 |
DocumentRoot root = getDocRoot(file); |
| 356 |
RootType rt = root.getRoot(); |
| 357 |
return rt.getMuse(); |
| 358 |
} |
| 359 |
|
| 360 |
/** |
| 361 |
* This method takes a dd file and returns the document root of the file |
| 362 |
* @param file - IFile which is a dd file |
| 363 |
* @return DocumentRoot of the file. |
| 364 |
*/ |
| 365 |
public static DocumentRoot getDocRoot(IFile file) |
| 368 |
{ |
366 |
{ |
|
|
367 |
URI uri = URI.createPlatformResourceURI(file.getFullPath().toString()); |
| 368 |
if (uri == null) |
| 369 |
return null; |
| 369 |
ensureMusePackagePresent(); |
370 |
ensureMusePackagePresent(); |
| 370 |
ResourceSet resourceSet = new ResourceSetImpl(); |
371 |
ResourceSet resourceSet = new ResourceSetImpl(); |
| 371 |
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() |
372 |
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() |
|
Lines 375-392
Link Here
|
| 375 |
DescriptorPackage.eINSTANCE); |
376 |
DescriptorPackage.eINSTANCE); |
| 376 |
Resource resource = resourceSet.getResource(uri, true); |
377 |
Resource resource = resourceSet.getResource(uri, true); |
| 377 |
DocumentRoot root = (DocumentRoot) resource.getContents().get(0); |
378 |
DocumentRoot root = (DocumentRoot) resource.getContents().get(0); |
| 378 |
RootType rt = root.getRoot(); |
379 |
return root; |
| 379 |
return rt.getMuse(); |
|
|
| 380 |
} |
380 |
} |
| 381 |
|
381 |
|
| 382 |
private static void ensureMusePackagePresent() |
382 |
private static void ensureMusePackagePresent() |
| 383 |
{ |
383 |
{ |
| 384 |
// Ensure EMF knows about Muse descriptor |
384 |
// Ensure EMF knows about Muse descriptor |
| 385 |
if (DescriptorPackage.eINSTANCE == null) |
385 |
if (DescriptorPackage.eINSTANCE == null) |
| 386 |
{ |
386 |
{ |
| 387 |
WsdmToolingLog.logError( |
387 |
WsdmToolingLog.logError(Messages.FAILED_TO_INITIALIZE_MUSE_DESCRIPTOR_ERROR_, new Throwable()); |
| 388 |
Messages.FAILED_TO_INITIALIZE_MUSE_DESCRIPTOR_ERROR_, |
|
|
| 389 |
new Throwable()); |
| 390 |
} |
388 |
} |
| 391 |
} |
389 |
} |
| 392 |
|
390 |
|
|
Lines 404-448
Link Here
|
| 404 |
if (mrt == null) |
402 |
if (mrt == null) |
| 405 |
return null; |
403 |
return null; |
| 406 |
List capDataList = new ArrayList(); |
404 |
List capDataList = new ArrayList(); |
| 407 |
Capability[] capabilities = new Capability[0]; |
405 |
List caps = mrt.getImplements(); |
| 408 |
try |
406 |
if (caps != null) |
| 409 |
{ |
|
|
| 410 |
capabilities = MrtUtils.getCapabilities(mrt); |
| 411 |
} |
| 412 |
catch (Exception e) |
| 413 |
{ |
| 414 |
} |
| 415 |
for (int i = 0; i < capabilities.length; i++) |
| 416 |
{ |
407 |
{ |
| 417 |
Definition definition = capabilities[i].getWsdlDefinition() |
408 |
for (int i = 0; i < caps.size(); i++) |
| 418 |
.getDefinition(); |
|
|
| 419 |
String capNS = ""; |
| 420 |
if (definition != null) |
| 421 |
{ |
409 |
{ |
| 422 |
String nsURI = capabilities[i].getWsdlDefinition() |
410 |
CapabilityDefinition def; |
| 423 |
.getNamespace("capabilityURI"); |
411 |
try |
| 424 |
if (nsURI != null) |
412 |
{ |
| 425 |
capNS = nsURI; |
413 |
IFile iFile = EclipseUtils.getIFile((String) caps.get(i)); |
| 426 |
else |
414 |
def = WsdlUtils.getCapabilityDefinition(iFile); |
| 427 |
capNS = definition.getTargetNamespace(); |
415 |
} catch (Exception e) |
|
|
416 |
{ |
| 417 |
continue; |
| 418 |
} |
| 419 |
String capNS = ""; //$NON-NLS-1$ |
| 420 |
if (def != null) |
| 421 |
{ |
| 422 |
capNS = def.getNamespace("xmlns:capabilityURI"); |
| 423 |
if(capNS == null) |
| 424 |
capNS = def.getNamespace("targetNamespace"); |
| 425 |
if(capNS == null) |
| 426 |
capNS = ""; |
| 427 |
} else |
| 428 |
{ |
| 429 |
capNS = ""; |
| 430 |
} |
| 431 |
CapabilityTypeImpl ctype = (CapabilityTypeImpl) DescriptorFactory.eINSTANCE |
| 432 |
.createCapabilityType(); |
| 433 |
ctype.setCapabilityUri(capNS); |
| 434 |
ctype.setJavaCapabilityClass(""); //$NON-NLS-1$ |
| 435 |
/*boolean isValid = validateCapability(capDataList, ctype); |
| 436 |
if (isValid)*/ |
| 437 |
capDataList.add(ctype); |
| 428 |
} |
438 |
} |
| 429 |
CapabilityTypeImpl ctype = (CapabilityTypeImpl) DescriptorFactory.eINSTANCE |
|
|
| 430 |
.createCapabilityType(); |
| 431 |
ctype.setCapabilityUri(capNS); |
| 432 |
ctype.setJavaCapabilityClass(""); //$NON-NLS-1$ |
| 433 |
capDataList.add(ctype); |
| 434 |
} |
439 |
} |
| 435 |
return capDataList; |
440 |
return capDataList; |
| 436 |
} |
441 |
} |
| 437 |
|
442 |
|
| 438 |
/* |
443 |
/*private static boolean validateCapability(List capDataList, |
| 439 |
* private static boolean validateCapability(List capDataList, |
444 |
CapabilityTypeImpl ctype) |
| 440 |
* CapabilityTypeImpl ctype) { if (capDataList == null || capDataList.size() == |
445 |
{ |
| 441 |
* 0) { capDataList = new ArrayList(); return true; } for (int i = 0; i < |
446 |
if (capDataList == null || capDataList.size() == 0) |
| 442 |
* capDataList.size(); i++) { CapabilityTypeImpl tmp = (CapabilityTypeImpl) |
447 |
{ |
| 443 |
* capDataList.get(i); if (tmp.getCapabilityUri().trim().equals( |
448 |
capDataList = new ArrayList(); |
| 444 |
* ctype.getCapabilityUri().trim())) return false; } return true; } |
449 |
return true; |
| 445 |
*/ |
450 |
} |
|
|
451 |
for (int i = 0; i < capDataList.size(); i++) |
| 452 |
{ |
| 453 |
CapabilityTypeImpl tmp = (CapabilityTypeImpl) capDataList.get(i); |
| 454 |
if (tmp.getCapabilityUri().trim().equals( |
| 455 |
ctype.getCapabilityUri().trim())) |
| 456 |
return false; |
| 457 |
} |
| 458 |
return true; |
| 459 |
}*/ |
| 446 |
|
460 |
|
| 447 |
private static String getDefaultWsdlFileName(String mrtFileName) |
461 |
private static String getDefaultWsdlFileName(String mrtFileName) |
| 448 |
{ |
462 |
{ |
|
Lines 520-526
Link Here
|
| 520 |
| SWT.LEFT_TO_RIGHT); |
534 |
| SWT.LEFT_TO_RIGHT); |
| 521 |
txtIDFactory.setText(data.getJavaIdFactoryClass()); |
535 |
txtIDFactory.setText(data.getJavaIdFactoryClass()); |
| 522 |
txtIDFactory.setEnabled(false); |
536 |
txtIDFactory.setEnabled(false); |
| 523 |
txtIDFactory.setToolTipText(Messages.DU_TXT_ID_FACTORY_TOOLTIP); //$NON-NLS-1$ |
537 |
txtIDFactory |
|
|
538 |
.setToolTipText(Messages.DU_TXT_ID_FACTORY_TOOLTIP); //$NON-NLS-1$ |
| 524 |
controlEditor.setEditor(txtIDFactory, ti, 4); |
539 |
controlEditor.setEditor(txtIDFactory, ti, 4); |
| 525 |
// controlEditor |
540 |
// controlEditor |
| 526 |
// ti.setText(4, data.getJavaIdFactoryClass()); |
541 |
// ti.setText(4, data.getJavaIdFactoryClass()); |
|
Lines 545-550
Link Here
|
| 545 |
ti.setData(data); |
560 |
ti.setData(data); |
| 546 |
} |
561 |
} |
| 547 |
|
562 |
|
|
|
563 |
/*private static Capability getCapability(URI uri) |
| 564 |
{ |
| 565 |
Definition def; |
| 566 |
try |
| 567 |
{ |
| 568 |
def = WsdlUtils.getWSDLDefinition(uri); |
| 569 |
} catch (Exception e) |
| 570 |
{ |
| 571 |
return null; |
| 572 |
} |
| 573 |
Definition2Capability def2Capability = new Definition2Capability(def); |
| 574 |
Capability cap = def2Capability.getCapability(); |
| 575 |
return cap; |
| 576 |
}*/ |
| 577 |
|
| 548 |
/** |
578 |
/** |
| 549 |
* Method that checks whether the given {@link InitParamTypeImpl} object is |
579 |
* Method that checks whether the given {@link InitParamTypeImpl} object is |
| 550 |
* valid to be added to the initialization parameters table. |
580 |
* valid to be added to the initialization parameters table. |
|
Lines 560-576
Link Here
|
| 560 |
* @return true if the parameter data is not a duplicate.<br> |
590 |
* @return true if the parameter data is not a duplicate.<br> |
| 561 |
* false otherwise |
591 |
* false otherwise |
| 562 |
*/ |
592 |
*/ |
| 563 |
public static boolean validateParam(EObject data, InitParamTypeImpl pData, |
593 |
public static boolean validateParam(EObject data, |
| 564 |
int idx) |
594 |
InitParamTypeImpl pData, int idx) |
| 565 |
{ |
595 |
{ |
| 566 |
if (data == null || pData == null) |
596 |
if (data == null || pData == null) |
| 567 |
return false; |
597 |
return false; |
| 568 |
List paramList = null; |
598 |
List paramList = null; |
| 569 |
if (data instanceof ResourceTypeType) |
599 |
if(data instanceof ResourceTypeType) |
| 570 |
{ |
600 |
{ |
| 571 |
paramList = ((ResourceTypeType) data).getInitParam(); |
601 |
paramList = ((ResourceTypeType) data).getInitParam(); |
| 572 |
} |
602 |
} |
| 573 |
else if (data instanceof CapabilityTypeImpl) |
603 |
else if(data instanceof CapabilityTypeImpl) |
| 574 |
{ |
604 |
{ |
| 575 |
paramList = ((CapabilityTypeImpl) data).getInitParam(); |
605 |
paramList = ((CapabilityTypeImpl) data).getInitParam(); |
| 576 |
} |
606 |
} |
|
Lines 670-676
Link Here
|
| 670 |
{ |
700 |
{ |
| 671 |
IFile file = (IFile) availableFiles.get(i); |
701 |
IFile file = (IFile) availableFiles.get(i); |
| 672 |
// here filename comes with full path.... |
702 |
// here filename comes with full path.... |
| 673 |
if (file.getFullPath().toString().trim().equals(fileName.trim())) |
703 |
if (file.getFullPath().toString().trim() |
|
|
704 |
.equals(fileName.trim())) |
| 674 |
return file; |
705 |
return file; |
| 675 |
} |
706 |
} |
| 676 |
return null; |
707 |
return null; |
|
Lines 751-762
Link Here
|
| 751 |
} |
782 |
} |
| 752 |
return false; |
783 |
return false; |
| 753 |
} |
784 |
} |
| 754 |
|
785 |
|
| 755 |
/** |
786 |
/** |
| 756 |
* Formats the given path string to return the display name of the file. |
787 |
* Formats the given path string to return the display name of the file. |
| 757 |
* |
788 |
* @param jp - file path |
| 758 |
* @param jp - |
|
|
| 759 |
* file path |
| 760 |
* @return displayName - name of the file. |
789 |
* @return displayName - name of the file. |
| 761 |
*/ |
790 |
*/ |
| 762 |
public static String formatPath(String jp) |
791 |
public static String formatPath(String jp) |
|
Lines 764-770
Link Here
|
| 764 |
jp = jp.trim(); |
793 |
jp = jp.trim(); |
| 765 |
jp = jp.replace('\\', '/'); |
794 |
jp = jp.replace('\\', '/'); |
| 766 |
int idx = jp.trim().lastIndexOf('/'); |
795 |
int idx = jp.trim().lastIndexOf('/'); |
| 767 |
if (idx == -1) |
796 |
if(idx == -1) |
| 768 |
{ |
797 |
{ |
| 769 |
return jp; |
798 |
return jp; |
| 770 |
} |
799 |
} |
|
Lines 775-788
Link Here
|
| 775 |
} |
804 |
} |
| 776 |
|
805 |
|
| 777 |
/** |
806 |
/** |
| 778 |
* Create and return a new instance of given ResourceTypeType. Only |
807 |
* Create and return a new instance of given ResourceTypeType. |
| 779 |
* ContextPath, JavaIdFactoryClass, JavaResourceClass and WsdlType fields |
808 |
* Only ContextPath, JavaIdFactoryClass, JavaResourceClass and WsdlType fields have been copied. |
| 780 |
* have been copied. |
|
|
| 781 |
*/ |
809 |
*/ |
| 782 |
public static ResourceTypeType cloneResourceType(ResourceTypeType rt) |
810 |
public static ResourceTypeType cloneResourceType(ResourceTypeType rt) |
| 783 |
{ |
811 |
{ |
| 784 |
ResourceTypeType clone = DescriptorFactory.eINSTANCE |
812 |
ResourceTypeType clone = DescriptorFactory.eINSTANCE.createResourceTypeType(); |
| 785 |
.createResourceTypeType(); |
|
|
| 786 |
clone.setContextPath(rt.getContextPath()); |
813 |
clone.setContextPath(rt.getContextPath()); |
| 787 |
clone.setJavaIdFactoryClass(rt.getJavaIdFactoryClass()); |
814 |
clone.setJavaIdFactoryClass(rt.getJavaIdFactoryClass()); |
| 788 |
clone.setJavaResourceClass(rt.getJavaResourceClass()); |
815 |
clone.setJavaResourceClass(rt.getJavaResourceClass()); |
|
Lines 792-935
Link Here
|
| 792 |
clone.setWsdl(wClone); |
819 |
clone.setWsdl(wClone); |
| 793 |
return clone; |
820 |
return clone; |
| 794 |
} |
821 |
} |
| 795 |
|
822 |
|
| 796 |
/** |
823 |
/** |
| 797 |
* Returns the initial instances provided for given ResourceTypeType. |
824 |
* Returns the initial instances provided for given ResourceTypeType. |
| 798 |
*/ |
825 |
*/ |
| 799 |
public static InitialInstancesType[] getInitialInstances(RootType root, |
826 |
public static InitialInstancesType[] getInitialInstances(RootType root, ResourceTypeType resourceType) |
| 800 |
ResourceTypeType resourceType) |
|
|
| 801 |
{ |
827 |
{ |
| 802 |
List mrtInitInstances = new ArrayList(); |
828 |
List mrtInitInstances = new ArrayList(); |
| 803 |
List allInitInstances = root.getInitialInstances(); |
829 |
List allInitInstances = root.getInitialInstances(); |
| 804 |
for (int i = 0; i < allInitInstances.size(); i++) |
830 |
for(int i=0;i<allInitInstances.size();i++) |
| 805 |
{ |
831 |
{ |
| 806 |
InitialInstancesType initInstance = (InitialInstancesType) allInitInstances |
832 |
InitialInstancesType initInstance = (InitialInstancesType) allInitInstances.get(i); |
| 807 |
.get(i); |
833 |
ResourceTypeType rt = initInstance.getResourceType(); |
| 808 |
ResourceTypeType rt = initInstance.getResourceType(); |
834 |
if(rt.getContextPath().equals(resourceType.getContextPath()) |
| 809 |
if (rt.getContextPath().equals(resourceType.getContextPath()) |
835 |
&& rt.getWsdl().getWsdlFile().equals(resourceType.getWsdl().getWsdlFile())) |
| 810 |
&& rt.getWsdl().getWsdlFile().equals( |
836 |
mrtInitInstances.add(initInstance); |
| 811 |
resourceType.getWsdl().getWsdlFile())) |
837 |
} |
| 812 |
mrtInitInstances.add(initInstance); |
838 |
return (InitialInstancesType[])mrtInitInstances.toArray(new InitialInstancesType[mrtInitInstances.size()]); |
| 813 |
} |
839 |
} |
| 814 |
return (InitialInstancesType[]) mrtInitInstances |
840 |
|
| 815 |
.toArray(new InitialInstancesType[mrtInitInstances.size()]); |
841 |
/** |
| 816 |
} |
842 |
* Checks whether the given mrt file is already added to the deployment descriptor. |
| 817 |
|
843 |
* @param mrtFileName - name of the file |
| 818 |
/** |
844 |
* @param editor - DescriptorEditor instance |
| 819 |
* Checks whether the given mrt file is already added to the deployment |
|
|
| 820 |
* descriptor. |
| 821 |
* |
| 822 |
* @param mrtFileName - |
| 823 |
* name of the file |
| 824 |
* @param editor - |
| 825 |
* DescriptorEditor instance |
| 826 |
* @return true if already added, else false. |
845 |
* @return true if already added, else false. |
| 827 |
*/ |
846 |
*/ |
| 828 |
public static boolean presentInTheList(String mrtFileName, |
847 |
public static boolean presentInTheList(String mrtFileName, DescriptorEditor editor) |
| 829 |
DescriptorEditor editor) |
|
|
| 830 |
{ |
848 |
{ |
| 831 |
if (mrtFileName == null || mrtFileName.trim().length() == 0) |
849 |
if(mrtFileName == null || mrtFileName.trim().length() == 0) |
| 832 |
{ |
850 |
{ |
| 833 |
return true; |
851 |
return true; |
| 834 |
} |
852 |
} |
| 835 |
org.eclipse.swt.widgets.List lst = editor.getLstAddedMrts(); |
853 |
org.eclipse.swt.widgets.List lst = editor.getLstAddedMrts(); |
| 836 |
String items[] = lst.getItems(); |
854 |
String items[] = lst.getItems(); |
| 837 |
if (items == null || items.length == 0) |
855 |
if(items == null || items.length == 0) |
| 838 |
{ |
856 |
{ |
| 839 |
return false; |
857 |
return false; |
| 840 |
} |
858 |
} |
| 841 |
for (int i = 0; i < items.length; i++) |
859 |
for(int i = 0; i < items.length; i++) |
| 842 |
{ |
860 |
{ |
| 843 |
if (items[i].equals(mrtFileName)) |
861 |
if(items[i].equals(mrtFileName)) |
| 844 |
{ |
862 |
{ |
| 845 |
return true; |
863 |
return true; |
| 846 |
} |
864 |
} |
| 847 |
} |
865 |
} |
| 848 |
return false; |
866 |
return false; |
| 849 |
} |
867 |
} |
| 850 |
|
868 |
|
| 851 |
/** |
869 |
/** |
| 852 |
* Returns all the CustomSerializerType available in given |
870 |
* Returns all the capabilities available in given ManageableResourceType. |
| 853 |
* ManageableResourceType. |
|
|
| 854 |
*/ |
871 |
*/ |
| 855 |
public static CustomSerializerType[] getCustomSerializerType( |
872 |
public static Capability[] getAllCapabilities(ManageableResourceType mrt) throws IOException, CoreException |
| 856 |
ManageableResourceType mrt) throws IOException, CoreException |
|
|
| 857 |
{ |
873 |
{ |
| 858 |
List serializerTypes = new ArrayList(); |
874 |
Capability[] caps = null; |
| 859 |
Capability[] capability = new Capability[0]; |
875 |
try { |
| 860 |
try |
876 |
caps = MrtUtils.getCapabilities(mrt); |
| 861 |
{ |
877 |
} catch (Exception e) { |
| 862 |
capability = MrtUtils.getCapabilities(mrt); |
878 |
WsdmToolingLog.logError( |
| 863 |
} |
879 |
org.eclipse.tptp.wsdm.tooling.nls.messages.mrt.internal.Messages.MRT_ERROR_CANNOT_TRACE_CAPS, e); |
| 864 |
catch (Exception e) |
|
|
| 865 |
{ |
| 866 |
} |
880 |
} |
| 867 |
for (int capIndex = 0; capIndex < capability.length; capIndex++) |
881 |
if(caps != null) |
|
|
882 |
return caps; |
| 883 |
return new Capability[0]; |
| 884 |
} |
| 885 |
|
| 886 |
/** |
| 887 |
* Returns all the CustomSerializerType available in given ManageableResourceType. |
| 888 |
*/ |
| 889 |
public static CustomSerializerType[] getCustomSerializerType(ManageableResourceType mrt) throws IOException, CoreException |
| 890 |
{ |
| 891 |
List serializerTypes = new ArrayList(); |
| 892 |
Capability[] capability = getAllCapabilities(mrt); |
| 893 |
for(int capIndex=0; capIndex<capability.length; capIndex++) |
| 894 |
{ |
| 895 |
List props = capability[capIndex].getProperties(); |
| 896 |
for(int propIndex=0; propIndex<props.size(); propIndex++) |
| 868 |
{ |
897 |
{ |
| 869 |
List props = capability[capIndex].getProperties(); |
898 |
Property property = (Property) props.get(propIndex); |
| 870 |
for (int propIndex = 0; propIndex < props.size(); propIndex++) |
899 |
XSDElementDeclaration element = property.getElement(); |
| 871 |
{ |
900 |
if(element != null) |
| 872 |
Property property = (Property) props.get(propIndex); |
901 |
{ |
| 873 |
XSDElementDeclaration element = property.getElement(); |
902 |
CustomSerializerType serializer = getCustomSerializerType(element); |
| 874 |
if (element != null) |
903 |
if(serializer != null) |
| 875 |
{ |
904 |
serializerTypes.add(serializer); |
| 876 |
CustomSerializerType serializer = getCustomSerializerType(element); |
905 |
} |
| 877 |
if (serializer != null) |
|
|
| 878 |
serializerTypes.add(serializer); |
| 879 |
} |
| 880 |
} |
| 881 |
} |
906 |
} |
| 882 |
return (CustomSerializerType[]) serializerTypes |
907 |
} |
| 883 |
.toArray(new CustomSerializerType[serializerTypes.size()]); |
908 |
return (CustomSerializerType[]) serializerTypes.toArray(new CustomSerializerType[serializerTypes.size()]); |
| 884 |
} |
909 |
} |
| 885 |
|
910 |
|
| 886 |
private static CustomSerializerType getCustomSerializerType( |
911 |
private static CustomSerializerType getCustomSerializerType(XSDElementDeclaration elementDeclaration) |
| 887 |
XSDElementDeclaration elementDeclaration) |
|
|
| 888 |
{ |
912 |
{ |
| 889 |
XSDTypeDefinition typeDef = elementDeclaration.getTypeDefinition(); |
913 |
XSDTypeDefinition typeDef = elementDeclaration.getTypeDefinition(); |
| 890 |
if (typeDef == null) |
914 |
if(typeDef == null) |
| 891 |
return null; |
915 |
return null; |
| 892 |
if (!(typeDef instanceof XSDComplexTypeDefinition)) |
916 |
if(!(typeDef instanceof XSDComplexTypeDefinition)) |
| 893 |
return null; |
917 |
return null; |
| 894 |
XSDComplexTypeDefinition complexTypeDef = (XSDComplexTypeDefinition) typeDef; |
918 |
XSDComplexTypeDefinition complexTypeDef = (XSDComplexTypeDefinition) typeDef; |
| 895 |
CustomSerializerType serializer = DescriptorFactory.eINSTANCE |
919 |
CustomSerializerType serializer = DescriptorFactory.eINSTANCE.createCustomSerializerType(); |
| 896 |
.createCustomSerializerType(); |
920 |
String ns = complexTypeDef.getTargetNamespace(); |
| 897 |
String ns = complexTypeDef.getTargetNamespace(); |
921 |
String name = complexTypeDef.getName(); |
| 898 |
String name = complexTypeDef.getName(); |
922 |
if(name == null) |
| 899 |
if (name == null) |
923 |
name = ""; |
| 900 |
name = ""; |
924 |
serializer.setJavaSerializableType("{"+ns+"}"+name); |
| 901 |
serializer.setJavaSerializableType("{" + ns + "}" + name); |
925 |
serializer.setJavaSerializerClass(""); |
| 902 |
serializer.setJavaSerializerClass(""); |
926 |
return serializer; |
| 903 |
return serializer; |
|
|
| 904 |
} |
927 |
} |
| 905 |
|
928 |
|
| 906 |
/** |
929 |
/** |
| 907 |
* Loads the CustomSerializerType obtained from given MRT to the MuseType. |
930 |
* Loads the CustomSerializerType obtained from given MRT to the MuseType. |
| 908 |
*/ |
931 |
*/ |
| 909 |
public static void loadCustomSerializerTypeData(ManageableResourceType mrt, |
932 |
public static void loadCustomSerializerTypeData(ManageableResourceType mrt, MuseType muse) throws IOException, CoreException |
| 910 |
MuseType muse) throws IOException, CoreException |
|
|
| 911 |
{ |
933 |
{ |
| 912 |
CustomSerializerType[] serializers = getCustomSerializerType(mrt); |
934 |
CustomSerializerType[] serializers = getCustomSerializerType(mrt); |
| 913 |
List ddSerializers = muse.getCustomSerializer(); |
935 |
List ddSerializers = muse.getCustomSerializer(); |
| 914 |
for (int serializersIndex = 0; serializersIndex < serializers.length; serializersIndex++) |
936 |
for(int serializersIndex=0; serializersIndex<serializers.length; serializersIndex++) |
| 915 |
{ |
937 |
{ |
| 916 |
boolean found = false; |
938 |
boolean found = false; |
| 917 |
for (int ddSerializersIndex = 0; ddSerializersIndex < ddSerializers |
939 |
for(int ddSerializersIndex=0; ddSerializersIndex<ddSerializers.size(); ddSerializersIndex++) |
| 918 |
.size(); ddSerializersIndex++) |
940 |
{ |
| 919 |
{ |
941 |
CustomSerializerType ddSerializer = (CustomSerializerType) ddSerializers.get(ddSerializersIndex); |
| 920 |
CustomSerializerType ddSerializer = (CustomSerializerType) ddSerializers |
942 |
if(ddSerializer.getJavaSerializableType().equals(serializers[serializersIndex].getJavaSerializableType())) |
| 921 |
.get(ddSerializersIndex); |
943 |
{ |
| 922 |
if (ddSerializer.getJavaSerializableType() |
|
|
| 923 |
.equals( |
| 924 |
serializers[serializersIndex] |
| 925 |
.getJavaSerializableType())) |
| 926 |
{ |
| 927 |
found = true; |
944 |
found = true; |
| 928 |
break; |
945 |
break; |
| 929 |
} |
946 |
} |
| 930 |
} |
947 |
} |
| 931 |
if (!found) |
948 |
if(!found) |
| 932 |
muse.getCustomSerializer().add(serializers[serializersIndex]); |
949 |
muse.getCustomSerializer().add(serializers[serializersIndex]); |
| 933 |
} |
950 |
} |
| 934 |
} |
951 |
} |
| 935 |
} |
952 |
} |