WLSTはJythonベースでJavaを呼び出せるので、上記コードをWLSTから呼び出すことが 。以下は上記コードを呼び出すコードスニペットです。public static void main(String[] args) { try { MDSInstance mdsInstance = null; mdsInstance = MDSUtils.initializeDBStore("TEST_MDS", "welcome1", "jdbc:oracle:thin:@<machine.name>:1521:XE", "soa-infra", MDS_CONNECTION_NAME); // Recurse and display, from the root. recurse(mdsInstance, null, 0); // Find a resource List list = MDSUtils.findResource(mdsInstance, "deployed-composites", false); System.out.println("List: (" + list.size() + " element(s))"); for (ResourceName rn : list) System.out.println("Found : " + rn.getAbsoluteName() + " (a " + (rn.isPackageName() ? "package" : "document") + ")"); MDSUtils.createFolder(mdsInstance, PackageName.createPackageName("/oliv")); // Deleting folder List list = MDSUtils.findResource(mdsInstance, "oliv", false); System.out.println("List: (" + list.size() + " element(s))"); for (ResourceName rn : list) { System.out.println("Found : " + rn.getAbsoluteName() + " (a " + (rn.isPackageName() ? "package" : "document" ) + ")"); if (rn.isPackageName() && rn.getAbsoluteName().equals("/oliv")) { System.out.println("Deleting " + rn.getAbsoluteName()); MDSUtils.deleteResource(mdsInstance, rn); } else System.out.println("Leaving " + rn.getAbsoluteName() + " alone."); } System.out.println("Done"); }
今回ご紹介したコードはこちらからダウンロードできます。なお、コード実行の前に、WLSTのクラスパスに必要なクラスを登録しておく必要があります。ダウンロードしたプロジェクト内に、クラスパス追加のスクリプトを含めておきました。print "-----------------------------" y = "Yes" Y = y n = "No" N = n from oracle.ateam import MDSUtils mdsUtils = MDSUtils() # setup Connection parameters # The first call (createFolder, deleteFolder) will create the MDSInstance with those parameters. mdsUtils.setUserName("TEST_MDS") mdsUtils.setPassword("welcome1") mdsUtils.setPartition("soa-infra") mdsUtils.setDbUrl("jdbc:oracle:thin:@machine.name:1521:XE") # response = input("Do we create the \"oliv\" directory ? [y|n] > ") if response == y: print "Creating directory" mdsUtils.createFolder("/oliv") response = input("Do we delete the \"oliv\" directory ? [y|n] > ") if response == y: print "Deleting directory" mdsUtils.deleteFolder("/oliv") print "Done." print "Bye now"
原文はこちら。
http://blogs.oracle.com/ateamsoab2b/entry/full_access_to_mds_repository
0 件のコメント:
コメントを投稿